Web User Interface for OpenVPN
OpenVPN server web administration interface.
Quick to deploy and easy to use, makes work with small OpenVPN environments a breeze.
dev tun) or bridge(dev tap) server configurationsPart of following projects:
For the best experience, it is recommended to deploy it within a Docker environment consisting of two distinct containers:
d3vilh/openvpn-server Back-End container (openvpn) for running OpenVPN server.However it works fine as standalone application with standalone OpenVPN server as well.
You can run both containers from the official openvpn-server repository, docker-compose-openvpnui.yml.
It includes all the files in its main directory.
For automated installation on baremetal x86-64 servers, Cloud or VM installation, please use openvpn-aws project. It, as well, includes all the necessary scripts for easy installation of OpenVPN-UI and OpenVPN server on any x86-64 platform.
For Raspberry-Pi and other ARM devices, consider Raspberry-Gateway project. It has all the necessary scripts for easy installation and lot of additional features.
You can run both containers from the openvpn-server repository as well (use docker-compose-openvpnui.yml).
It includes all the files in its main directory, as well.
With Docker-composedocker-compose.yml file openvpn-ui:
container_name: openvpn-ui
image: d3vilh/openvpn-ui:latest
environment:
- OPENVPN_ADMIN_USERNAME={{ ovpnui_user }}
- OPENVPN_ADMIN_PASSWORD={{ ovpnui_password }}
privileged: true
ports:
- "8080:8080/tcp"
volumes:
- ./:/etc/openvpn
- ./db:/opt/openvpn-ui/db
- ./pki:/usr/share/easy-rsa/pki
- /var/run/docker.sock:/var/run/docker.sock:ro
restart: alwaysYou can also couple OpenVPN-UI with recommended d3vilh/openvpn-server image and here is updated docker-compose.yml for it:
…If you start this compose file with volumes listed above (click to see detail)
You have to run these commands before starting:
mkdir -p /var/data/d3openvpn # change it as you needed
cd /var/data/d3openvpn
git clone https://github.com/d3vilh/openvpn-server . # or download the zip file from GitHub if you don't have git installed
sudo docker compose -f docker-compose.yml up -dor
mkdir -p /var/data/d3openvpn # change it as you needed
cd /var/data/d3openvpn
mkdir -p ./config
wget https://raw.githubusercontent.com/d3vilh/openvpn-server/refs/heads/main/server.conf -O server.conf
wget https://raw.githubusercontent.com/d3vilh/openvpn-server/refs/heads/main/config/easy-rsa.vars -O config/easy-rsa.vars
wget https://raw.githubusercontent.com/d3vilh/openvpn-server/refs/heads/main/config/client.conf -O config/client.conf
echo "" > ./fw-rules.sh
sudo docker compose -f docker-compose.yml up -dWhere:
TRUST_SUB is Trusted subnet, from which OpenVPN server will assign IPs to trusted clients (default subnet for all clients)GUEST_SUB is Gusets subnet for clients with internet access onlyHOME_SUB is subnet where the VPN server is located, thru which you get internet access to the clients with MASQUERADEfw-rules.sh is bash file with additional firewall rules you would like to apply during container startdocker_entrypoint.sh will apply following Firewall rules:
IPT MASQ Chains:
MASQUERADE all -- ip-10-0-70-0.ec2.internal/24 anywhere
MASQUERADE all -- ip-10-0-71-0.ec2.internal/24 anywhere
IPT FWD Chains:
0 0 DROP 1 -- * * 10.0.71.0/24 0.0.0.0/0 icmptype 8
0 0 DROP 1 -- * * 10.0.71.0/24 0.0.0.0/0 icmptype 0
0 0 DROP 0 -- * * 10.0.71.0/24 192.168.88.0/24Here is possible content of fw-rules.sh file to apply additional rules:
~/openvpn-server $ cat fw-rules.sh
iptables -A FORWARD -s 10.0.70.88 -d 10.0.70.77 -j DROP
iptables -A FORWARD -d 10.0.70.77 -s 10.0.70.88 -j DROPWith DockerfileRun the OpenVPN-UI image
docker run \
-v /home/pi/openvpn:/etc/openvpn \
-v /home/pi/openvpn/db:/opt/openvpn-ui/db \
-v /home/pi/openvpn/pki:/usr/share/easy-rsa/pki \
-v /home/pi/openvpn/log:/var/log/openvpn \
-v /var/run/docker.sock:/var/run/docker.sock \
-e OPENVPN_ADMIN_USERNAME='admin' \
-e OPENVPN_ADMIN_PASSWORD='gagaZush' \
-p 8080:8080/tcp \
--privileged d3vilh/openvpn-ui:latestRun the OpenVPN Server image:
…Building own imageAs prerequisite, you need to have Docker and GoLang to be installed and running:
sudo apt-get install docker.io -y
sudo systemctl restart dockerTo install Golang go to https://go.dev/dl and copy download URL for Go1.20.X version of your arch and follow the instructions below.
Example for ARM64:
wget https://golang.org/dl/go1.20.linux-arm64.tar.gz
sudo tar -C /usr/local -xzf go1.20.linux-arm64.tar.gz
echo "export PATH=$PATH:/usr/local/go/bin" >> /etc/profile
source /etc/profile
go version To build the OpenVPN-UI image:
cd build; ./build_openvpn-ui.shThe new image will have openvpn-ui name.
Standalone installationIf you have your OpenVPN server up and running on the same host, you can install OpenVPN-UI as standalone application. For this you need to have GoLang installed on your host to build all the necessary binaries on the server itself.
To make installation easier, version 0.9.5 now includes a standalone-install.sh script. This script helps you step by step, starting with downloading and installing GoLang, and ending with building the binaries.
At the moment script supports Debian based systems only.
Here is installation process example:
…After build and installation is complete:
openvpn-ui.tar.gz with binaries to the desired directory where you would like to run OpenVPN-UI from.tar -xzf openvpn-ui.tar.gz.db directory in the same directory where openvpn-ui binary is located.OpenVpnPath and EasyRsaPath with real location of your OpenVPN server config (/etc/openvpn) and EasyRSA (/usr/share/easy-rsa) in main application config file - ./conf/app.conf file. EnableAdmin = false and RunMode = prod in the same file, if you don't need to run BeeGo in development mode and don't need BeeGo admin console to run (in most cases you don't need it).OPENVPN_ADMIN_USERNAME and OPENVPN_ADMIN_PASSWORD environment variables to create admin user with secret password:export OPENVPN_ADMIN_USERNAME=admin
export OPENVPN_ADMIN_PASSWORD=$3kR3tPa$Sw0rdecho $OPENVPN_ADMIN_USERNAME
echo $OPENVPN_ADMIN_PASSWORDThis should return your username and password you will use for the first login into UI. It is mandatory to set this vars on the first application start only. So OpenVPN-UI will create your Admin user with your own credentials.
Run ./openvpn-ui binary and login with your new credentials.
Go to Configuration > OpenVPN Server and update all the fields with your current server.conf options.
For security reasons you have to unset vars after successful login, so it will be removed from the local server environment:
unset OPENVPN_ADMIN_USERNAME
unset OPENVPN_ADMIN_PASSWORDDuring the installtion or upgrade process OpenVPN-UI by itself does not do any changes to your OpenVPN server configuration or PKI infrastructure. However it is recommended to perform backup of your PKI infrastructure, server.conf, client.conf and data.db before following with upgrade steps.
BackupTo backup your PKI infrastructure, server, client configuration files and OpenVPN-UI DB you can use backup.sh script which is in build/assets directory (since the release 0.6), it is also part of openvpn-aws and Raspberry-Gateway projects (right in openvpn-server directory).
Copy the script in your home directory(any directory in fact):
cp -p build/assets/backup.sh ~/Then run the script:
sudo ./backup.sh -b ~/openvpn-server backup/openvpn-server-030923-1this will create backup of all necessary files, from ~/openvpn-server to ~/backup/openvpn-server-030923-1.
You can confirm all files are backed up and go to the "Upgrade" step.
UpgradeTo upgrade OpenVPN-UI to the latest version, you have to save old container image, remove old container and deploy new container with upgraded image.
docker inspect --format='{{json .Config.Labels}}' d3vilh/openvpn-ui:latest
{"maintainer":"Mr.Philipp ","version":"0.5"}Note: Old container
No open issues yet, or sync has not completed.