Last active
January 14, 2019 19:01
-
-
Save chrobione/0d394c5237b6d66e262daf7e02564ca8 to your computer and use it in GitHub Desktop.
ovpn-maker.sh
This file contains hidden or 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/sh | |
## | |
## Usage: ./ovpn-writer.sh SERVER CA_CERT CLIENT_CERT CLIENT_KEY > client.ovpn | |
## Orginial gist here https://gist.github.com/trovao/18e428b5a758df24455b | |
## | |
server=${1?"The server address is required"} | |
cacert=${2?"The path to the ca certificate file is required"} | |
client_cert=${3?"The path to the client certificate file is required"} | |
client_key=${4?"The path to the client private key file is required"} | |
cat << EOF | |
client | |
dev tun | |
remote ${server} | |
resolv-retry infinite | |
nobind | |
persist-key | |
persist-tun | |
ns-cert-type server | |
verb 1 | |
keepalive 10 120 | |
port 1194 | |
proto udp | |
comp-lzo | |
remote-cert-tls server | |
<ca> | |
EOF | |
cat ${cacert} | |
cat << EOF | |
</ca> | |
<cert> | |
EOF | |
cat ${client_cert} | |
cat << EOF | |
</cert> | |
<key> | |
EOF | |
cat ${client_key} | |
cat << EOF | |
</key> | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment