Forked from Chaz6/renew-letsencrypt-unifi.bash
Last active
February 22, 2017 03:21
-
-
Save erikankrom/5186d6e5f2da3343592759c4d04a59fb to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
NAME="unifi.example.com" | |
/usr/bin/letsencrypt renew | |
if test $(find /etc/letsencrypt/live/$NAME/cert.pem -mmin -60) | |
then | |
/bin/systemctl stop unifi.service | |
/usr/bin/openssl pkcs12 -export -inkey /etc/letsencrypt/live/$NAME/privkey.pem -in /etc/letsencrypt/live/$NAME/fullchain.pem -out /tmp/$NAME.p12 -name ubnt -password pass:temppass | |
/bin/keytool -importkeystore -deststorepass aircontrolenterprise -destkeypass aircontrolenterprise -destkeystore /opt/UniFi/data/keystore -srckeystore /tmp/$NAME.p12 -srcstoretype PKCS12 -srcstorepass temppass -alias ubnt -noprompt | |
/bin/rm -f /tmp/$NAME.p12 | |
/bin/systemctl start unifi.service | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment