echo "============================="
echo "  letsencrypt check: $(date)"
echo "============================="
certbot certonly --webroot -w /usr/share/nginx/html --email $certificate_email --text --non-interactive --agree-tos \
--cert-name $domain_params

# Environment variables are set in the letsencrypt/Dockerfile
# key_pem_file: file privkey.pem generated by certbot
# cert_pem_file: file fullchain.pem generated by certbot
# pfx_store_file: file t-key-cert.pfx referenced by wonnode tomcat and activemq 
# jks_store_file: file t-keystore.jks referenced by wonnode tomact and activemq

# create pfx key store
echo create pfx key store: $pfx_store_file
openssl pkcs12 -export -out $pfx_store_file -passout pass:$key_store_password -inkey $key_pem_file -in $cert_pem_file

# create java key store
echo create java key store: $jks_store_file
keytool -importkeystore -srckeystore $pfx_store_file -srcstoretype pkcs12 -destkeystore $jks_store_file \
-deststoretype JKS -srcstorepass $key_store_password -deststorepass $key_store_password -noprompt
echo "============================="
echo "  letsencrypt check: $(date)"
echo "============================="
certbot certonly --webroot -w /usr/share/nginx/html --email $certificate_email --text --non-interactive --agree-tos \
--cert-name $domain_params

# Environment variables are set in the letsencrypt/Dockerfile
# key_pem_file: file privkey.pem generated by certbot
# cert_pem_file: file fullchain.pem generated by certbot
# pfx_store_file: file t-key-cert.pfx referenced by wonnode tomcat and activemq 
# jks_store_file: file t-keystore.jks referenced by wonnode tomact and activemq

# create pfx key store
echo create pfx key store: $pfx_store_file
openssl pkcs12 -export -out $pfx_store_file -passout pass:$KEY_STORE_PASSWORD -inkey $key_pem_file -in $cert_pem_file

# create java key store
echo create java key store: $jks_store_file
keytool -importkeystore -srckeystore $pfx_store_file -srcstoretype pkcs12 -destkeystore $jks_store_file \
-deststoretype JKS -srcstorepass $KEY_STORE_PASSWORD -deststorepass $KEY_STORE_PASSWORD -noprompt
Fix password injection for letsencrypt password renewal
Fix password injection for letsencrypt password renewal
