Skip to content

Conversation

@racterub
Copy link

@racterub racterub commented Jan 24, 2026

Summary

This PR adds support for reloading TLS certificates when headscale receives a SIGHUP signal, enabling zero-downtime certificate rotation for deployments using manual TLS configuration.

Changes

  • TLS certificate reload on SIGHUP: When headscale receives SIGHUP, it now reloads TLS certificates from disk
    (in addition to existing ACL policy reload)
  • Thread-safe certificate access: Uses sync.RWMutex to protect certificate access during concurrent requests and
    reloads
  • Dynamic certificate serving: Switched from static Certificates slice to GetCertificate callback for runtime
    certificate updates

Tasks

  • have read the CONTRIBUTING.md file
  • raised a GitHub issue or discussed it on the projects chat beforehand
  • added unit tests
  • added integration tests
  • updated documentation if needed
  • updated CHANGELOG.md

Fixes #3027

Disclaimer: This PR is implemented full auto by Claude Code and reviewed by me.

@kradalby
Copy link
Collaborator

kradalby commented Feb 7, 2026

Without having had time to review, I think this seem reasonable, can you rebase it of main (there has been a lot of changes) and then I'll try to get to reviewing it?

racterub and others added 5 commits February 8, 2026 00:51
Add two integration tests to verify the certificate reload functionality:
- TestTLSCertificateReloadOnSIGHUP: verifies certificate is reloaded
  after SIGHUP by checking NotBefore timestamp changes
- TestTLSCertificateReloadClientConnectivity: verifies clients remain
  connected and can ping each other after certificate rotation

Also adds Reload() method to ControlServer interface to expose SIGHUP
signal capability to integration tests.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@racterub racterub force-pushed the feat/cert-reload-on-sighup branch from 649bdb3 to 5132ecc Compare February 7, 2026 16:52
@racterub
Copy link
Author

racterub commented Feb 7, 2026

Hey @kradalby , I just rebased main. please have a look.

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

Successfully merging this pull request may close these issues.

[Feature] Headscale TLS reload on SIGHUP

2 participants