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

Add ability to update additional A records. #3

Closed
MagnuM2K opened this issue Feb 23, 2021 · 9 comments
Closed

Add ability to update additional A records. #3

MagnuM2K opened this issue Feb 23, 2021 · 9 comments
Labels
enhancement New feature or request

Comments

@MagnuM2K
Copy link

MagnuM2K commented Feb 23, 2021

Below is possible example..
Ideally, you can point to the primary domain with a CNAME, but you usually have the default root domain and then www.

{
    dynamic_dns {
        domain example.com
        record_list www,@,sub
	provider gandi {env.GANDI_API_TOKEN}
	check_interval 5m
	}
}
@mholt
Copy link
Owner

mholt commented Feb 23, 2021

Ah yeah, this is on my list... need to revisit this repo again soon.

@mholt
Copy link
Owner

mholt commented Feb 27, 2021

Okay, done in aa9c816! Hope it works. 😆

@mholt mholt closed this as completed Feb 27, 2021
@mholt mholt added the enhancement New feature or request label Feb 27, 2021
@MagnuM2K
Copy link
Author

MagnuM2K commented Mar 1, 2021

This is great!!
Just tested and it worked.. But..

It created duplicate A records for both @ and www.

How I tested, I kept existing A records, but changed the IP.
Stopped Caddy/container.. Rebuilt container.. Just to make sure it was grabbing new dynamic_dns code.
Checked records on Gandi and saw that duplicate A records were in table/list.

If you need additional info or logs, let me know.

Thanks

@mholt
Copy link
Owner

mholt commented Mar 1, 2021

@MagnuM2K What is your config?

@MagnuM2K
Copy link
Author

MagnuM2K commented Mar 1, 2021

Here it is.. There is more than this and obviously site.com is not my domain.. but I only included the Global options. If you need the full config.. I'll post it, if needed.

{
        dynamic_dns {
                provider gandi <APIKEY>
                domains {
                        site.com @ www
                }
                check_interval 5m
        }
        debug
        acme_dns gandi <APIKEY>
        cert_issuer zerossl
        cert_issuer acme
        email webmaster@site.com
}

@mholt
Copy link
Owner

mholt commented Mar 1, 2021

@MagnuM2K Thanks -- I tried it with Cloudflare since I don't have a gandi account. I am unable to reproduce the behavior: existing A records are replaced with the new values, instead of duplicating them.

I would ask the maintainer of the gandi implementation for assistance: https://github.com/libdns/gandi

@MagnuM2K
Copy link
Author

MagnuM2K commented Mar 1, 2021

Ok. This is weird. I tried it again with the latest caddy commit, just in case I was missing some piece of code.

Then before I stopped/rebuilt/started container. I updated DNS records to a TTL 600..

Then when I started container and checked DNS records.
The 2 original A records (@, www) that I changed to 600 TTL were updated to 300.
But 2 new A records, matching the @ and www that I wanted to update were created with a 300 TTL.

In fact I think you are right, I was looking at gandi and libdns go code and was thinking that maybe the issue is with gandi module not invoking the Record.Setter code and maybe using Record.Appender?? (I'm not an expert.. so don't take what I'm saying as fact).

@mholt
Copy link
Owner

mholt commented Mar 1, 2021

The TTL of 300 comes from check_interval, since it makes sense that the record shouldn't be cached longer than the possibility of the value changing.

This module uses SetRecords(), so if there is a bug or difference with how gandi is handling that, it could theoretically result in duplicate records.

@tiagosimao
Copy link

Hi there.

Bumped into the same "bug" in the Gandi libdns, got no feedback so developed a different provider.

Just leaving this info here for future reference. Cheers.

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

No branches or pull requests

3 participants