Skip to content

Instantly share code, notes, and snippets.

@bartclone
Created September 15, 2021 07:56
Show Gist options
  • Save bartclone/d4ad3994511577454853540aa487dfea to your computer and use it in GitHub Desktop.
Save bartclone/d4ad3994511577454853540aa487dfea to your computer and use it in GitHub Desktop.
Copy LE certificate/key to Cockpit
# SCRAP/UNFINISHED
#Source:
#Comment on https://crosstalksolutions.com/definitive-guide-to-hosted-unifi-2021/
#By Binky
#Using info here: https://ryan.lovelett.me/posts/letsencrypt-cockpit/
#I created the file: /etc/letsencrypt/renewal-hooks/post/001-restart-cockpit.sh
#With the provided contents, changing ‘$FQDN’ with my FQDN for the instance and removing the ‘chown’ statement:
# ——————————————————————————–
#!/usr/bin/env bash
echo “SSL certificates renewed”
cp /etc/letsencrypt/live/$FQDN/fullchain.pem /etc/cockpit/ws-certs.d/$FQDN.crt
cp /etc/letsencrypt/live/$FQDN/privkey.pem /etc/cockpit/ws-certs.d/$FQDN.key
echo “Restarting Cockpit”
systemctl restart cockpit
——————————————————————————–
Then ran the script (after chmod +x /etc/letsencrypt/renewal-hooks/post/001-restart-cockpit.sh) as root and Cockpit now uses my LetsEncrypt certificate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment