Last active
January 4, 2017 14:58
-
-
Save retspen/3d531909d33fff7e25e5a0267769e512 to your computer and use it in GitHub Desktop.
Creating .ovpn with CA, Crt and Key for mobile
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 | |
# Make a certificate/private key pair using a locally generated | |
# root certificate. | |
OPENVPN_KEYS=$EASY_RSA/keys | |
IPADDR=$(ifconfig eth0 | grep 'inet addr:'| cut -d: -f2 | awk '{print $1}') | |
export EASY_RSA="${EASY_RSA:-.}" | |
#"$EASY_RSA/pkitool" --interact $* | |
"$EASY_RSA/pkitool" $* | |
CA_FILE=$(cat $OPENVPN_KEYS/ca.crt) | |
CERT_FILE=$(cat $OPENVPN_KEYS/$1.crt) | |
KEY_FILE=$(cat $OPENVPN_KEYS/$1.key) | |
cat << EOF > $OPENVPN_KEYS/$1.ovpn | |
client | |
dev tun | |
proto udp | |
remote $IPADDR 1194 | |
cipher AES-128-CBC | |
resolv-retry infinite | |
nobind | |
persist-key | |
persist-tun | |
ns-cert-type server | |
comp-lzo | |
verb 3 | |
<ca> | |
$CA_FILE | |
</ca> | |
<cert> | |
$CERT_FILE | |
</cert> | |
<key> | |
$KEY_FILE | |
</key> | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment