[__letscrypt_cert] Hooks are wrongly implemented #13
Labels
No labels
bugfix
cleanup
discussion
documentation
doing
done
feature
improvement
packaging
Stale
testing
TODO
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: ungleich-public/cdist#13
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Tangentially related to: !974 and !873
Fixing this would also fix ungleich-public/cdist-contrib#2
Description of the issues
I detected a renewal hook did not run, even though the cert itself did get renewed, upon inspection I see:
Race condition due to two renewal jobs
So there is a bit of a race condition: on the
/etc/cron.d/certbot
entry, there is a random sleep of anything between 0 to 12h, if that happens to be less than 47 minutes (about 6.53% chances), that job will renew the certificate but not apply the hook as expected.Misleading expectation of per-certificate hook
I would expect this to:
Instead (not tested) this execution would fail due to discordant arguments for the
__cron/letsencrypt-certbot
object.Conclusion
!974 and !873 are not sufficient to fix these issues, we should instead rely on per-realm/certificate configuration, using following.
I intend to implement this with a clear migration path for current installations rendering those MRs redundant by:
Using:
https://certbot.eff.org/docs/using.html?highlight=hook#pre-and-post-validation-hooks
--renew-hook
, having it work as an alias for--deploy-hook
(see below).optional
arguments:--deploy-hook
,--pre-hook
,--post-hook
${ETC_DIR}/letsencrypt/renewal-hooks/{deploy,pre,post}/${__object_id}.cdist.sh
script with the proper permissions.And contents similar to:
mentioned in issue cdist-contrib#2
mentioned in commit
b3a9c907ad
mentioned in merge request !977
mentioned in commit
bc145bbc27
I also propose deprecating
--automatic-renewals
, it makes no sense and is a maintenance nightmare. If an OS needs it (like Alpine and, from what I can tell Arch), we can enable autorenewal system-wide, which is what was happening now anyway.I don't have much experience with Alpine, can someone confirm that it does not have an in-distro mechanism for automatic renewals?
Sounds like the proper solution to me. We can even deprecate --renew-hook and remove it in the next version change of cdist.
@nico / @ander / @steven at your scale you have probably hit this, does the proposal sound good? Should I work on it?