Script for converting LetsEncrypt cert for use with Duplicati

The following script can be used check if a LetEncrypt cert has been updated, and convert it if it to the format that Duplicati uses if it has. Make sure to change “certname” to match the certificate you received from Let’s Encrypt.


lastcheck=$(cat /etc/letsencrypt/renewal/lastcheck2)
currentcheck=$(md5sum /etc/letsencrypt/live//privkey.pem | cut -d’ ’ -f1)

if [ “$lastcheck” != “$currentcheck” ]
#Certificate has been updated
echo Certificate has been updated
#Code for creating full certificate for Duplicati
sudo openssl pkcs12 -export -out ~/certificate.pfx
-inkey /etc/letsencrypt/live/certname/privkey.pem
-in /etc/letsencrypt/live/certname/cert.pem
#echo no update
echo $currentcheck > /etc/letsencrypt/renewal/lastcheck2

1 Like