Renew Certificate for web access of openhab4 running in docker at a Synology NAS

  • Platform information:
    • Hardware: Synology NAS intel CPU
    • OS: Linux (Synology DSM 6) in docker
    • Java Runtime Environment: ?
    • openHAB version: 4
  • Issue of the topic:

Hello Community,

I’m was running a quite large openhab 1 system for more than 10 years.
Last December I migrated to openhab4 with a lot of blood, sweat and tears :wink:
Most is running. As the last step I installed the certificate exported from the Synology NAS to have https access to the wedbsite. It workted fine until I had to renew it.

To install, the first time, I run these steps at the NAS:

docker cp /root/cert/cert.pem openhab4:/openhab/userdata/etc/cert.pem
docker cp /root/cert/privkey.pem openhab4:/openhab/userdata/etc/privkey.pem
docker cp /root/cert/chain.pem openhab4:/openhab/userdata/etc/chain.pem

and then in openhab :

cat cert.pem chain.pem > fullchain.pem
openssl x509 -in fullchain.pem -text -noout
keytool -import -alias openhab-cert -keystore keystore -file cert.pem
keytool -import -trustcacerts -alias openhab-chain -keystore keystore -file chain.pem
openssl pkcs12 -export -in cert.pem -inkey privkey.pem -certfile chain.pem -out openhab.p12 -name openhab
keytool -importkeystore -srckeystore openhab.p12 -srcstoretype PKCS12 -destkeystore keystore -deststoretype JKS

Now I copied the new pem’s and tried to run the same steps.
But now I have to enter a password to the keystore in command :

keytool -import -alias openhab-cert -keystore keystore -file cert.pem

I can’t remember that I set a password at the first time :frowning:

How can I get access to the “old” keystore to steup a new certificate?

Thanks in advance,

Ralf.

Did you try “openhab” as the password?

If you didn’t change the password, that’s the default password.

I just tested with the following command.

docker exec -it openhab keytool -v -list -keystore userdata/etc/keystore

I’ve never messed with the default keystore.

If that doesn’t work, you can copy over the keystore that ships with openHAB and then “openhab” should work as the password.

docker exec -it openhab cp dist/userdata/etc/keystore useradata/etc/keystore

Hi Rich,

What a quick, concise, and effective answer.
I had to copy the distribution keystore, though. Everything’s fine now!
Thank you!