🌐 VI | EN

Run OpenVPN Access Server in Docker

Nghia Phan
Nghia Phan
🌐 Bản tiếng Việt → Technical Guide Views
Advertisement
Sponsored

OpenVPN Access Server is a self-hosted VPN solution with a web administration interface. This version keeps the source ports, volume, and operation order while separating commands and adding practical safety notes.

Install Docker on Linux

Log into Linux with a sudo-capable account and run the commands below. The source uses apt-key; on a current distribution, also check the official Docker installation documentation because this command is deprecated.

sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -ycurl -fsSL https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)/gpg | sudo apt-key add -sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release) $(lsb_release -cs) stable"sudo apt install docker-ce docker-compose containerd.io -ysudo systemctl enable docker && sudo systemctl start dockersudo usermod -aG docker $USERsu - $USER

Run the OpenVPN Access Server container

Create the data directory and start the container. NET_ADMIN is required for VPN functions, so do not run this container on an uncontrolled host.

mkdir ~/docker/openvpn-as -pdocker run -d --name openvpn-as \  --cap-add=NET_ADMIN \  -p 943:943 \  -p 8443:443 \  -p 1194:1194/udp \  -v ~/docker/openvpn-as:/openvpn \  openvpn/openvpn-as

Read the temporary password generated by the container:

docker logs openvpn-as | grep 'Auto-generated pass'

Copy the value on the Auto-generated pass = line locally. Do not put the real password in Git or send it through chat.

Sign in and replace the password

  1. Open https://DNSorIP:943/admin. The initial certificate may be self-signed.
  2. Sign in as openvpn with the password from the log.
  3. Click Agree to accept the EULA.
  4. Choose User Management > User Permissions.
  5. Click the edit icon beside openvpn.
  6. Enter a new Password and click Save Settings.
  7. Click Logout, then sign in again with the new password.
  8. Check the container with docker ps and docker logs --tail=50 openvpn-as.

The ports are 943:943 for web access, 8443:443 for HTTPS, and 1194:1194/udp for VPN. Expose them through firewall/NAT rules only when required.

Quảng cáo

Sources and video

Sponsored Advertisement
Partnership

Comments & Discussion

Share your thoughts, ask questions and feedback

Markdown & QQ Emoji
Loading comments...