octodns / octodns-hetzner

Hetzner DNS provider for octoDNS
MIT License
4 stars 1 forks source link

Constant repplication of TXT records #37

Open peterablehmann opened 4 months ago

peterablehmann commented 4 months ago

When I set my DKIM keys via octodns, it will try to reapply them on the next run.

When I run octodns it shows that it will update my txt record like this:

********************************************************************************
* hetzner (HetznerProvider)
*   Update
*     <TxtRecord TXT 60, default2307._domainkey.xnee.de., ['v=DKIM1\;p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyWMWI+s5s12xeAt+lhlOADEd/bemDd8bibDZu6eVYn8om+Gopn68IVyJ5+9SuJ4lkveFzNJagw7X9QRhTMqXI2+DpT1Yo59Z9CeyEhV7BFtsyKwlXTn2oTI3e4fswrQhMhrnUms2oaq+7D5tYo5qI9u7QLtBUnNoFWilaSpbKT+fbQODB8hW7x+af54fBS/+SqeKFSJ91cvoiLiOq+DWRRSqen/4lCFy2YD9HaUvjOsvxcVJHXwW+56fyAgPPquq5jYj8cbE7jcdoRqhx9uBzffLmNNFsRu7SXQBTiARdNpIuIU7/OdsZXHmnaj9RYX4Kyr6FfYSFRjC2sa6S7j56QIDAQAB"']> ->
*     <TxtRecord TXT 60, default2307._domainkey.xnee.de., ['v=DKIM1\;p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyWMWI+s5s12xeAt+lhlOADEd/bemDd8bibDZu6eVYn8om+Gopn68IVyJ5+9SuJ4lkveFzNJagw7X9QRhTMqXI2+DpT1Yo59Z9CeyEhV7BFtsyKwlXTn2oTI3e4fswrQhMhrnUms2oaq+7D5tYo5qI9u7QLtBUnNoFWilaSpbKT+fbQODB8hW7x+af54fBS/+SqeKFSJ91cvoiLiOq+DWRRSqen/4lCFy2YD9HaUvjOsvxcVJHXwW+56fyAgPPquq5jYj8cbE7jcdoRqhx9uBzffLmNNFsRu7SXQBTiARdNpIuIU7/OdsZXHmnaj9RYX4Kyr6FfYSFRjC2sa6S7j56QIDAQAB']> ()
*   Summary: Creates=0, Updates=1, Deletes=0, Existing Records=20
********************************************************************************

The only difference between the two is an additional " at the end of the key. After I apply and check again it still shows the same difference.

I've checked the API and the API returns both " the one at the beginning as well as the one at the end.

{
      "id": "********************************",
      "type": "TXT",
      "name": "default2307._domainkey",
      "value": "\"v=DKIM1;p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyWMWI+s5s12xeAt+lhlOADEd/bemDd8bibDZu6eVYn8om+Gopn68IVyJ5+9SuJ4lkveFzNJagw7X9QRhTMqXI2+DpT1Yo59Z9CeyEhV7BFtsyKwlXTn2oTI3e4fswrQhMhrnUms2oaq+7D5tYo5qI9u7QLtBUnNoFWilaSpbKT+fbQODB8hW7x+af54fBS/+SqeKFSJ91\" \"cvoiLiOq+DWRRSqen/4lCFy2YD9HaUvjOsvxcVJHXwW+56fyAgPPquq5jYj8cbE7jcdoRqhx9uBzffLmNNFsRu7SXQBTiARdNpIuIU7/OdsZXHmnaj9RYX4Kyr6FfYSFRjC2sa6S7j56QIDAQAB\" ",
      "ttl": 60,
      "zone_id": "**********************",
      "created": "2024-05-07 15:55:33.184 +0000 UTC",
      "modified": "2024-05-07 15:55:33.184 +0000 UTC"
}

Can someone take a look at this?

ross commented 4 months ago

Hrm. There doesn't appear to be any mucking with " for TXT records as they come into and get pushed out of octoDNS to Hetzner.

https://github.com/octodns/octodns-hetzner/blob/0bf3dcefe97e550e121973b497645f13711b586b/octodns_hetzner/__init__.py#L126-L132

https://github.com/octodns/octodns-hetzner/blob/0bf3dcefe97e550e121973b497645f13711b586b/octodns_hetzner/__init__.py#L262-L269

The only thing I see in there messing with double-quotes is CAA records.

