octodns / octodns-cloudflare

Cloudflare DNS provider for octoDNS
MIT License
24 stars 18 forks source link

Proxy based on `0` TTL #81

Closed gmemstr closed 5 months ago

gmemstr commented 8 months ago

I have a bit of a funky use case - I'm using https://github.com/Janik-Haag/NixOS-DNS to generate my octodns configuration, and it works by generating a ZoneFile which octodns consumes (https://github.com/Janik-Haag/NixOS-DNS/blob/main/utils/zonefiles.nix). Unfortunately because of this we can't set the proxied status of a domain.

My pitch is the ability to set the TTL to 0 and this provider sees that as a request to proxy the domain, since the TTL of 0 doesn't make sense in other use cases.

Alternatively, I might look at the ZoneFileSource and retain the octodns.* configuration options as comments, which might be better long term?

ross commented 8 months ago

There's already a special ttl value, defined by Cloudflare not octodns-cloudflare, that enables proxied.

https://github.com/octodns/octodns-cloudflare/blob/59de7e37905605f8126bd7d1b391e55000474c89/octodns_cloudflare/__init__.py#L441

So if it sees a ttl of 1 it'll enable proxied.

If the source can't use make them 1 the other option would be to use a custom processor, defining a process_source_zone that looks for the 0, or whatever you want to drive it off of, and sets record._octodns['cloudflare']['proxied'] = true or whatever you'd like to do.

gmemstr commented 8 months ago

Oh, neat! Was digging through the code and must have missed this - thanks :)

gmemstr commented 8 months ago

Oh, right, I remember why this didn't occur to me

https://github.com/octodns/octodns-cloudflare/blob/v0.0.4/octodns_cloudflare/__init__.py#L188-L189

From what I'm reading, this effectively overrides the ttl of 1 every time? From my testing the TTL of 1 doesn't get used and proxying never gets added. I am going to look at the processor route but curious if this is intentional behaviour.

github-actions[bot] commented 5 months ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days.