I would like to use a script to update my domains Let’s Encrypt Certificate and export updated certificate into Home Assistant container to allow https. I have been successful in updating certificate and copying to other containers (ie. Technitium) as long as it’s password protected (to allow for export of private key), but one container (Home Assistant) requires a non password protected private key and I’m unable to automatically remove in RouterOS.
I have been using OpenSSL tool to do this manually but it is not in RouterOS and I can’t seem to find an alternative.
My setup: CHR 7.17rc3, mydomain.com
My Script to Update, Export certificate:
/certificate enable-ssl-certificate dns-name=mydomain.com
/certificate export-certificate mydomain.com export-passphrase=mypassword file-name=UpdatedCert type=pem
My commandline to remove password using OpenSSL:
OpenSSL rsa -in UpdatedCert.key -out UpdatedCertNoPass.key
My script to copy certificate to Home Assistant container:
/tool fetch mode=ftp address=mydomain src-path=UpdatedCertNoPass.key dst-path=containers/etc/UpdatedCert.pem user=myuser password=mypassword
I read that RouterOS v7 uses their own implementation for TLS. Anyone know how I could script this since the certificates are only valid for 90 days at a time?
Thanks in advance and Kind Regards.