You could try throwing debugging pprints, of values below line 127, and value below 263 to see what octoDNS is getting and sending, but I'm not immediately seeing what would remove one of the quotes, but not the other.

It seems odd that the value you're getting back from the API has an escaped double-quote and a space as well.

Unfortunately I don't have access to Hetzner so I can't poke around myself.

peterablehmann commented 4 months ago

How can I make octodns use the local version of the hetzner Provider after I have added the pprints? currently it fails because it does not find the hetznerdns provider.

ross commented 4 months ago

PYTHONPATH=/path/to/octodns-hertzner-root-directory should do the trick if you've just checked out the code and modified it in that clone.

peterablehmann commented 4 months ago

Thank you.

It looks to me like it gets the correct response from the API.

octodns-sync --config-file ../nix-servers/result xnee.de. --debug
2024-05-07T19:05:25  [140664333715264] INFO  Manager __init__: config_file=../nix-servers/result, (octoDNS 1.6.1)
2024-05-07T19:05:25  [140664333715264] INFO  Manager _config_executor: max_workers=1
2024-05-07T19:05:25  [140664333715264] INFO  Manager _config_include_meta: include_meta=False
2024-05-07T19:05:25  [140664333715264] INFO  Manager _config_enable_checksum: enable_checksum=False
2024-05-07T19:05:25  [140664333715264] DEBUG Manager _config_secret_handlers: configuring secret_handlers
2024-05-07T19:05:25  [140664333715264] INFO  Manager _config_auto_arpa: auto_arpa=False
2024-05-07T19:05:25  [140664333715264] INFO  Manager __init__: global_processors=[]
2024-05-07T19:05:25  [140664333715264] INFO  Manager __init__: global_post_processors=[]
2024-05-07T19:05:25  [140664333715264] DEBUG Manager _config_providers: configuring providers
2024-05-07T19:05:25  [140664333715264] DEBUG Manager _build_kwargs: failed to find handler for key "directoryp 
2024-05-07T19:05:25  [140664333715264] DEBUG ZoneFileProvider[config] __init__: id=config, directory=/nix/store/rhxg3781ppsql33ndmka0riqh4v5lzb2-zones, file_extension=, check_origin=True, hostmaster_email=webmaster, default_ttl=3600, refresh=3600, retry=600, expire=604800, nxdomain=3600
2024-05-07T19:05:25  [140664333715264] DEBUG ZoneFileProvider[config] __init__: id=config, apply_disabled=False, update_pcent_threshold=0.30, delete_pcent_threshold=0.30
2024-05-07T19:05:25  [140664333715264] INFO  Manager __init__: provider=config (octodns_bind 0.0.6)
2024-05-07T19:05:25  [140664333715264] DEBUG HetznerProvider[hetzner] __init__: id=hetzner, token=***
2024-05-07T19:05:25  [140664333715264] DEBUG HetznerProvider[hetzner] __init__: id=hetzner, apply_disabled=False, update_pcent_threshold=0.30, delete_pcent_threshold=0.30
2024-05-07T19:05:25  [140664333715264] INFO  Manager __init__: provider=hetzner (octodns_hetzner 0.0.2)
2024-05-07T19:05:25  [140664333715264] INFO  Manager sync: eligible_zones=['xnee.de.'], eligible_targets=[], dry_run=True, force=False, plan_output_fh=<stdout>, checksum=None
2024-05-07T19:05:25  [140664333715264] INFO  Manager sync:   zone=xnee.de.
2024-05-07T19:05:25  [140664333715264] INFO  Manager sync:     sources=['config']
2024-05-07T19:05:25  [140664333715264] INFO  Manager sync:     processors=[]
2024-05-07T19:05:25  [140664333715264] INFO  Manager sync:     targets=['hetzner']
2024-05-07T19:05:25  [140664333715264] DEBUG Zone __init__: zone=Zone<xnee.de.>, sub_zones=set()
2024-05-07T19:05:25  [140664333715264] DEBUG Manager sync:   populating, zone=xnee.de., lenient=False
2024-05-07T19:05:25  [140664333715264] DEBUG ZoneFileProvider[config] populate: name=xnee.de., target=False, lenient=False
2024-05-07T19:05:25  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type=  SrvRecord, name=_autodiscover._tcp
2024-05-07T19:05:25  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type=  TxtRecord, name=_dmarc
2024-05-07T19:05:25  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type=  SrvRecord, name=_imaps._tcp
2024-05-07T19:05:25  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type=  SrvRecord, name=_pop3s._tcp
2024-05-07T19:05:25  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type=  SrvRecord, name=_submission._tcp
2024-05-07T19:05:25  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type=CnameRecord, name=autoconfig
2024-05-07T19:05:25  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type=  TxtRecord, name=default2307._domainkey
2024-05-07T19:05:25  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type= AaaaRecord, name=dhcp
2024-05-07T19:05:25  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type= AaaaRecord, name=garage1
2024-05-07T19:05:25  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type= AaaaRecord, name=garage2
2024-05-07T19:05:25  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type= AaaaRecord, name=garage3
2024-05-07T19:05:25  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type= AaaaRecord, name=installer
2024-05-07T19:05:25  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type= AaaaRecord, name=netbox
2024-05-07T19:05:25  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type=    ARecord, name=proxmox
2024-05-07T19:05:25  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type= AaaaRecord, name=proxmox
2024-05-07T19:05:25  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type= AaaaRecord, name=s3
2024-05-07T19:05:25  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type= AaaaRecord, name=stonks-ticker
2024-05-07T19:05:25  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type=   MxRecord, name=
2024-05-07T19:05:25  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type=   NsRecord, name=
2024-05-07T19:05:25  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type=  TxtRecord, name=
2024-05-07T19:05:25  [140664333715264] INFO  ZoneFileProvider[config] populate:   found 20 records
2024-05-07T19:05:25  [140664333715264] DEBUG Manager sync:   planning, zone=xnee.de.
2024-05-07T19:05:25  [140664333715264] INFO  HetznerProvider[hetzner] plan: desired=xnee.de.
2024-05-07T19:05:25  [140664333715264] DEBUG Zone __init__: zone=Zone<xnee.de.>, sub_zones=set()
2024-05-07T19:05:25  [140664333715264] DEBUG HetznerProvider[hetzner] populate: name=xnee.de., target=True, lenient=True
2024-05-07T19:05:25  [140664333715264] DEBUG urllib3.connectionpool Starting new HTTPS connection (1): dns.hetzner.com:443
2024-05-07T19:05:25  [140664333715264] DEBUG urllib3.connectionpool https://dns.hetzner.com:443 "GET /api/v1/zones?name=xnee.de HTTP/1.1" 200 721
2024-05-07T19:05:26  [140664333715264] DEBUG urllib3.connectionpool https://dns.hetzner.com:443 "GET /api/v1/records?zone_id=2XsCWYG2KBSxrFRXkaFJkh HTTP/1.1" 200 None
2024-05-07T19:05:26  [140664333715264] WARNING HetznerProvider[hetzner] populate: skipping unsupported SOA record
2024-05-07T19:05:26  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type=   MxRecord, name=
2024-05-07T19:05:26  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type=   NsRecord, name=
['"v=spf1 mx -all"']
2024-05-07T19:05:26  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type=  TxtRecord, name=
2024-05-07T19:05:26  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type=CnameRecord, name=autoconfig
2024-05-07T19:05:26  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type=  SrvRecord, name=_autodiscover._tcp
['"v=DMARC1\\;p=quarantine\\;sp=quarantine\\;pct=100\\;rua=mailto:dmarc@xnee.net\\;ruf=mailto:dmarc@xnee.net\\;adkim=s\\;aspf=s\\;"']
2024-05-07T19:05:26  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type=  TxtRecord, name=_dmarc
2024-05-07T19:05:26  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type=  SrvRecord, name=_submission._tcp
2024-05-07T19:05:26  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type=  SrvRecord, name=_imaps._tcp
2024-05-07T19:05:26  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type=  SrvRecord, name=_pop3s._tcp
['65.108.0.24']
2024-05-07T19:05:26  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type=    ARecord, name=proxmox
['2a01:4f9:6a:4f6f::1']
2024-05-07T19:05:26  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type= AaaaRecord, name=proxmox
['2a01:4f9:6a:4f6f::6']
2024-05-07T19:05:26  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type= AaaaRecord, name=stonks-ticker
['2a01:4f9:6a:4f6f:ffff:ffff:ffff:ffff']
2024-05-07T19:05:26  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type= AaaaRecord, name=installer
['2a01:4f9:6a:4f6f::5']
2024-05-07T19:05:26  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type= AaaaRecord, name=dhcp
['2a01:4f9:6a:4f6f::8']
2024-05-07T19:05:26  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type= AaaaRecord, name=garage1
['2a01:4f9:6a:4f6f::b']
2024-05-07T19:05:26  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type= AaaaRecord, name=netbox
['2a01:4f9:6a:4f6f::9']
2024-05-07T19:05:26  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type= AaaaRecord, name=garage2
['2a01:4f9:6a:4f6f::a']
2024-05-07T19:05:26  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type= AaaaRecord, name=garage3
['2a01:4f9:6a:4f6f::a', '2a01:4f9:6a:4f6f::8', '2a01:4f9:6a:4f6f::9']
2024-05-07T19:05:26  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type= AaaaRecord, name=s3
['"v=DKIM1\\;p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyWMWI+s5s12xeAt+lhlOADEd/bemDd8bibDZu6eVYn8om+Gopn68IVyJ5+9SuJ4lkveFzNJagw7X9QRhTMqXI2+DpT1Yo59Z9CeyEhV7BFtsyKwlXTn2oTI3e4fswrQhMhrnUms2oaq+7D5tYo5qI9u7QLtBUnNoFWilaSpbKT+fbQODB8hW7x+af54fBS/+SqeKFSJ91" '
 '"cvoiLiOq+DWRRSqen/4lCFy2YD9HaUvjOsvxcVJHXwW+56fyAgPPquq5jYj8cbE7jcdoRqhx9uBzffLmNNFsRu7SXQBTiARdNpIuIU7/OdsZXHmnaj9RYX4Kyr6FfYSFRjC2sa6S7j56QIDAQAB" ']
