Last active
July 19, 2023 11:02
-
-
Save TehPeGaSuS/3f9b05c33d9488b086473efa58ea6684 to your computer and use it in GitHub Desktop.
Automate Quassel Certificate Renew with Certbot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# Shell script to manage Quassel certificates with Let's Encrypt and Certbot | |
########## | |
# Domain/subdomain of your Quassel installation | |
########## | |
qDomain=quassel.domain.tld | |
########## | |
# Quassel configdir (usually `/var/lib/quassel' when installed via apt) | |
########## | |
qDir=/var/lib/quassel | |
########## | |
# User that runs Quassel (default to `quasselcore') | |
########## | |
qUser=quasselcore | |
########## | |
# Quassel user group (default to `quassel') | |
########## | |
qGroup=quassel | |
########## | |
# Don't edit anything below unless you know exactly what you're doing. | |
# If you touch the code below and then complain the script "suddenly stopped working" I'll touch you at night. | |
########## | |
case $RENEWED_LINEAGE in | |
*/"$qDomain") | |
cp -f -- "$RENEWED_LINEAGE"/fullchain.pem "$RENEWED_LINEAGE"/privkey.pem "$qDir" && | |
chown -- "$qUser":"$qGroup" "$qDir"/fullchain.pem "$qDir"/privkey.pem && | |
printf "Quassel Certificate Renewed Successfuly\n\n" && | |
systemctl reload quasselcore.service | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Quassel Certificate Manager
Editing quasselcore.service
systemctl edit quasselcore.service
Setting up the shell script
scripts
inside/etc/letsencrypt
with:mkdir -p /etc/letsencrypt/scripts
/etc/letsencrypt/scripts
and name itquasselcert_manager.sh
chmod +x /etc/letsencrypt/scripts/quasselcert_manager.sh
certbot -d quassel.domain.tld --deploy-hook /etc/letsencrypt/scripts/quasselcert_manager.sh
NOTE: You may need to execute the command twice
NOTE
You may have to restart Quassel (I had) in order to apply the new
ExecStart
parameters (be sure to do it only AFTER the certificate issuing/renewal, otherwise Quassel will complain about missing files)To do so, just type
systemctl restart quasselcore.service
and from now on you should have no issues :D