SkillAgentSearch skills...

Dockovpn

πŸ” Out of the box stateless openvpn-server docker image which starts in less than 2 seconds

Install / Use

/learn @dockovpn/Dockovpn

README

<p align=center><img src="https://alekslitvinenk.github.io/docker-openvpn/assets/img/logo-s.png"></p><br> <p align="center"> <a href="https://github.com/alekslitvinenk/docker-openvpn/blob/master/README.md">[English]</a> <a href="https://github.com/alekslitvinenk/docker-openvpn/blob/master/docs/README_RU.md">[Русский]</a> <a href="https://github.com/alekslitvinenk/docker-openvpn/blob/master/docs/README_CN.md">[δΈ­ε›½δΊΊ]</a> <br>

Build Version Build Status Tests Status Build Time Docker Pulls Gitter chat GitHub

πŸ”DockOvpn

<p align=center><a href="https://techround.co.uk/vpns/11-dockovpn-solutions/" target="_blank"><img src="https://alekslitvinenk.github.io/docker-openvpn/assets/img/VPN53-Badge-300x300.png" width="198" height="198"></a></p><br>

Out of the box stateless VPN server docker image which starts in just a few seconds and doesn't require persistent storage. To get it running, just copy & paste the snippet below and follow instructions in your terminal:

docker run -it --rm --cap-add=NET_ADMIN \
-p 1194:1194/udp -p 80:8080/tcp \
--name dockovpn alekslitvinenk/openvpn

To get more detailed information, go to Quick Start tutorial or watch video.

Supporting Dockovpn

Dockovpn is a team of cybersecurity experts developing leading edge projects in Networking, VPN, DevOPS and SecOPS domains. Project is supported entirely by volonteers. If you'd like to help support the future of the project, please consider:

Content

Resources
Container properties
Video Guide
Quick Start
Persisting configuration
Alternative way. Run with docker-compose
Other resources

Resources

Real-time Chat

Slack (registration)

Website

https://dockovpn.io

Social media

| Name | URL | | :--: | :-----: | | LinkedIn | https://www.linkedin.com/company/dockovpn | | Facebook | https://www.facebook.com/dockovpn |

Repos

| Name | URL | | :--: | :-----: | | GitHub | https://github.com/dockovpn/dockovpn | | Docker Hub | https://hub.docker.com/r/alekslitvinenk/openvpn |

Container properties

<p align=center><a href="https://dockovpn.io" target="_blank"><img src="https://alekslitvinenk.github.io/docker-openvpn/assets/img/container.svg" width="150" height="110"></a></p>

Docker Tags

| Tag | Description | | :----: | :---------: | | latest | This tag is added to every newly built version be that v#.#.# or v#.#.#-regen-dh | | v#.#.# | Standard fixed release version, where {1} is major version, {2} - minor and {3} is a patch. For instance, v1.1.0 | | v#.#.#-regen-dh | Release version with newly generated Deffie Hellman security file. In order to keep security high this version is generated every hour. Tag example - v1.1.0-regen-dh | | dev | Development build which contains the most recent changes from the active development branch (master) |

Environment variables

| Variable | Description | Default value | | :------: | :---------: | :-----------: | | NET_ADAPTER | Network adapter to use on the host machine | eth0 | | HOST_ADDR | Host address override if the resolved address doesn't work | localhost | | HOST_TUN_PORT | Tunnel port to advertise in the client config file | 1194 | | HOST_TUN_PROTOCOL | Tunnel protocol (tcp or udp) | udp | | HOST_CONF_PORT | HTTP port on the host machine to download the client config file | 80 | | CRL_DAYS | CRL days until expiration, i.e. invalid for revocation checking | 3650 |

⚠️ Note: In the provided code snippet we advertise the configuration suitable for the most users. We don't recommend setting custom NET_ADAPTER and HOST_ADDR unless you absolutely have to. Now host address is resolved automatically when container starts.. More often you'd like to customize HOST_TUN_PORT, HOST_CONF_PORT or HOST_TUN_PROTOCOL. If this is the case, use the snippet below (dont forget to replace <custom port> and <custom protocol> with your values):

DOCKOVPN_CONFIG_PORT=<custom port>
DOCKOVPN_TUNNEL_PORT=<custom port>
DOCKOVPN_TUNNEL_PROTOCOL=<custom protocol>
docker run -it --rm --cap-add=NET_ADMIN \
-p $DOCKOVPN_TUNNEL_PORT:1194/$DOCKOVPN_TUNNEL_PROTOCOL -p $DOCKOVPN_CONFIG_PORT:8080/tcp \
-e HOST_CONF_PORT="$DOCKOVPN_CONFIG_PORT" \
-e HOST_TUN_PORT="$DOCKOVPN_TUNNEL_PORT" \
-e HOST_TUN_PROTOCOL="$DOCKOVPN_TUNNEL_PROTOCOL" \
--name dockovpn alekslitvinenk/openvpn

