Skip to content

Instantly share code, notes, and snippets.

@Chaz6
Last active February 22, 2017 03:18
Show Gist options
  • Save Chaz6/e9cc0e45a7ef16fd658dcb64831eed54 to your computer and use it in GitHub Desktop.
Save Chaz6/e9cc0e45a7ef16fd658dcb64831eed54 to your computer and use it in GitHub Desktop.
#!/bin/bash
/usr/bin/certbot renew
if test $(find /etc/letsencrypt/live/unifi.example.com/cert.pem -mmin -60)
then
/bin/systemctl stop unifi.service
/usr/bin/openssl pkcs12 -export -inkey /etc/letsencrypt/live/unifi.example.com/privkey.pem -in /etc/letsencrypt/live/unifi.example.com/fullchain.pem -out /tmp/unifi.example.com.p12 -name ubnt -password pass:temppass
/bin/keytool -importkeystore -deststorepass aircontrolenterprise -destkeypass aircontrolenterprise -destkeystore /opt/UniFi/data/keystore -srckeystore /tmp/unifi.example.com.p12 -srcstoretype PKCS12 -srcstorepass temppass -alias ubnt -noprompt
/bin/rm -f /tmp/unifi.example.com.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