/openvpn

A Docker file to build images for AMD & ARM devices with a installation of OpenVPN server to secure your data communications, whether it's for Internet privacy, remote access for employees, securing IoT, or for networking Cloud data centers.

Primary LanguageShellMIT LicenseMIT

OpenVPN

A Docker file to build images for AMD & ARM devices with an installation of OpenVPN VPN server to secure your data communications, whether it's for Internet privacy, remote access for employees, securing IoT, or for networking Cloud data centers.

Be aware! You should carefully read the usage documentation of every tool!

Thanks to

Details

Website GitHub Docker Hub
Deft.Work my personal blog openvpn openvpn
Docker Pulls Docker Stars Size Sponsors
Docker pulls Docker stars Docker Image size GitHub Sponsors

Compatible Architectures

This image has been builded using buildx for these architectures:

  • amd64 arm64 ppc64le s390x 386 arm/v7 arm/v6

Build Instructions

Build for amd64 arm64 or armv7l architecture (thanks to its Multi-Arch base image)

docker build -t elswork/openvpn .

Usage

The process to get a full fuctional VPN server and a suitable ovpn client file involve 6 steps:

Create Volume

make volume

Or

docker volume create --name ovpn-data-sample

Generate Configuration

make config

Or

docker run -v ovpn-data-sample:/etc/openvpn \
    --log-driver=none --rm elswork/openvpn ovpn_genconfig \
    -u udp://YourServerDomain.com

Initialize PKI

make pki

Or

docker run -v ovpn-data-sample:/etc/openvpn \
    --log-driver=none --rm -it elswork/openvpn touch /etc/openvpn/vars
docker run -v ovpn-data-sample:/etc/openvpn \
    --log-driver=none --rm -it elswork/openvpn ovpn_initpki

Init

You can execute earlier three steps (Create Volume, Generate Configuration and Initialize PKI) in a single make command.

make init

Start VPN Server

make start

Or

docker run -v ovpn-data-sample:/etc/openvpn \
    -d -p 1194:1194/udp --cap-add=NET_ADMIN elswork/openvpn

Create ovpn client file

make client

Or

docker run -v ovpn-data-sample:/etc/openvpn \
    --log-driver=none --rm -it elswork/openvpn easyrsa build-client-full CLIENTNAME nopass

Retrieve ovpn client file

make retrieve

Or

docker run -v ovpn-data-sample:/etc/openvpn \
    --log-driver=none --rm elswork/openvpn \
    ovpn_getclient CLIENTNAME > CLIENTNAME.ovpn

After this command a file called "CLIENTNAME.ovpn" should be created in the current path, this file in the client configuration file for this VPN server, it must be sent to the client device that will connect to the VPN, sometimes it can be difficult to send that file out of the linux system, I suggest to send it via mail if you have an operative mail system in your linux host or using SFTP, FTP, SCP, or Samba. Send the generated ovpn file to your smartphone or client device.

You must have installed OpenVPN Connect


Sponsor me! Together we will be unstoppable.