Skip to content

Instantly share code, notes, and snippets.

@TehPeGaSuS
Last active July 19, 2023 10:38
Show Gist options
  • Save TehPeGaSuS/557d7a2672580a2254eddb9273b09109 to your computer and use it in GitHub Desktop.
Save TehPeGaSuS/557d7a2672580a2254eddb9273b09109 to your computer and use it in GitHub Desktop.
Certificate renewal automation for Ergo IRCd
#!/usr/bin/env sh
# What's your irc subdomain?
ergoDomain=irc.domain.tld
# What is the shell user running the ircd?
ergoUser=ircd
# What is the shell group of the user running the ircd?
# Usually it's the same as the above `user` value
ergoGroup=ircd
# Path to the ircd tls folder
ergoTLS=/home/ircd/ergo
# 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
*/"$ergoDomain")
cp -f -- "$RENEWED_LINEAGE"/fullchain.pem "$RENEWED_LINEAGE"/privkey.pem "$ergoTLS" &&
chown -- "$ergoUser":"$ergoGroup" "$ergoTLS"/fullchain.pem "$ergoTLS"/privkey.pem &&
/usr/bin/systemctl reload ergo.service
esac
@TehPeGaSuS
Copy link
Author

TehPeGaSuS commented Jul 19, 2023

How to use?

  • Create a folder named scripts inside /etc/letsencrypt where we will put all the files for automation with Let's Encrypt with:
    mkdir -p /etc/letsencrypt/scripts
  • Copy this file to the /etc/letsencrypt/scripts folder with:
    wget https://gist.github.com/PeGaSuS-Coder/557d7a2672580a2254eddb9273b09109/raw/587d15b8556d5f323febb11aa8106abcbdcb858a/ergo.sh -O /etc/letsencrypt/scripts/ergo.sh
  • Make the file executable with:
    chmod +x /etc/letsencrypt/scripts/ergo.sh
  • Request/renew yout certificate with:
    certbot -d ergo.domain.tld --deploy-hook /etc/letsencrypt/scripts/ergo.sh
  • ENJOY!

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