Hi guys,
after running some tests I noticed that on Android devices remains a certificate warning.
I tested the SSL certificate through the service provided by Qualsys (
https://www.ssllabs.com/ssltest/index.html) and I noticed that the certificate chain is incorrect because Android devices do not have some StartSSL certificates on the local store.
We must then add these certificates in the chain during the creating process of the Domoticz certificate.
Consequently, the correct procedure is the following (I've installed Domoticz in the
/domoticz folder):
- Install the openssl tools:
- Create a CSR and a private key:
Code: Select all
openssl req -newkey rsa:2048 -keyout server.key -out server.csr
During this process you will be asked for a password to encrypt the private key. Remember to preserve both the private key and the password in a safe place.
- Decrypt the private key with the password you entered previously:
Code: Select all
openssl rsa -in server.key -out server.decrypted.key
- Forward to StartSSL the CSR file to obtain a certificate
- Once StartSSL notify you that the certificate was issued go to their control panel and download the ZIP file containing the certificates for the different web servers
- Inside the zip will be a file named
ApacheServer.zip. Copy the
2_something.crt file inside (not the
1_root_bundle.crt) on your Domoticz server
- Convert the .CRT file to .PEM:
Code: Select all
openssl x509 -in 2_something.crt -out server.pem -outform PEM
- Generate DH parameters:
Code: Select all
openssl dhparam -out dhparam.pem 2048
- Download the
Root 1 - StartCom Certification Authority:
Code: Select all
wget https://www.startssl.com/certs/ca.crt
- Download the
StartCom Class 1 DV Server CA:
Code: Select all
wget https://www.startssl.com/certs/sca.server1.crt
- Stop the Domoticz server:
- Make a copy of the
server_cert.pem file within the Domoticz folder as backup
Code: Select all
sudo mv /domoticz/server_cert.pem /domoticz/server_cert.pem.selfsigned
- Create the Domoticz new certificate (the order is important!):
Code: Select all
sudo cat server.decrypted.key >> /domoticz/server_cert.pem
sudo cat server.pem >> /domoticz/server_cert.pem
sudo cat sca.server1.crt >> /domoticz/server_cert.pem
sudo cat ca.crt >> /domoticz/server_cert.pem
sudo cat dhparam.pem >> /domoticz/server_cert.pem
- Start the Domoticz server:
- Now everything should work properly, including Android devices!
- Test the certificate on
https://www.ssllabs.com/ssltest/index.html
Another useful tool is available on
https://whatsmychaincert.com: it checks the correctness of the certificate chain and if it is wrong they provides a correct one.
As said by
gertlind1 is possible that during the Domoticz updates the certificate is overwritten with the default one: backup the
server_cert.pem file in a folder outside the Domoticz installation folder.
Alternatively, but it is to be tested, we should keep the
server_cert.pem file in an external folder (for example
/home /domoticz) and change the
/etc/init.d/domoticz.sh file by adding the following line:
Code: Select all
DAEMON_ARGS="$DAEMON_ARGS -sslcert /home/domoticz/server_cert.pem"
Perhaps the process can be improved, maybe some conversions are not necessary, but it works!
