Self-hosted OpenConnect VPN server with a modern web dashboard, user management, traffic monitoring.
1.2K
A modern, self-hosted OpenConnect VPN server with a powerful web-based management dashboard.
Ocserv Dashboard provides an integrated environment for deploying and managing OpenConnect VPN Server (ocserv), including a Go backend, PostgreSQL database, nginx, administration dashboard, and customer portal.
amd64 / arm64)/dev/net/tun supportNET_ADMIN capabilitydocker pull mmtaee/ocserv-dashboard:latest
For production, pin an available release tag instead of latest.
mkdir -p ocserv-dashboard
cd ocserv-dashboard
Create a .env file:
nano .env
Add the following configuration:
# Server Configuration
HOST="vpn.example.com"
ETH="eth0"
# Security
SECRET_KEY="REPLACE_WITH_64_CHARACTER_RANDOM_HEX"
POSTGRES_PASSWORD="REPLACE_WITH_STRONG_DATABASE_PASSWORD"
# Administrator Account
SUPERADMIN_USERNAME="admin"
SUPERADMIN_PASSWORD="REPLACE_WITH_STRONG_ADMIN_PASSWORD"
# Node Configuration
AGENT_NODE=false
# VPN Configuration
OCSERV_PORT=443
OC_NET="172.16.24.0/24"
OCSERV_DNS="1.1.1.1"
# Dashboard
WEB_PORT=3000
# SSL Configuration
SSL_CN="vpn.example.com"
SSL_ORG="ocserv-dashboard"
# Optional Services
TELEGRAM_BOT_ENABLED=false
CUSTOMER_API_ENABLED=true
Important configuration notes:
| Variable | Description |
|---|---|
HOST | Public domain name or IP address of the VPN server |
ETH | Host network interface used for VPN traffic |
SECRET_KEY | 64-character random hexadecimal secret |
POSTGRES_PASSWORD | Password for the PostgreSQL database |
SUPERADMIN_USERNAME | Initial administrator username |
SUPERADMIN_PASSWORD | Initial administrator password |
AGENT_NODE | false for a full/master deployment |
OCSERV_PORT | VPN listening port, default 443 |
OC_NET | VPN client address subnet |
OCSERV_DNS | DNS server assigned to VPN clients |
WEB_PORT | Dashboard HTTPS port, default 3000 |
SSL_CN | Certificate common name |
SSL_ORG | Certificate organization |
TELEGRAM_BOT_ENABLED | Enable or disable Telegram bot integration |
CUSTOMER_API_ENABLED | Enable or disable the customer portal |
Generate a secure secret:
openssl rand -hex 32
Copy the generated value into SECRET_KEY.
Find your host network interface:
ip route get 1.1.1.1
Update ETH with the correct interface, then secure the environment file:
chmod 600 .env
Never commit .env to a public repository.
Create compose.yml:
services:
ocserv:
container_name: ocserv
image: mmtaee/ocserv-dashboard:latest
env_file:
- .env
environment:
HOST_PROC: /host/proc
HOST_SYS: /host/sys
POSTGRES_HOST: 127.0.0.1
TELEGRAM_RECEIPTS_DIR: /opt/ocserv_dashboard/uploads/receipts
cap_add:
- NET_ADMIN
sysctls:
net.ipv4.ip_forward: "1"
devices:
- /dev/net/tun:/dev/net/tun
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- ./data/ocserv:/etc/ocserv
- ./data/postgresql18:/var/lib/postgresql
- ./data/cron_journal:/app/cron_journal
- ./data/telegram_receipts:/opt/ocserv_dashboard/uploads/receipts
ports:
- "${OCSERV_PORT:-443}:${OCSERV_PORT:-443}/tcp"
- "${OCSERV_PORT:-443}:${OCSERV_PORT:-443}/udp"
- "${WEB_PORT:-3000}:${WEB_PORT:-3000}"
restart: unless-stopped
Important: Keep the container name ocserv. Application features that access ocserv logs through the Docker API depend on it.
PostgreSQL 18 data must be mounted at /var/lib/postgresql, not /var/lib/postgresql/data.
mkdir -p \
data/ocserv \
data/postgresql18 \
data/cron_journal \
data/telegram_receipts
These directories preserve VPN configuration, database data, scheduled job state, and Telegram receipt uploads across container restarts.
docker compose up -d
Check startup logs:
docker compose logs -f ocserv
Wait for initialization and database migrations to complete.
Open:
https://vpn.example.com:3000/
Log in using the SUPERADMIN_USERNAME and SUPERADMIN_PASSWORD values configured in .env.
The customer portal is available at:
https://vpn.example.com:3000/customer/
The customer portal is enabled when CUSTOMER_API_ENABLED=true and the published image includes the customer portal build.
If you prefer Docker CLI instead of Docker Compose, first create the .env file and persistent directories as described above.
docker run -d \
--name ocserv \
--env-file .env \
-e HOST_PROC=/host/proc \
-e HOST_SYS=/host/sys \
-e POSTGRES_HOST=127.0.0.1 \
-e TELEGRAM_RECEIPTS_DIR=/opt/ocserv_dashboard/uploads/receipts \
--cap-add=NET_ADMIN \
--sysctl net.ipv4.ip_forward=1 \
--device /dev/net/tun:/dev/net/tun \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v /proc:/host/proc:ro \
-v /sys:/host/sys:ro \
-v "$PWD/data/ocserv:/etc/ocserv" \
-v "$PWD/data/postgresql18:/var/lib/postgresql" \
-v "$PWD/data/cron_journal:/app/cron_journal" \
-v "$PWD/data/telegram_receipts:/opt/ocserv_dashboard/uploads/receipts" \
-p 443:443/tcp \
-p 443:443/udp \
-p 3000:3000 \
--restart unless-stopped \
mmtaee/ocserv-dashboard:latest
This example assumes the default VPN and dashboard ports. Adjust the port mappings if you change them in .env.
View logs:
docker logs -f ocserv
Pull the latest image:
docker compose pull
Recreate the container:
docker compose up -d
Check logs:
docker compose logs -f ocserv
Back up your persistent data before upgrading, especially PostgreSQL and ocserv configuration.
| Port | Protocol | Purpose |
|---|---|---|
| 443 | TCP | OpenConnect VPN |
| 443 | UDP | OpenConnect VPN |
| 3000 | TCP | Admin dashboard and customer portal |
| 8080 | TCP | Agent API on agent deployments |
The agent API should be restricted to trusted networks and should not be exposed publicly without appropriate protection.
SECRET_KEY..env with restricted file permissions./var/run/docker.sock gives the container significant control over the Docker host.Images are published through GitHub Actions when version tags are pushed.
Examples:
docker pull mmtaee/ocserv-dashboard:latest
docker pull mmtaee/ocserv-dashboard:v5.0
Use an existing published tag. For production deployments, prefer a pinned release version.
Ocserv Dashboard — Simplifying OpenConnect VPN management.
Developed and maintained by mmtaee.
docker pull mmtaee/ocserv-dashboard:latest