Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keeps ading A records even when "update only" #7

Closed
Aergernis opened this issue Aug 14, 2024 · 9 comments · Fixed by #8
Closed

Keeps ading A records even when "update only" #7

Aergernis opened this issue Aug 14, 2024 · 9 comments · Fixed by #8

Comments

@Aergernis
Copy link

Hi,

the DNS is always adding A records to the DNS even when "update only" is set

dynamic_dns { provider ionos <API-KEY> domains { <DOMAIN>.de * <DOMAIN>.de @ } check_interval 300s versions ipv4 update_only }

@ErikSteiner
Copy link

I would like to extend the ticket and want to report that every update of the IP always generates new A-Records.
To be honest, I'm not sure if that's the intention. Sure, if I set the option “DynDns Update Only”, then of course it shouldn't create any new records, but does it make sense to add new IP addresses for existing records, if the option is unchecked? Not in my opinion, but I'm open to your opinion.

@jandelgado
Copy link
Collaborator

I think the problem occurs when Caddy is restarted and the IP changed between starts of Caddy. In order to update the A record, this lib uses the identifier (ID field) that is provided by the IONOS API, when the record gets created. As long as Caddy is running and we know the ID, we can update the record using the ID. But once Caddy is restarted, the ID is gone and a new record will be created. I'll have a deeper look on the weekend ...

@Aergernis
Copy link
Author

If you need some help with testing, i can force a ip change with my setup.

@Aergernis
Copy link
Author

Just noticed that the records are also added when the Gateway changes in a Multi-WAN setup, even when caddy is not restarting

@jandelgado
Copy link
Collaborator

Yes, I found a few issues in handling updates and deletes when no ID is provided. I did a major rewrite of the lib. @Aergernis , it would be great if you could test it with your setup. Build a custom caddy version with:

xcaddy build --with github.com/libdns/ionos=github.com/libdns/ionos@search_records_when_id_is_not_provided 
             --with github.com/caddy-dns/ionos

That should use my latest development version of libdns-ionos. Let me know if this fixes the problem, thanks.

@Aergernis
Copy link
Author

since i'm running caddy on my opnsense and i don't kow how to build it from source there, i'll setup e test machine and will try it with it

@ErikSteiner
Copy link

My problem is, that I use Caddy as a plugin of OPNsense. The plugin uses somehow the upstream version of this Caddy repository. If the changes are related to files, that can also be found on OPNsense, I will build it myself and change the specific files.

@Aergernis
Copy link
Author

after some fiddling with FreeBSD i got xcaddy to work and could build caddy.

DNS records are now updating correctly when IP changes. Great Job 😍

@jandelgado
Copy link
Collaborator

Great, thanks for testing. I'll make an official release now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants