Skip to content

Instantly share code, notes, and snippets.

@Bachsau
Created February 28, 2023 21:15
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Certbot hooks for etckeeper; place them in /etc/letsencrypt/renewal-hooks/(pre|post)/
#!/bin/sh -eu
# Run etckeeper after certificate renewal (by Bachsau)
if command -v etckeeper >/dev/null && etckeeper unclean; then
etckeeper commit "committing updates to certificate configuration files after renewal"
fi
#!/bin/sh -eu
# Run etckeeper prior to certificate renewal (by Bachsau)
if command -v etckeeper >/dev/null && etckeeper unclean; then
etckeeper commit "saving uncommitted changes in /etc prior to certificate renewal"
fi
@Bachsau
Copy link
Author

Bachsau commented Feb 28, 2023

Note: You need to .gitignore /letsencrypt/.certbot.lock, which only exists while Certbot is running. Also /letsencrypt/archive/ and /letsencrypt/live/ if you want to keep the certs and private keys out of the repository. I'm only versioning the renewal configuration files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment