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

Reload TSIG secrets on Server struct #1161

Closed
Fattouche opened this issue Sep 29, 2020 · 5 comments
Closed

Reload TSIG secrets on Server struct #1161

Fattouche opened this issue Sep 29, 2020 · 5 comments

Comments

@Fattouche
Copy link
Contributor

Right now when create a new server with TSIG it follows the pattern:

server := &dns.Server{Addr: ":53", Net: "udp"}
server.TsigSecret = map[string]string{"axfr.": "so6ZGir4GPAqINNh9U5c3A=="}
go server.ListenAndServe()
dns.HandleFunc(".", handleRequest)

This is fine if the server.TsigSecret never changes, however what happens if you want to add new tsigs with zero downtime. How do you do this without causing a race condition? I want to be able to just edit the tsigSecret map while the server is serving requests. Is this possible in anyway?

Thanks!

@miekg
Copy link
Owner

miekg commented Sep 30, 2020

no this is not possible. I'm not sure if there is a performant/backwards compatible fix to make it work.

@miekg
Copy link
Owner

miekg commented Sep 30, 2020

starting/stopping a single dns instance should not impact your DNS; if it does and you require zero downtime you probably want to run on multiple machines

@Fattouche
Copy link
Contributor Author

I think if this was a syncMap instead of a regular map, this problem would go away wouldn't it? I think it pretty much just reads from the map as usual. The rolling restart may be a good option for the time being though.

@miekg
Copy link
Owner

miekg commented Oct 5, 2020 via email

@Fattouche
Copy link
Contributor Author

Yea makes sense, thanks!

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

No branches or pull requests

2 participants