Last active
August 28, 2017 13:49
-
-
Save Warchant/81f5447e48b2e2b500e6226acc653773 to your computer and use it in GitHub Desktop.
Start OpenVPN server using docker painlessly
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 | |
| if [ -z "$1" ]; then | |
| echo "Provide 1 argument: name of the client" | |
| exit 1 | |
| fi | |
| name=$1 | |
| docker run -v $OVPN_DATA:/etc/openvpn --rm -it kylemanna/openvpn easyrsa build-client-full $name nopass | |
| docker run -v $OVPN_DATA:/etc/openvpn --rm kylemanna/openvpn ovpn_getclient $1 > $1.ovpn |
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 | |
| export OVPN_DATA=ovpn-data | |
| export IP="PASTE SERVER IP HERE" | |
| docker volume create --name $OVPN_DATA | |
| docker run -v $OVPN_DATA:/etc/openvpn --rm kylemanna/openvpn ovpn_genconfig -u udp://$IP | |
| docker run -v $OVPN_DATA:/etc/openvpn --rm -it kylemanna/openvpn ovpn_initpki |
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 | |
| docker run -v $OVPN_DATA:/etc/openvpn -d -p 1194:1194/udp --cap-add=NET_ADMIN kylemanna/openvpn |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
First:
init.shstart.shto start containergenconfig.sh myusernameThe result is
myusername.ovpnconfig in the same folder asgenconfig.sh