Skip to content

Instantly share code, notes, and snippets.

@dwettstein
Forked from xkr47/letsencrypt-jetty.sh
Last active March 27, 2018 16:54
Show Gist options
  • Save dwettstein/b6e5326e87550a30ea5c104f95436793 to your computer and use it in GitHub Desktop.
Save dwettstein/b6e5326e87550a30ea5c104f95436793 to your computer and use it in GitHub Desktop.
How to use Letsencrypt certificate & private key with Jetty
# input: fullchain.pem and privkey.pem as generated by the "letsencrypt-auto" script when run with
# the "auth" aka "certonly" subcommand
# convert certificate chain + private key to the PKCS#12 file format
openssl pkcs12 -export -out keystore.pkcs12 -in fullchain.pem -inkey privkey.pem -password pass:your_password
# convert PKCS#12 file into Java keystore format
keytool -importkeystore -srckeystore keystore.pkcs12 -srcstoretype PKCS12 -destkeystore keystore.jks -srcstorepass your_password -deststorepass your_password -noprompt
# don't need the PKCS#12 file anymore
rm keystore.pkcs12
# Now use "keystore.jks" as keystore in jetty with the keystore password you specfied when you ran
# the "keytool" command
# Crontab for LetsEncrypt and Jetty:
# 30 2 * * 1 letsencrypt renew >> /var/log/le-renew.log
# 45 2 * * 1 cd /etc/letsencrypt/live/your_server_hostname/ && (sh letsencrypt-jetty.sh >> /var/log/le-renew.log)
@dwettstein
Copy link
Author

dwettstein commented Jan 19, 2018

Create a self-signed certificate valid for 1 year:

openssl req -x509 -newkey rsa:2048 -keyout privkey.pem -out fullchain.pem -days 365 -nodes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment