Skip to content

Instantly share code, notes, and snippets.

View plambrechtsen's full-sized avatar

Peter Lambrechtsen plambrechtsen

View GitHub Profile
@plambrechtsen
plambrechtsen / lesvpntoasa.sh
Created May 8, 2024 02:38
Lets Encrypt Certbot to Cisco ASA CLI
#!/bin/bash
org=org.nz
echo "Applying VPN Cert for $1"
certbot certonly --config-dir . --preferred-challenges dns --authenticator certbot-dns-standalone:dns-standalone -d $1.$org
openssl pkcs12 -export -out $1 -passout pass:password -in live/$1.$org/cert.pem -inkey live/$1.$org/privkey.pem
# If you have a newer version of openssl you may need to add -legacy to generate legacy version of the PKCS12 file needed by the ASA.
date=`date --date="$(openssl x509 -in live/$1.$org/cert.pem -enddate -noout | cut -d= -f 2)" +%Y%m%d`