Wegens tijdgebrek doe ik dit nog steeds handmatig. Want dat kost op zichzelf helemaal niet zo veel tijd en tot nu toe ben ik er pas achter gekomen toen de certificaten verlopen waren.
Eind september zal het weer moeten (uit mijn hoofd), ik zal dan eens kijken of het mogelijk is.
Bijna einde van het jaar... en ik heb het werkend gekregen via een Docker Container.
Hieronder mijn releas hoe ik het gedaan heb:
To create wildcard certificates for your Synology system for provider TRANS-IP, you can use the following code
SSH into Synology
create a folder called
/var/docker-data/Certificates
create a file in
/etc/letsencrypt/
called
domains.conf
per line fill in an owned domain like
Example.com *.example.com
for 1 certificate
example.com *.example.com
smtp.example.com
imap.example.com pop.example.com
for 3 certificate
create a file in
/etc/letsencrypt/
called
api.key
create an API in your TRANS-IP controle panel
save this API key and now we need to modify it to an RSA key
download openssl
execute
openssl rsa -in transip_original.key -out api.key
(and save to
/etc/letsencrypt/
)
install docker on your Synology
Install docker packages adferrand/letsencrypt-dns
to create your own settings using the above docker image you can start the docker in SSH with the following line:
docker run \
--name YOUR OWN NAME \
--volume /etc/letsencrypt/domains.conf:/etc/letsencrypt/domains.conf \
--volume /etc/letsencrypt/api.key:/etc/letsencrypt/api.key \
--volume /var/docker-data/Certificates:/etc/letsencrypt \
--env 'LETSENCRYPT_USER_MAIL=YOUR@Email.address' \
--env 'LEXICON_PROVIDER=transip' \
--env 'LEXICON_TRANSIP_USERNAME=YOUR_TRANSIP_USERNAME' \
--env 'LEXICON_TRANSIP_AUTH_API_KEY=/etc/letsencrypt/api.key' \
--env 'LEXICON_TRANSIP_TTL=1' \
--env 'LEXICON_SLEEP_TIME=3720' \
--env 'LETSENCRYPT_STAGING=false' \
adferrand/letsencrypt-dns
When the certificates are created you can manually install them into the Synology interface (first time).
If you let the docker run, it will 30 days before the certificate will expire create new certificates.
With the following code you can copy these to the correct location
#!/bin/bash
echo "Starting script at : $(date)"
echo "Checking if certificates needs to be changed"
file1="/var/docker-data/Certificates/live/YOURDOMAIN/cert.pem"
file2="/usr/syno/etc/certificate/ReverseProxy/LOCATION_OF_YOUR_CERTIFICATE/cert.pem"
dirdate=$(date +"%Y-%m-%d")
if diff "$file1" "$file2" >/dev/null ; then
echo "Nothing has changed!!..."
else
cp /var/docker-data/Certificates/live/YOURDOMAIN/* /usr/syno/etc/certificate/ReverseProxy/LOCATION_OF_YOUR_CERTIFICATE/
cp /var/docker-data/Certificates/live/YOURDOMAIN/* /usr/syno/etc/certificate/_archive/LOCATION_OF_YOUR_CERTIFICATE/
/usr/syno/sbin/synoservicectl --restart nginx
echo "Certificates has been copied and activated!"
echo "Now make backup to /volume1/YOUR_LOCATION/History/$dirdate"
mkdir /volume1/YOUR_LOCATION/History/$dirdate
cp -R /var/docker-data/Certificates/* /volume1/YOUR_LOCATION/History/$dirdate
echo "Done on the certificate part...."
fi
echo "Stopping script at : $(date)"
echo "Now returning to normal operations!!!!"
to figure out
/usr/syno/etc/certificate/_archive/LOCATION_OF_YOUR_CERTIFICATE/
check
/usr/syno/etc/certificate/_archive/INFO