Created
July 30, 2016 18:59
-
-
Save hyper3xpl0iter/c6472a6d574909e83c4d92c1d0aad4cc to your computer and use it in GitHub Desktop.
Script to setup free SSL for OpenHAB via LetsEncrypt
This file contains hidden or 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 | |
| ############################################################################## | |
| # | |
| # Filename:openhab_letsencrypt.sh | |
| # Description: Script to setup free SSL via LetsEncrypt | |
| # Source: https://github.com/hyper3xpl0iter/helper_scripts.git | |
| # Gist: https://gist.github.com/c6472a6d574909e83c4d92c1d0aad4cc.git | |
| # Author: Andre Mattie | |
| # Email: [email protected] | |
| # GPG: B9C0 3976 3CB4 794E D66C 8F75 8AA0 8470 3533 2EDD | |
| # Date: 07/30/2016 | |
| # | |
| ############################################################################## | |
| DOMAIN=<OPENHAB.DOMAIN.COM> | |
| PASSWORD=<YOUR_PASSWORD> | |
| cd /opt/letsencrypt | |
| service openhab stop | |
| ./letsencrypt-auto certonly --renew-by-default --standalone-supported-challenges tls-sni-01 -d ${DOMAIN} | |
| openssl pkcs12 -export -password pass:${PASSWORD} -inkey /etc/letsencrypt/live/${DOMAIN}/privkey.pem -in /etc/letsencrypt/live/${DOMAIN}/fullchain.pem -out /tmp/cert.p12 | |
| keytool -importkeystore -srckeystore /tmp/cert.p12 -srcstoretype PKCS12 -destkeystore /tmp/keystore.jks -srcstorepass ${PASSWORD} -deststorepass ${PASSWORD} -noprompt | |
| rm /tmp/cert.p12 | |
| mv /tmp/keystore.jks /usr/share/openhab/etc/keystore | |
| service openhab start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment