Script for converting LetsEncrypt cert for use with Duplicati


#1

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.

#!/bin/bash

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

if [ “$lastcheck” != “$currentcheck” ]
#Certificate has been updated
then
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
fi
#echo no update
echo $currentcheck > /etc/letsencrypt/renewal/lastcheck2
exit


Running duplicati docker container with https