2024-05-07T19:05:26  [140664333715264] DEBUG Record __init__: zone.name=xnee.de., type=  TxtRecord, name=default2307._domainkey
2024-05-07T19:05:26  [140664333715264] INFO  HetznerProvider[hetzner] populate:   found 20 records, exists=True
2024-05-07T19:05:26  [140664333715264] DEBUG Zone __init__: zone=Zone<xnee.de.>, sub_zones=set()
2024-05-07T19:05:26  [140664333715264] DEBUG Zone changes: zone=Zone<xnee.de.>, target=HetznerProvider
2024-05-07T19:05:26  [140664333715264] DEBUG Zone changes: zone=Zone<xnee.de.>, n.c. record=<AaaaRecord AAAA 60, s3.xnee.de., ['2a01:4f9:6a:4f6f::8', '2a01:4f9:6a:4f6f::9', '2a01:4f9:6a:4f6f::a']>
2024-05-07T19:05:26  [140664333715264] DEBUG Zone changes: zone=Zone<xnee.de.>, n.c. record=<TxtRecord TXT 60, _dmarc.xnee.de., ['v=DMARC1\;p=quarantine\;sp=quarantine\;pct=100\;rua=mailto:dmarc@xnee.net\;ruf=mailto:dmarc@xnee.net\;adkim=s\;aspf=s\;']>
2024-05-07T19:05:26  [140664333715264] DEBUG Zone changes: zone=Zone<xnee.de.>, n.c. record=<SrvRecord SRV 60, _submission._tcp.xnee.de., [''0 100 587 mail.your-server.de.'']>
2024-05-07T19:05:26  [140664333715264] DEBUG Zone changes: zone=Zone<xnee.de.>, n.c. record=<TxtRecord TXT 60, xnee.de., ['v=spf1 mx -all']>
2024-05-07T19:05:26  [140664333715264] DEBUG Zone changes: zone=Zone<xnee.de.>, n.c. record=<ARecord A 60, proxmox.xnee.de., ['65.108.0.24']>
2024-05-07T19:05:26  [140664333715264] DEBUG Zone changes: zone=Zone<xnee.de.>, n.c. record=<SrvRecord SRV 60, _imaps._tcp.xnee.de., [''0 100 993 mail.your-server.de.'']>
2024-05-07T19:05:26  [140664333715264] DEBUG Zone changes: zone=Zone<xnee.de.>, modified
    existing=<TxtRecord TXT 60, default2307._domainkey.xnee.de., ['v=DKIM1\;p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyWMWI+s5s12xeAt+lhlOADEd/bemDd8bibDZu6eVYn8om+Gopn68IVyJ5+9SuJ4lkveFzNJagw7X9QRhTMqXI2+DpT1Yo59Z9CeyEhV7BFtsyKwlXTn2oTI3e4fswrQhMhrnUms2oaq+7D5tYo5qI9u7QLtBUnNoFWilaSpbKT+fbQODB8hW7x+af54fBS/+SqeKFSJ91cvoiLiOq+DWRRSqen/4lCFy2YD9HaUvjOsvxcVJHXwW+56fyAgPPquq5jYj8cbE7jcdoRqhx9uBzffLmNNFsRu7SXQBTiARdNpIuIU7/OdsZXHmnaj9RYX4Kyr6FfYSFRjC2sa6S7j56QIDAQAB"']>,
     desired=<TxtRecord TXT 60, default2307._domainkey.xnee.de., ['v=DKIM1\;p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyWMWI+s5s12xeAt+lhlOADEd/bemDd8bibDZu6eVYn8om+Gopn68IVyJ5+9SuJ4lkveFzNJagw7X9QRhTMqXI2+DpT1Yo59Z9CeyEhV7BFtsyKwlXTn2oTI3e4fswrQhMhrnUms2oaq+7D5tYo5qI9u7QLtBUnNoFWilaSpbKT+fbQODB8hW7x+af54fBS/+SqeKFSJ91cvoiLiOq+DWRRSqen/4lCFy2YD9HaUvjOsvxcVJHXwW+56fyAgPPquq5jYj8cbE7jcdoRqhx9uBzffLmNNFsRu7SXQBTiARdNpIuIU7/OdsZXHmnaj9RYX4Kyr6FfYSFRjC2sa6S7j56QIDAQAB']>
