Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

Using Let's Encrypt with openHAB

You can use a FREE certificate from [Let's Encrypt] ( to secure your [openHAB] ( installation.

This quick information page is based on detail from

To start, get the Let's Encrypt client as shown here I checked it out into /root/letsencrypt.

Pick a password for your keystore. Use the commandline in step 9 of [jpmen's tutorial] ( to create jetty passwords and update the jetty.xml.

In order to verify your domain, Let's Encrypt will connect to your computer on port 443, using the name you specified. You need to make sure all your networking is in place so that this will be possible. You'll need to stop openHAB so that the Let's Encrypt client can listen for that connection.

The script below gets a certificate for, creates the pcks12 keystore with password xxxsecret, builds the java keystore from it, and puts it in the right place (on my system). Once this works once for you, you can run it monthly in a cron to keep things up to date.

Please read the script carefully, understand what it's doing, and make appropriate modifications.

cd /root/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 /opt/openhab/etc/keystore
service openhab start

This isn't going to be a perfect configuration for you out of the box, but it should get you started. Please let me know how it goes!




This comment has been minimized.

Copy link

lionelbeard commented Feb 3, 2016

Thanks for your tuto, it works well on my setup. So cool to have a real certificate :-)
I have just to also update keyPassword (with same password as keystore) in jetty.xml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.