Created
August 13, 2024 06:59
-
-
Save aib/d4f4699e8e5c07495c5fcddc5b8ef956 to your computer and use it in GitHub Desktop.
This file contains 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 | |
CA=/etc/openvpn/keys/ca.crt | |
CERT=/etc/easy-rsa/keys/$1.crt | |
KEY=/etc/easy-rsa/keys/$1.key | |
TLS_AUTH=/etc/openvpn/keys/ta.key | |
cat client.ovpn \ | |
| sed -e '/<ca><\/ca>/{' -e 'i <ca>' -e "r $CA" -e 'a </ca>' -e 'd' -e '}' \ | |
| sed -e '/<key><\/key>/{' -e 'i <key>' -e "r $KEY" -e 'a </key>' -e 'd' -e '}' \ | |
| sed -e '/<cert><\/cert>/{' -e 'i <cert>' -e "r $CERT" -e 'a </cert>' -e 'd' -e '}' \ | |
| sed -e '/<tls-auth><\/tls-auth>/{' -e 'i <tls-auth>' -e "r $TLS_AUTH" -e 'a </tls-auth>' -e 'd' -e '}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment