Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
{OpenVPN, Freebox, Ubuntu} Script de reformatage du fichier de configuarion
# make output file
mkdir -p $basedir
mkdir -p $vpnconfigdir
# print Gateway
sed -n 's/remote \([^ ]\+\) [0-9]\+/passerelle: \1/p' $1
# create client config file
awk '/<ca>/{exit} {print}' $1 > $vpnconfigdir/client.ovpn
# output certificate of CA
awk '/<ca>/ {flag=1;next} /<\/ca>/{flag=0} flag {print}' $1 > $vpnconfigdir/ca.crt
# output certificate of client key
awk '/<cert>/ {flag=1;next} /<\/cert>/{flag=0} flag {print}' $1 > $vpnconfigdir/client.crt
# output client key
awk '/<key>/ {flag=1;next} /<\/key>/{flag=0} flag {print}' $1 > $vpnconfigdir/client.key
# remove rights for other
chmod -R o-rwx $vpnconfigdir/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.