Skip to content

Instantly share code, notes, and snippets.

@NOX73
Last active May 10, 2018 06:49
Show Gist options
  • Select an option

  • Save NOX73/d0ed47682e21ec37ed6a044107e57415 to your computer and use it in GitHub Desktop.

Select an option

Save NOX73/d0ed47682e21ec37ed6a044107e57415 to your computer and use it in GitHub Desktop.
CoreOS OpenVPN Docker
docker run -d --volumes-from ovpn-data --restart always --name vpn -p 1194:1194/udp --cap-add=NET_ADMIN kylemanna/openvpn
[Unit]
Description=OpenVPN Server
After=docker.service
[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/docker run --volumes-from ovpn-data --rm -p 1194:1194/udp --cap-add=NET_ADMIN kylemanna/openvpn
#Original: https://www.digitalocean.com/community/tutorials/how-to-run-openvpn-in-a-docker-container-on-ubuntu-14-04?utm_source=githubreadme
OVPN_DATA="ovpn-data"
SERVER=vpn.example.com:1194
#Container that will hold the configuration files and certificates
docker run --name $OVPN_DATA -v /etc/openvpn busybox
#Generate the EasyRSA PKI certificate authority
docker run --volumes-from $OVPN_DATA --rm kylemanna/openvpn ovpn_genconfig -u udp://$SERVER
docker run --volumes-from $OVPN_DATA --rm -it kylemanna/openvpn ovpn_initpki
#Create the client certificate:
#Be sure to replace CLIENTNAME as appropriate
#Download ovpn file to a client node
docker run --volumes-from $OVPN_DATA --rm -it kylemanna/openvpn easyrsa build-client-full CLIENTNAME nopass
docker run --volumes-from $OVPN_DATA --rm kylemanna/openvpn ovpn_getclient CLIENTNAME > CLIENTNAME.ovpn
#Load ~/openvpn.service
fleetctl load openvpn.service
fleetctl start openvpn.service
fleetctl status openvpn.service
fleetctl journal -f openvpn.service
sudo apt install network-manager-openvpn-gnome
# 1. Network Manager Menu
# 2. Add
# 3. Improt a saved VPN configuration...
# 4. Select an opvn file
# 5. VPN Tab -> Advanced -> TLS Authentication -> Key Direction = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment