Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save christopher-baek/1adaefb71cafecb25e0e0c9306198713 to your computer and use it in GitHub Desktop.
Save christopher-baek/1adaefb71cafecb25e0e0c9306198713 to your computer and use it in GitHub Desktop.
OpenVPN Management Examples

OpenVPN Management Examples

# do this as root
# install open vpn
apt-get install openvpn
# install easy rsa
apt-get install easy-rsa
# copy easy-rsa
cp -R /usr/share/easy-rsa /etc/openvpn/.
# set up
cd /etc/openvpn/easy-rsa
ln -s openssl-1.0.0.cnf openssl.cnf
. ./vars
./clean-all
cd /etc/openvpn/easy-rsa
./build-ca
cd /etc/openvpn/easy-rsa
./build-key-server ${VPN_NAME}
cd /etc/openvpn/easy-rsa
for CLIENT in ${CLIENTS[@]}
do
./build-key ${CLIENT}
done
cd /etc/openvpn/easy-rsa
./build-dh
cd /etc/openvpn/easy-rsa/keys
cp ca.crt ca.key dh2048.pem ${SERVER}.crt ${SERVER}.key /etc/openvpn
for CLIENT in ${CLIENTS[@]}
do
cp ${CLIENT}.crt ${CLIENT}.key /etc/openvpn
done
cp /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz /etc/openvpn
cd /etc/openvpn
gunzip server.conf.gz
# Update this example file:
# /usr/share/doc/openvpn/examples/sample-config-flies/client.conf
# And send with keys
# revoke
cd /etc/openvpn/easy-rsa
. ./vars
./revoke-full ${CLIENT}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment