-
Notifications
You must be signed in to change notification settings - Fork 27
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
[Bug?] mod_md loads an (older) static certificate in favour of a (newer) managed certificate [Apache 2.4.54 / mod_md 2.4.17] #300
Comments
This documentation section seems most relevant: https://github.com/icing/mod_md#how-to-migrate-a-https-host It suggests using The way the example is worded, you have to disable automatic restarts before the managed certificate is issued, then remove the I think I think there should be Suggestion 1: Change (fix?) 'MDRenewMode always' behavior or add 'MDRenewMode force'I expected Suggestion 2: Add MDCertificateLoadOrder settingIf the certificate install and loading logic is entirely divorced from renewal, then another option would be to leave Current behavior, load the manual cert even if a managed one is available
Optional new behavior, load a managed cert, even is a manual one is configured
|
I assumed the same as well, thanks for documenting this and suggesting some things to reduce the confusion for people like me! |
Apache 2.4.54 / mod_md 2.4.17
Is this a bug, or have I got the process wrong?
When I configure
mod_md
with aMDCertificateFile
manual certificate andMDRenewMode always
I expectedmod_md
to eventually renew the certificate and then, after a graceful restart, use that new managed certificate. However, in my testingmod_md
prefers to load the old static certificate in favour of the new certificate it just issued. This triggersmod_md
to enter an endless renewal loop.I'm attempting to perfect the technique to migrate a domain to
mod_md
without outage. To achieve this I am employ the following approach.MDCertificateFile
and also setMDRenewMode manual
mod_md
, there is no outage and now HTTP01 challenge renewals are possibleMDRenewMode always
to enable automatic renewal when requiredmod_md
issues a new certificate via an HTTP01 challengeMDMessageCmd renewed example.com
apache2 performs a graceful restartmod_md
/apache2
to load the new automatic certificate instead of the old static one, however this is not what happens, insteadmod_md
/apache2
kept loading the static certificate, then since the static certificate was due for renewal it would loop to issue another new certificate, restarting, loading the old static certificate, etc.Configurations and logs for the steps above below.
The
MDMessageCmd
handler I used is documented in #298Configuration for (1) a manual certificate with MDCertificateFile and also set MDRenewMode manual
This configuration works fine and I can then switch the DNS record over with zero outage.
Configuration for (3) set 'MDRenewMode always' to enable automatic renewal when required.
I use
MDRenewWindow 90%
here to ensure the manual certificate was due for renewal. With this setting the new 90-day certificate would then not be due for renewal for ~9 days.Logs for (4..6):
The following log entries after setting
MDRenewMode always
looks perfect,mod_md
sets up a challenge, issues the certificate, signals a graceful restart, then after a restart we seeMDMessageCmd installed example.com
which suggests the newly issued managed certificate is installed. Themod_md
events we see are exactly what you'd expect:However... when I check the endpoint with
curl
I observe the older manual certificate is still the active one, and when I checkmd-status
is lists the old manual certificate and is busy renewing it again. Checking/etc/apache2/md/domains/example.com
the automatically issued certificate is there inpubcert.pem
andprivkey.pem
but it is not the one being loaded byapache2
.Logs where (6) goes pear-shaped and
mod_md
loops constantly renewing the manual certificateThereafter
mod_md
enters a loop of the following events....
Note that I have retries set to
MDRetryDelay 300s
that avoid more than 5 attempts/hour hitting the Let's Encrypt rate limits. However that didn't work here asmod_md
started a fresh renewal job after each restart and so triggered with rate limit within 3.5 minutes.Note that on these repeat issuing of the certificate there is no
MDMessageCmd challenge-setup:http-01:example.com example.com
as there was for the first renewal. I guess there challenge is the same and already there?Raw logs:
The text was updated successfully, but these errors were encountered: