Automated renewals
Before starting test that the renewal process works
/opt/letsencrypt/letsencrypt-auto renew --dry-run
Make sure the path is accessible from cron
sudo chmod go+x /etc/letsencrypt/archive
sudo chmod go+x /etc/letsencrypt/live
Make a script file
sudo nano /usr/bin/tsrefreshcerts.sh
.... containing the following commands
/opt/letsencrypt/letsencrypt-auto renew
cd /etc/letsencrypt/live/letsencrypt.tempusserva.dk
openssl pkcs12 -export -out bundle.pfx -inkey privkey.pem -in cert.pem -certfile chain.pem -password pass:TempusServaSecret
/usr/bin/tstomcatrestart.sh
Now add a job to the crontab
sudo crontab -l > tempcron
echo "0 0 1 * * /usr/bin/tsrefreshcerts.sh" >> tempcron
sudo crontab tempcron
rm tempcron
Problems with Amazon Linux?
In case the autorenewal process fails try updating the dependencies and pip
sudo /opt/eff.org/certbot/venv/bin/pip2 install cryptography zope interface
sudo /opt/eff.org/certbot/venv/bin/pip2 install --upgrade pip
sudo rsync -avz /opt/eff.org/certbot/venv/lib64/python2.7/dist-packages/ /opt/eff.org/certbot/venv/lib/python2.7/dist-packages/
Still got problems with Amazon Linux?
In case certbot cant find the root folder try and run it manually
sudo /opt/letsencrypt/letsencrypt-auto certonly
Choose the following values when prompted
2: Place files in webroot directory (webroot)
<domain>
2: Renew & replace the cert (may be subject to CA rate limits)
/usr/share/tomcat7/webapps/ROOT/
Need manual crontab install?
Steps
- sudo crontab -e
- press INSERT
- move to bottom of file
- paste this
0 0 1 * * /usr/bin/tsrefreshcerts.sh
- press ESC
- press :wq