roskeys / openvpn-docker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Openvpn Docker

To build from scratch:

Using docker compose. Before start, create a .env file with your public ip address:

HOST_ADDR=10.12.13.14

Or simply use the command below:

echo "HOST_ADDR=$(curl -s https://api.ipify.org)" > .env

Then build the image

docker-compose build

To build using docker command:

docker build . -t openvpn

Start the docker after building

Using docker compose:

docker-compose up -d

Start using docker command:

docker run -it -d --cap-add=NET_ADMIN -p 1194:1194/udp -p 8080:8080/tcp -e HOST_ADDR=$(curl -s https://api.ipify.org) -v $PWD/ovpnfiles:/openvpn/data --name openvpn openvpn

Note:

By default, the docker image will generate one clinet, the ovpn file can be download using command, the ovpn file can be found in the reflected directory ovpnfiles/ on the host machine

docker exec -d openvpn wget -O /openvpn/data/client.ovpn localhost:8080

To generate more client and generate more client files, use the command below first and then use the command above to download the new ovpn file.

docker exec -d openvpn ./genclient.sh

Modified from repository dockovpn

About

License:GNU General Public License v2.0


Languages

Language:Shell 63.2%Language:Makefile 29.1%Language:Dockerfile 7.6%