Last active
April 9, 2024 00:37
-
-
Save adamrunner/aaaef0538a07f04a04f4d416a9b00af8 to your computer and use it in GitHub Desktop.
Shell script to automate installation of new LetsEncrypt certs into OpenVPN Access Server when they have been renewed
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 | |
# this script is used to update the openvpn access server certificates after | |
# certbot renews the certificates | |
# the cron job should be like this: | |
# certbot renew --deploy-hook /usr/local/bin/update-openvpn-certs.sh | |
$DOMAIN = "YOUR_DOMAIN_NAME" | |
./sacli --key "cs.priv_key" --value_file "/etc/letsencrypt/live/$DOMAIN/privkey.pem" ConfigPut | |
./sacli --key "cs.cert" --value_file "/etc/letsencrypt/live/$DOMAIN/cert.pem" ConfigPut | |
./sacli --key "cs.ca_bundle" --value_file "/etc/letsencrypt/live/$DOMAIN/chain.pem" ConfigPut | |
# Restarts openvpn access server service | |
./sacli start | |
# test the new certs, this is optional | |
# ./sacli --ca_bundle=/etc/letsencrypt/live/$DOMAIN/chain.pem --cert=/etc/letsencrypt/live/$DOMAIN/cert.pem --priv_key=/etc/letsencrypt/live/$DOMAIN/privkey.pem TestWebCerts | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment