Created
April 5, 2019 16:04
-
-
Save droM4X/0db3edc56153804b7341f56ef5d42a93 to your computer and use it in GitHub Desktop.
letsencrypt update script for jenkins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DOMAIN="your-letsencrypt-domain.com" | |
PASSWORD="changeit123" # strings, numbers are essential, at least 8 characters | |
NOW=$(date +"%Y-%m-%d") | |
### ======================= | |
certbot renew > update-ssl-$NOW.log 2>&1 | |
cd /etc/letsencrypt/live/$DOMAIN | |
openssl pkcs12 -inkey privkey.pem -in cert.pem -export -out keys.pkcs12 -passout pass:$PASSWORD > update-ssl-$NOW.log 2>&1 | |
rm -f /var/lib/jenkins/jenkins.jks | |
keytool -importkeystore -srckeystore keys.pkcs12 -srcstorepass $PASSWORD -srcstoretype pkcs12 -destkeystore /var/lib/jenkins/jenkins.jks -deststorepass $PASSWORD -destkeypass $PASSWORD > update-ssl-$NOW.log 2>&1 | |
systemctl restart jenkins |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment