caddyserver / caddy

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
https://caddyserver.com
Apache License 2.0
58.39k stars 4.04k forks source link

Dns control automation #5557

Closed gedw99 closed 1 year ago

gedw99 commented 1 year ago

https://github.com/StackExchange/dnscontrol Is able to apply dns settings to a DNS provider.

what would be super cool is a reconciliation engine between caddy config and the DNS via this software.

It would ensure that settings in the caddy config exist in the DNS. Kind of like a caddy DNS Operator.

often the operator of caddy and the higher kevel users that own the DNS records ( or access to them ) are of course different orgs.

So the caddy config export would need to spit out the DSL per Domain , and not all domains.

i don’t Know how Idempotent this DNS control is yet which has a bearing on race conditions to a degree.

I had to raise an issue here to sort that out:

https://github.com/StackExchange/dnscontrol/issues/2399

Of course DBS setting sometimes also get screwed up because someone changed them on the DNS Provider without knowing what upstream system(a) relied on them.

There maybe a way to also do reverse reconciliation checking. Like a job checks the actual DNS setting ( via the DNS Control DSL) against what is in the Caddy config.

i consider this part of a race condition that is related to idempotency. So it’s related.

francislavoie commented 1 year ago

You can already do so with this plugin, unless I misunderstand what you're asking for https://github.com/mholt/caddy-dynamicdns

Caddy integrates with https://github.com/libdns/libdns which we created to suit our needs (moving away from lego because of a variety of issues). There are caddy-dns plugins for most DNS providers that Caddy can use for the ACME DNS challenge (updating TXT records) or with the dynamic-dns plugin (for updating A and AAAA records).

mholt commented 1 year ago

If you're talking about having A/AAAA records pointed properly at your Caddy instance, then yeah what Francis suggested is what you're looking for.

If what you want is a Caddy app that keeps all DNS records in sync against some sort of list, that doesn't exist yet AFAIK. But someone could certainly create that.

Hope that helps!

gedw99 commented 1 year ago

Thanks ! I Never knew . Caddy has it sorted

gedw99 commented 1 year ago

“ If what you want is a Caddy app that keeps all DNS records in sync against some sort of list”.

That’s exactly what I need and so this DNS control thing is designed exactly for that .

might have time to integrate with Caddy

mholt commented 1 year ago

Yeah that would be cool.

gedw99 commented 1 year ago

@mholt Way to extract the domains out of caddyfile easily ? So I can do reconciliation.

Have it working on DNSControl side

Can then job it to run two way reconciliation

francislavoie commented 1 year ago

The dynamicdns plugin already has a feature which does that:

https://github.com/mholt/caddy-dynamicdns#dynamic-domains

gedw99 commented 1 year ago

Sweet - will check it out