-
-
Save acidtib/80c4983925b81f548f17a54d83d569bd to your computer and use it in GitHub Desktop.
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 | |
# | |
# Blog post @ https://blog.kylemanna.com/sharing/gogo-inflight-wireless-with-openvpn/ | |
# | |
# Bail on errors | |
set -e | |
SERVER_IP=$(host myip.opendns.com. resolver1.opendns.com | awk '/has address/ { print $4 }') | |
OVPN_DATA="ovpn-data" | |
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" | |
CLIENTd=client1 | |
echo "[*] Generating client certificate for $CLIENTd" | |
docker run -v $OVPN_DATA:/etc/openvpn --rm kylemanna/openvpn easyrsa build-client-full $CLIENTd nopass | |
docker run -v $OVPN_DATA:/etc/openvpn --rm kylemanna/openvpn ovpn_getclient $CLIENTd > $CLIENTd.ovpn | |
echo "[*] Client certificate ready at $CLIENTd.ovpn" | |
CLIENTm=client2 | |
echo "[*] Generating client certificate for $CLIENTm" | |
docker run -v $OVPN_DATA:/etc/openvpn --rm kylemanna/openvpn easyrsa build-client-full $CLIENTm nopass | |
docker run -v $OVPN_DATA:/etc/openvpn --rm kylemanna/openvpn ovpn_getclient $CLIENTm > $CLIENTm.ovpn | |
echo "[*] Client certificate ready at $CLIENTm.ovpn" | |
cat <<EOF | |
_______________________________________ | |
< Server up and running, happy surfing > | |
--------------------------------------- | |
\ ^__^ | |
\ (oo)\_______ | |
(__)\ )\/\ | |
||----w | | |
|| || | |
EOF | |
echo "[?] Copy $CLIENTd.ovpn to your client" | |
echo "[?] Copy $CLIENTm.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