Last active
July 31, 2018 09:29
-
-
Save Siot/9248473 to your computer and use it in GitHub Desktop.
.ovpn creator script
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 | |
ip="1.2.3.4" | |
port="1194" | |
proto="udp" | |
############################ | |
client=$1 | |
ca="ca.crt" | |
cert=$client".crt" | |
key=$client".key" | |
tlsauth="ta.key" | |
ovpndest=$client".ovpn" | |
cat > $ovpndest << EOF | |
client | |
proto $proto | |
port $port | |
remote $ip | |
dev tun | |
nobind | |
resolv-retry infinite | |
persist-key | |
persist-tun | |
ns-cert-type server | |
comp-lzo | |
verb 3 | |
key-direction 1 | |
EOF | |
echo "<ca>" >> $ovpndest | |
awk /BEGIN/,/END/ < ./$ca >> $ovpndest | |
echo "</ca>" >> $ovpndest | |
echo "<cert>" >> $ovpndest | |
awk /BEGIN/,/END/ < ./$cert >> $ovpndest | |
echo "</cert>" >> $ovpndest | |
echo "<key>" >> $ovpndest | |
awk /BEGIN/,/END/ < ./$key >> $ovpndest | |
echo "</key>" >> $ovpndest | |
echo "<tls-auth>" >> $ovpndest | |
awk /BEGIN/,/END/ < ./$tlsauth >> $ovpndest | |
echo "</tls-auth>" >> $ovpndest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment