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

hal5d crash can result in stale certificates #17

Open
negz opened this issue Sep 17, 2018 · 0 comments
Open

hal5d crash can result in stale certificates #17

negz opened this issue Sep 17, 2018 · 0 comments

Comments

@negz
Copy link
Contributor

negz commented Sep 17, 2018

https://github.com/negz/hal5d/blob/937aa88/internal/cert/manager.go#L449

Currently hal5d validates new certificates by:

  1. Writing them out as a temporary file in the real, production haproxy certificate dir
  2. Running haproxy -c against the real, production haproxy config
  3. Either 'committing' (by renaming the cert and reloading haproxy) or 'rolling back' (by deleting the cert) the new cert.

If hal5d crashes or is shutdown anywhere between steps 1 and 3 it will forget all about the temporary certificate file it wrote out. If the certificate was bad then all future certificates will fail validation and not be loaded, because haproxy -c validates all certificates in the directory as a whole, not just the new incoming ones. Further more, if haproxy were to restart for some reason it would be unable to start due to the invalid certificate.

hal5d should write temporary certificate files to an alternative 'staging' directory and validate against that rather than the production directory. The staging directory should either be cleaned before each validation run, or unique (i.e. a temporary directory) to each run.

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

1 participant