0

In gcloud console panel, to add long txt recordset (over 255) need to add dividing the string in multiple string with quotes like this (In the example I split it by word, but you have to split it every 255 chars): original string = "loren inpsum" gcloud format = "loren ""inpsum"

But if I try to add a long txt record via terminal, I get an error if I not split it, and if I split it I get multi rrdata, which I dont want that.

Not spliting example: (error 400 invalid rdata)

gcloud dns record-sets transaction add mail._domainkey.example.com. "{rdata}" --ttl 300 --type TXT --zone {zone} --name

Example spliting: (this error create multiple rdata)

gcloud dns record-sets transaction add mail._domainkey.example.com. "{rdata}" "{rdata1}" --ttl 300 --type TXT --zone {zone} --name

Thanks for any clue

[edit]

google doc: https://cloud.google.com/sdk/gcloud/reference/dns/record-sets/transaction/add examples: this give rdata value error

gcloud dns record-sets transaction add --name mail._domainkey.example.com. "v=DKIM1; h=sha256; k=rsa; s=email; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuStUNDJvpZcJpS4awOyD/I4H910zxR1JbrW4DhvHLcIr+ry5TkRvHp+H66LnYyOZVsU8G8S0u8Sftv1kK633M+HJLc0GBaFEFYEpyEwAUvs20S7FoPThz0ZFfxEDTPyww00BWv5BSIUA0HPPpKLHDlDtFr2r/rt9S7IGOLQ0oMm5bDgHZR1UXPbAsFSpcWAkLf5i8SDD0UPVqauqThYKWk0CsVcdF3L7OGQIVK21eVlHVb23e7FBfwO6tDZJQnpaV3LdLSzWPYSB2VeaQAIpZfaKMzmJJW/v0pnQZ2UD9WWaj3X4a+1VVLfx97CqiQigqMpbcrzrnhHGz6pwjEPwowIDAQAB" --ttl 300 --type TXT

this create multi value

gcloud dns record-sets transaction add --name mail._domainkey.example.com. "v=DKIM1; h=sha256; k=rsa; s=email; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuStUNDJvpZcJpS4awOyD/I4H910zxR1JbrW4DhvHLcIr+ry5TkRvHp+H66LnYyOZVsU8G8S0u8Sftv1kK633M+HJLc0GBaFEFYEpyEwAUvs20S7FoPThz0ZFfxEDTPyww00BWv5BSIUA0HPPpKLHDlDtFr2r/rt9S7IGOLQ0oMm5bDgHZR1UXPbAsFSpcWAkLf5i8SDD0UPVqauqT" "hYKWk0CsVcdF3L7OGQIVK21eVlHVb23e7FBfwO6tDZJQnpaV3LdLSzWPYSB2VeaQAIpZfaKMzmJJW/v0pnQZ2UD9WWaj3X4a+1VVLfx97CqiQigqMpbcrzrnhHGz6pwjEPwowIDAQAB" --ttl 300 --type TXT

[SOLUTION] I find the solution '"string1""string2""string3"'

like this

gcloud dns record-sets transaction add --name mail._domainkey.example.com. '"v=DKIM1; h=sha256; k=rsa; s=email; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuStUNDJvpZcJpS4awOyD/I4H910zxR1JbrW4DhvHLcIr+ry5TkRvHp+H66LnYyOZVsU8G8S0u8Sftv1kK633M+HJLc0GBaFEFYEpyEwAUvs20S7FoPThz0ZFfxEDTPyww00BWv5BSIUA0HPPpKLHDlDtFr2r/rt9S7IGOLQ0oMm5bDgHZR1UXPbAsFSpcWAkLf5i8SDD0UPVqauqT" "hYKWk0CsVcdF3L7OGQIVK21eVlHVb23e7FBfwO6tDZJQnpaV3LdLSzWPYSB2VeaQAIpZfaKMzmJJW/v0pnQZ2UD9WWaj3X4a+1VVLfx97CqiQigqMpbcrzrnhHGz6pwjEPwowIDAQAB"' --ttl 300 --type TXT
Mariano DAngelo
  • 920
  • 5
  • 18
  • 39
  • Use this DNS splitter to create records that work with Google Cloud DNS: https://www.mailhardener.com/tools/dns-record-splitter I am not sure what problem you have with multiple resource records. The max size is 255 bytes. This is overcome by creating multiple records. Resolvers then combine the answers into one string. Edit your question and show an actual record that is a problem and the reported problem (DKIM validation or similar). – John Hanley Jan 11 '22 at 20:11
  • I can split it manually, but I dont want to create the record in the website, I want to use gcloud terminal... multiple records is not the same as one long record I need to add a dkim, so its too long. If I add it from gcloud website, spliting in one rdata it works ok, the problem is calling from the terminal, the correct sintaxis is not documented, and already all I imagine – Mariano DAngelo Jan 11 '22 at 21:26
  • The maximum size of a record is 255 bytes. Can you show a command that creates a DKIM resource record, the resource record, and then an actual error using that resource record? For example, create the resource and then use an Internet tool to validate the DKIM data. – John Hanley Jan 11 '22 at 21:31
  • @JohnHanley yes the max size is 255, in the gcloud web control panel to append more than 255 you have to put the string like this "string 255 long""another string 255""another...""another..." but doing this from the terminal if I put it without spaces I get error, if I put it with spaces it create multiple data values, and I need only one data value separate by 255 bytes. Here's gcloud doc https://cloud.google.com/sdk/gcloud/reference/dns/record-sets/transaction/add. I edit the post with and example of the data value – Mariano DAngelo Jan 12 '22 at 13:00

1 Answers1

1

The solution would be two double quotes eg: "string1""string2""string3"' as posted by @Mariano DAngelo

Actual command:

gcloud dns record-sets transaction add --name mail._domainkey.example.com. '"v=DKIM1; h=sha256; k=rsa; s=email; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuStUNDJvpZcJpS4awOyD/I4H910zxR1JbrW4DhvHLcIr+ry5TkRvHp+H66LnYyOZVsU8G8S0u8Sftv1kK633M+HJLc0GBaFEFYEpyEwAUvs20S7FoPThz0ZFfxEDTPyww00BWv5BSIUA0HPPpKLHDlDtFr2r/rt9S7IGOLQ0oMm5bDgHZR1UXPbAsFSpcWAkLf5i8SDD0UPVqauqT" "hYKWk0CsVcdF3L7OGQIVK21eVlHVb23e7FBfwO6tDZJQnpaV3LdLSzWPYSB2VeaQAIpZfaKMzmJJW/v0pnQZ2UD9WWaj3X4a+1VVLfx97CqiQigqMpbcrzrnhHGz6pwjEPwowIDAQAB"' --ttl 300 --type TXT
Alex G
  • 1,179
  • 3
  • 15