Convert Let's Encrypt SSL certificates to a JKS keystore

For Let's Encrypt SSL certificates:

/etc/letsencrypt/live/goyun.info/fullchain.pem
/etc/letsencrypt/live/goyun.info/privkey.pem

Converting the certificates

Backup the existing key, if any:

mv /var/lib/jenkins/jenkins.jks /var/lib/jenkins/jenkins.jks.bak

Then convert to a JKS keystore. Pick a unique password.

cd /etc/letsencrypt/live/goyun.info/
openssl pkcs12 -inkey privkey.pem -in fullchain.pem -export -out keys.pkcs12
keytool -importkeystore -srckeystore keys.pkcs12 -srcstoretype pkcs12 -destkeystore /var/lib/jenkins/jenkins.jks

Comments