I actually was looking at this: https://gist.github.com/jpmens/8029383 to complete the task as I have a registered domain name and wanted to overcome the untrusted / unknown CA from the default certificates. You might find it helpful though as well. Good luck.
And this as well. directions for openssl key and cert request generation, and access direction for a free cert. Between the page this is posted too, and these two links, I was able to get everything accomplished. https://samhobbs.co.uk/2014/04/ssl-certificate-signing-cacert-raspberry-pi-ubuntu-debian
I would, however, avoid the wildcard *.fqdn that is suggested; it doesn’t work on all the platforms and browsers I’ve attempted it with, most, but not all.
Thanks, I got all the way to item 9 on your list. However, the jetty.xml looks pretty different on OpenHAB 2.0
and Google was not too helpful either. Does someone know how to adapt the jetty configuration in OpenHAB 2.0 (jetty-util-9.2.19.v20160908)
Thanks to Stratehm on an older post found here : SSL with OpenHAB2
I now have the basic Jetty setup running with a signed certificate on OH 2.1. The approach is more or less the same as above except, skip steps 4, 7, 8 & 9, you don’t overwrite the existing keystore container file you ‘delete’ the ‘mykey’ alias inside the OH keystore file then import your new one.
Instead of step 7 do these two, delete the old certificate:
I would also like to know, the documentation suggests using an nginx proxy. But using SSL on Jetty should be working as well, but I can’t seem to locate the keystore (or myKeystore as the jetty.config.xml suggests).
For those trying to replace the self-signed key and certificate in OH2.5 the steps above need a little modification. This is what has worked for me. NB. OH is designed with few security layers in place and it uses a default password “openhab” both for the keystore and the key itself. The name of the key has to be “mykey” unless you change other config files. Feel free to figure out how to change it, but do not expect much in terms of increasing the overall security. The only advantage of using a proper certificate, like LE in this case, is to avoid browser warnings and/or having to install CAs into them, while at least having browser-OH traffic encrypted. While this is useful and important part of security hygiene, it is also merely a drop in the ocean in terms of home automation security, which is still very, very poor no matter the provider nowadays. Rant end.
Apart from that I don’t understand what this is about and won’t dig gazillions of messages just to understand your question in the first place, chances are right as high as chances you implement this yourself are.
BTW in openHABian use nginx rather than to run jetty on SSL. nginx automatically uses LetsEncrypt certs when you install from the menu.
My installation Ubuntu 22.04 and OpenHab 3 with a domain name.
I solved the issue with the following way.
The principle being to replace the default keystore file (/var/lib/openhab/etc) generated by openhab for the installation and giving a certificate for openhab.org.
No need to modify jetty.xml. Assumption : you already have a LetsEncrypt certificate into /etc/letsencrypt/live/mydomain.be
First step : need to add all .pem files to a PKCS 12 archive. We do this with the OpenSSL tool with the following command.
Third Step : You can now copy the keystore at location /tmp/mydomain.be.keystore in /var/lib/openhab/etc. mv /tmp/mydomain.be.keystore /var/lib/openhab/etc/keystore
This will replace the default keystore file by the one generated from the letsencrypt certificate.
Something interesting could be to check that the new keystore file is correct with : keytool -list -v -keystore /var/lib/openhab/etc/keystore >output_filename.txt
(it will request the password = openhab)
View the Output File : nano /var/lib/openhab/etc/output_filename.txt