2024-05-07T19:05:26  [140664333715264] DEBUG Zone changes: zone=Zone<xnee.de.>, n.c. record=<AaaaRecord AAAA 60, installer.xnee.de., ['2a01:4f9:6a:4f6f:ffff:ffff:ffff:ffff']>
2024-05-07T19:05:26  [140664333715264] DEBUG Zone changes: zone=Zone<xnee.de.>, n.c. record=<AaaaRecord AAAA 60, garage3.xnee.de., ['2a01:4f9:6a:4f6f::a']>
2024-05-07T19:05:26  [140664333715264] DEBUG Zone changes: zone=Zone<xnee.de.>, n.c. record=<SrvRecord SRV 60, _autodiscover._tcp.xnee.de., [''0 100 443 mail.your-server.de.'']>
2024-05-07T19:05:26  [140664333715264] DEBUG Zone changes: zone=Zone<xnee.de.>, n.c. record=<AaaaRecord AAAA 60, stonks-ticker.xnee.de., ['2a01:4f9:6a:4f6f::6']>
2024-05-07T19:05:26  [140664333715264] DEBUG Zone changes: zone=Zone<xnee.de.>, n.c. record=<SrvRecord SRV 60, _pop3s._tcp.xnee.de., [''0 100 995 mail.your-server.de.'']>
2024-05-07T19:05:26  [140664333715264] DEBUG Zone changes: zone=Zone<xnee.de.>, n.c. record=<AaaaRecord AAAA 60, garage2.xnee.de., ['2a01:4f9:6a:4f6f::9']>
2024-05-07T19:05:26  [140664333715264] DEBUG Zone changes: zone=Zone<xnee.de.>, n.c. record=<NsRecord NS 60, xnee.de., ['helium.ns.hetzner.de.', 'hydrogen.ns.hetzner.com.', 'oxygen.ns.hetzner.com.']>
2024-05-07T19:05:26  [140664333715264] DEBUG Zone changes: zone=Zone<xnee.de.>, n.c. record=<AaaaRecord AAAA 60, dhcp.xnee.de., ['2a01:4f9:6a:4f6f::5']>
2024-05-07T19:05:26  [140664333715264] DEBUG Zone changes: zone=Zone<xnee.de.>, n.c. record=<AaaaRecord AAAA 60, proxmox.xnee.de., ['2a01:4f9:6a:4f6f::1']>
2024-05-07T19:05:26  [140664333715264] DEBUG Zone changes: zone=Zone<xnee.de.>, n.c. record=<MxRecord MX 60, xnee.de., [''10 www208.your-server.de.'']>
2024-05-07T19:05:26  [140664333715264] DEBUG Zone changes: zone=Zone<xnee.de.>, n.c. record=<AaaaRecord AAAA 60, netbox.xnee.de., ['2a01:4f9:6a:4f6f::b']>
2024-05-07T19:05:26  [140664333715264] DEBUG Zone changes: zone=Zone<xnee.de.>, n.c. record=<AaaaRecord AAAA 60, garage1.xnee.de., ['2a01:4f9:6a:4f6f::8']>
2024-05-07T19:05:26  [140664333715264] DEBUG Zone changes: zone=Zone<xnee.de.>, n.c. record=<CnameRecord CNAME 60, autoconfig.xnee.de., mail.your-server.de.>
2024-05-07T19:05:26  [140664333715264] DEBUG Plan __init__: Creates=0, Updates=1, Deletes=0 Existing=20
2024-05-07T19:05:26  [140664333715264] INFO  HetznerProvider[hetzner] plan:   Creates=0, Updates=1, Deletes=0, Existing Records=20
2024-05-07T19:05:26  [140664333715264] INFO  Plan 
********************************************************************************
* xnee.de.
********************************************************************************
* hetzner (HetznerProvider)
*   Update
*     <TxtRecord TXT 60, default2307._domainkey.xnee.de., ['v=DKIM1\;p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyWMWI+s5s12xeAt+lhlOADEd/bemDd8bibDZu6eVYn8om+Gopn68IVyJ5+9SuJ4lkveFzNJagw7X9QRhTMqXI2+DpT1Yo59Z9CeyEhV7BFtsyKwlXTn2oTI3e4fswrQhMhrnUms2oaq+7D5tYo5qI9u7QLtBUnNoFWilaSpbKT+fbQODB8hW7x+af54fBS/+SqeKFSJ91cvoiLiOq+DWRRSqen/4lCFy2YD9HaUvjOsvxcVJHXwW+56fyAgPPquq5jYj8cbE7jcdoRqhx9uBzffLmNNFsRu7SXQBTiARdNpIuIU7/OdsZXHmnaj9RYX4Kyr6FfYSFRjC2sa6S7j56QIDAQAB"']> ->
*     <TxtRecord TXT 60, default2307._domainkey.xnee.de., ['v=DKIM1\;p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyWMWI+s5s12xeAt+lhlOADEd/bemDd8bibDZu6eVYn8om+Gopn68IVyJ5+9SuJ4lkveFzNJagw7X9QRhTMqXI2+DpT1Yo59Z9CeyEhV7BFtsyKwlXTn2oTI3e4fswrQhMhrnUms2oaq+7D5tYo5qI9u7QLtBUnNoFWilaSpbKT+fbQODB8hW7x+af54fBS/+SqeKFSJ91cvoiLiOq+DWRRSqen/4lCFy2YD9HaUvjOsvxcVJHXwW+56fyAgPPquq5jYj8cbE7jcdoRqhx9uBzffLmNNFsRu7SXQBTiARdNpIuIU7/OdsZXHmnaj9RYX4Kyr6FfYSFRjC2sa6S7j56QIDAQAB']> ()
*   Summary: Creates=0, Updates=1, Deletes=0, Existing Records=20
********************************************************************************

