Skip to content

Instantly share code, notes, and snippets.

@ekarisky
Created January 6, 2020 08:03
Show Gist options
  • Select an option

  • Save ekarisky/258edaaf00f70d77f532be3a35ddaebe to your computer and use it in GitHub Desktop.

Select an option

Save ekarisky/258edaaf00f70d77f532be3a35ddaebe to your computer and use it in GitHub Desktop.
Renew Lets Encrypt SSL for IPSec
#!/bin/bash
letsencrypt renew -m [EMAIL] --agree-tos
for file in /etc/ipsec.d/private/*;
do
CERTDOMAIN=`basename $file .pem`;
diff -q /etc/ipsec.d/private/${CERTDOMAIN}.pem /etc/letsencrypt/live/${CERTDOMAIN}/privkey.pem || cp -L /etc/letsencrypt/live/${CERTDOMAIN}/privkey.pem /etc/ipsec.d/private/${CERTDOMAIN}.pem
diff -q /etc/letsencrypt/live/${CERTDOMAIN}/cert.pem /etc/ipsec.d/certs/${CERTDOMAIN}.pem || cp -L /etc/letsencrypt/live/${CERTDOMAIN}/cert.pem /etc/ipsec.d/certs/${CERTDOMAIN}.pem
done
ipsec restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment