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

ACME renewal logic is wrong #259

Open
ecton opened this issue Jul 17, 2022 · 1 comment
Open

ACME renewal logic is wrong #259

ecton opened this issue Jul 17, 2022 · 1 comment
Labels
bug Something isn't working networking Issues relating to either the networked server or client
Milestone

Comments

@ecton
Copy link
Member

ecton commented Jul 17, 2022

I received an alert from LetsEncrypt one of the servers that's running ACME issued through BonsiaDb hasn't renewed its certificate. Last night, I ssh'ed in and updated the server and rebooted it, figuring that would trigger the renewal logic for sure.

This morning, I noticed it still hadn't updated. I tracked it down to the use of a helper function from the acme library. I assumed it did something a little different than what it does -- it returns half the duration remaining on the certificate.

The way the loop is currently written, the err_cnt parameter is never incremented, which means this function will always return half the remaining time on the certificate -- not the duration until the halfway point of the certificate's lifetime. That's where my misunderstanding came from.

We should move the renewal logic from being completely stateless to tracking the next renewal timestamp on the TlsCertificate entity. We should keep track of the renewal attempts as well, to help with debugging certificate issuance problems.

@ecton ecton added bug Something isn't working networking Issues relating to either the networked server or client labels Jul 17, 2022
@ecton ecton added this to the v1.0 milestone Jul 17, 2022
@ecton
Copy link
Member Author

ecton commented Jul 17, 2022

On second thought, the scheduling of this could be a good job service (#78) function. Regardless, the logic should be fixed in the loop to make sure we actually try renewing starting 2 weeks out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working networking Issues relating to either the networked server or client
Projects
None yet
Development

No branches or pull requests

1 participant