2024-05-07T19:05:26  [140664333715264] DEBUG Manager sync:   checking safety
ross commented 4 months ago

Ah. Interesting. Didn't see that the value was "chunked", broken up b/c it's longer then 255 chars. That brings some other code into play, and the bit that's specifically relevant here where the parsing of chunked values happens, and we drop the last character if it appears to be quoted:

https://github.com/octodns/octodns/blob/ed13d2db52b4127f1035a8927a396467219b9918/octodns/record/chunked.py#L65-L66

So what's happening makes sense. The Hetzner API has a spurious space after the ", so when we drop the last character assuming it's a double-quote it's actually the space and that leaves the actual double quote.

Not sure whether the fix belongs in octoDNS core, octodns-hetzner, or maybe both. Will have to think about it a bit.

In the meantime you can test it out by changing line 127 to be:

values = [record['value'].replace(';', '\\;').strip() for record in records]
istr commented 4 months ago

@ross

Not sure whether the fix belongs in octoDNS core, octodns-hetzner, or maybe both. Will have to think about it a bit.

It would be great if octoDNS core could handle both cases, with and without (any form of) whitespace between (or before or after) the quotes. Other providers also have similar "quirks".

See https://github.com/octodns/octodns/issues/1088#issuecomment-1763495486 and https://github.com/octodns/octodns/issues/1088#issuecomment-1769209624 and https://github.com/octodns/octodns/issues/1088#issuecomment-1763495481 and https://github.com/octodns/octodns/pull/115/commits

ross commented 4 months ago

Yeah that's where I landed. I was 50/50 on whether it should also be fixed here so that an updated octoDNS core wouldn't be required to address the problem. I think I decided that it's not worth it to bother, but if anyone feels otherwise a PR is welcomed.