Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# Blog post @
# Bail on errors
set -e
SERVER_IP=$(host | awk '/has address/ { print $4 }')
echo "[*] Generating server config for $SERVER_IP"
docker run -v $OVPN_DATA:/etc/openvpn --rm kylemanna/openvpn ovpn_genconfig -u udp://$SERVER_IP:3128
echo "[+] Generated server config for $SERVER_IP"
echo "[*] Initialzing PKI (insecurely) for the truely lazy"
docker run -v $OVPN_DATA:/etc/openvpn --rm -e "EASYRSA_BATCH=1" kylemanna/openvpn ovpn_initpki nopass
echo "[+] Initialized PKI magic"
echo "[*] OpenVPN server starting up"
docker run -v $OVPN_DATA:/etc/openvpn -d -p 3128:1194/udp --cap-add=NET_ADMIN kylemanna/openvpn
echo "[+] OpenVPN server up and running"
echo "[*] Generating client certificate for $CLIENT"
docker run -v $OVPN_DATA:/etc/openvpn --rm kylemanna/openvpn easyrsa build-client-full $CLIENT nopass
docker run -v $OVPN_DATA:/etc/openvpn --rm kylemanna/openvpn ovpn_getclient $CLIENT > $CLIENT.ovpn
echo "[*] Client certificate ready at $CLIENT.ovpn"
cat <<EOF
< Server up and running, happy surfing >
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
echo "[?] Copy $CLIENT.ovpn to your client"
echo "[x] Exiting"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.