I'm trying to work out how to use the certificates I got from let's encrypt with my standalone play application. I turned off my server and ran certbot which generated 4 files (cert.pem,chain.pem,fullchain.pem,privatekey.pem) but I don't know how to get my play application to use these.
I'm using version 2.5.4 of the play framework.
Play uses Java key stores to configure SSL certificates and keys.
So you have to do this:
1. Cert and Key to a PKCS12 file
openssl pkcs12 -export -in server.crt -inkey server.key \
-out server.p12 -name [some-alias] \
-CAfile ca.crt -caname root
2. Convert PKCS12 to Keystore
keytool -importkeystore \
-deststorepass [changeit] -destkeypass [changeit] -destkeystore server.keystore \
-srckeystore server.p12 -srcstoretype PKCS12 -srcstorepass some-password \
-alias [some-alias]
3. Configure Play to use the keystore
/path/to/your/app/app_name_script -Dhttps.port=443 -Dplay.server.https.keyStore.path=[keyStore-location] -Dplay.server.https.keyStore.password=[keyStore-password]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With