如何在终端中将长 txt 记录集添加到 gcloud dns?
How to add long txt recordset to gcloud dns in the terminal?
在 gcloud 控制台面板中,要添加长 txt 记录集(超过 255)需要添加用引号将字符串分成多个字符串(在示例中我按单词拆分,但你必须每 255 拆分一次字符):
原始字符串 = "loren inpsum"
gcloud format = "loren ""inpsum"
但是如果我尝试通过终端添加一个长的 txt 记录,如果我不拆分它,我会得到一个错误,如果我拆分它,我会得到多个 rrdata,这是我不想要的。
不拆分示例:(错误 400 无效 rdata)
gcloud dns record-sets transaction add mail._domainkey.example.com. "{rdata}" --ttl 300 --type TXT --zone {zone} --name
拆分示例:(此错误创建多个 rdata)
gcloud dns record-sets transaction add mail._domainkey.example.com. "{rdata}" "{rdata1}" --ttl 300 --type TXT --zone {zone} --name
感谢任何线索
[编辑]
google 文档:https://cloud.google.com/sdk/gcloud/reference/dns/record-sets/transaction/add
例子:
这给出了 rdata 值错误
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
这创造了多重价值
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
[解决方案]
我找到了解决方案
'"string1""string2""string3"'
像这样
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 发布的“string1”“string2”“string3”'
实际命令:
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
在 gcloud 控制台面板中,要添加长 txt 记录集(超过 255)需要添加用引号将字符串分成多个字符串(在示例中我按单词拆分,但你必须每 255 拆分一次字符): 原始字符串 = "loren inpsum" gcloud format = "loren ""inpsum"
但是如果我尝试通过终端添加一个长的 txt 记录,如果我不拆分它,我会得到一个错误,如果我拆分它,我会得到多个 rrdata,这是我不想要的。
不拆分示例:(错误 400 无效 rdata)
gcloud dns record-sets transaction add mail._domainkey.example.com. "{rdata}" --ttl 300 --type TXT --zone {zone} --name
拆分示例:(此错误创建多个 rdata)
gcloud dns record-sets transaction add mail._domainkey.example.com. "{rdata}" "{rdata1}" --ttl 300 --type TXT --zone {zone} --name
感谢任何线索
[编辑]
google 文档:https://cloud.google.com/sdk/gcloud/reference/dns/record-sets/transaction/add 例子: 这给出了 rdata 值错误
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
这创造了多重价值
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
[解决方案] 我找到了解决方案 '"string1""string2""string3"'
像这样
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 发布的“string1”“string2”“string3”'
实际命令:
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