Container options

| Short name | Long name | Description | | :-: | :---: | :-----: | | -r | --regenerate | Regenerates PKI and DH file | | -n | --noop | Initialise container, but don's start VPN server | | -q | --quit | Quit after container was initialized | | -s | --skip | Skip client generation on first start |

⚠️ Note: We strongly recommend always run your container with -r option, even though it will take container a bit longer to start. In future releases we will apply this option by default:

docker run -it --rm --cap-add=NET_ADMIN \
-p 1194:1194/udp -p 80:8080/tcp \
--name dockovpn alekslitvinenk/openvpn -r

Container commands

After container was run using docker run command, it's possible to execute additional commands using docker exec command. For example, docker exec <container id> ./version.sh. See table below to get the full list of supported commands.

| Command | Description | Parameters | Example | | :------: | :---------: | :--------: | :-----: | | ./version.sh | Outputs full container version, i.e Dockovpn v1.2.0 | | docker exec dockovpn ./version.sh | | ./genclient.sh | Generates new client configuration | z β€” Optional. Puts newly generated client.ovpn file into client.zip archive.<br><br>zp paswd β€” Optional. Puts newly generated client.ovpn file into client.zip archive with password pswd <br><br>o β€” Optional. Prints cert to the output. <br><br>oz β€” Optional. Prints zipped cert to the output. Use with output redirection. <br><br>ozp paswd β€” Optional. Prints encrypted zipped cert to the output. Use with output redirection. <br><br>n profile_name β€” Optional. Use specified profile_name parameter instead of random id. Prints client.ovpn to the output<br><br>np profile_name β€” Optional. Use specified profile_name parameter instead of random id and protects by password asked by stdin. Password refers to the connection and it will be asked during connection stage. Prints client.ovpn to the output | docker exec dockovpn ./genclient.sh<br><br>docker exec dockovpn ./genclient.sh z<br><br>docker exec dockovpn ./genclient.sh zp 123 <br><br>docker exec dockovpn ./genclient.sh o > client.ovpn<br><br>docker exec dockovpn ./genclient.sh oz > client.zip <br><br>docker exec dockovpn ./genclient.sh ozp paswd > client.zip<br><br>docker exec dockovpn ./genclient.sh n profile_name<br><br>docker exec -ti dockovpn ./genclient.sh np profile_name | | ./rmclient.sh | Revokes client certificate thus making him/her anable to connect to given Dockovpn server. | Client Id, i.e vFOoQ3Hngz4H790IpRo6JgKR6cMR3YAp | docker exec dockovpn ./rmclient.sh vFOoQ3Hngz4H790IpRo6JgKR6cMR3YAp | | ./listconfigs.sh | List all generated available config IDs | | docker exec dockovpn ./listconfigs.sh | | ./getconfig.sh | Return previously generated config by client ID | Client Id, i.e vFOoQ3Hngz4H790IpRo6JgKR6cMR3YAp | docker exec dockovpn./getconfig.sh vFOoQ3Hngz4H790IpRo6JgKR6cMR3YAp |

⚠️ Note: If you generated a new client configuration with custom name e.g dockovpn exec ./genclient.sh n customname and then chose to remove this config using dockovpn exec ./rmclient.sh customname, the client certificate is revoked permanently in this server, therefore, you cannot create client configuration with the same name again. Doing so will result in error Sat Oct 28 10:05:17 2023 Client with this id [customname] already exists.

πŸ“Ί Video Guide

<p align=center><a href="https://youtu.be/y5Dwakc6hMs"><img src="https://alekslitvinenk.github.io/docker-openvpn/assets/img/video-cover-play.png"></a></p><br>

πŸš€ Quick Start

Prerequisites

  1. Any hardware or vps/vds server running Linux. You should have administrative rights on this machine.
  2. Docker installation on your server.
  3. Public ip address assigned to your server.

1. Run dockovpn

Copy & paste the following command to run docker-openvpn:<br>

docker run -it --rm --cap-add=NET_ADMIN \
-p 1194:1194/udp -p 80:8080/tcp \
--name dockovpn alekslitvinenk/openvpn

⚠️ Note: This snippet runs Dockovpn in attached mode, which means if you close your terminal window, container will be stopped. To prevent this from happening, you first need to detach container from ssh session. Type Ctrl+P Ctrl+Q.

If everything went well, you should be able to see the following output in your console:

Sun Jun  9 08:56:11 2019 Initialization Sequence Completed
Sun Jun  9 08:56:12 2019 Client.ovpn file has be
View on GitHub
GitHub Stars1.4k
CategoryDevelopment
Updated3d ago
Forks277

Languages

Shell

Security Score

100/100

Audited on Mar 29, 2026

No findings