Skip to content

Instantly share code, notes, and snippets.

@ntotten
Created July 29, 2017 17:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ntotten/d79edd5334c336012e34365be4243e16 to your computer and use it in GitHub Desktop.
Save ntotten/d79edd5334c336012e34365be4243e16 to your computer and use it in GitHub Desktop.
Script to renew Let's Encrypt certificate and then replace certificate on OpenVPN server
#!/bin/bash
(
DOMAIN="vpn.example.com"
set -eu
certbot renew -q
/usr/local/openvpn_as/scripts/sacli stop
/usr/local/openvpn_as/scripts/confdba -mk cs.ca_bundle -v "`cat /etc/letsencrypt/live/$DOMAIN/fullchain.pem`"
/usr/local/openvpn_as/scripts/confdba -mk cs.priv_key -v "`cat /etc/letsencrypt/live/$DOMAIN/privkey.pem`" > /dev/null
/usr/local/openvpn_as/scripts/confdba -mk cs.cert -v "`cat /etc/letsencrypt/live/$DOMAIN/cert.pem`"
/usr/local/openvpn_as/scripts/sacli start
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment