WIUNIX ACADEMY
OpenVPN MFA with client certificates and Google Authenticator
Page 3 of 5. Review the earlier steps and prerequisites before continuing.
YOUR SYSTEM. YOUR STEPS.
Where are you working?
Choose your OS and version. The prerequisites, commands and troubleshooting follow your environment.
USE YOUR OWN VALUES
Configure this tutorial
Set the example values for your environment; related explanations and copy panels update together. Never enter passwords, private keys or tokens. Values stay in this tab and are not sent to the server or share links. Check actual DNS, certificates and network policy before running commands.
Different IP addresses, domains or ports? Open the settings below, change the values and select “Apply to tutorial”, then copy the updated commands.
Set values for my environment7 editable values
LET’S BUILD
Create the pilot server configuration
Save the following complete file. Do not merge it into the production listener. Startup verifies the key/certificate match; a failed start must remain stopped while investigated. Current AEAD data ciphers and TLS1.2 minimum are used, with no compression or obsolete BF-CBC/cipher fallback. DCO is disabled in this small conventional-TUN pilot for consistent diagnostics.
Dedicated pilot VM; private terminal for enrollment
set -eu
sudo sh -c 'umask 077; set -C; : > "/srv/academy-openvpn-mfa/server.conf"'
sudo nano '/srv/academy-openvpn-mfa/server.conf'
A new private pilot configuration is ready to edit.
LET’S BUILD
Require both verifiers and retain certificate names
The main daemon drops to academy-openvpn while the packaged PAM helper remains privileged. The one-hour renegotiation interval does not guarantee session lifetime; test actual clients after reconnect, renegotiation and suspend. No credential logging, management listener, duplicate-CN mode or optional authentication is enabled.
Dedicated pilot VM; private terminal for enrollment
local 192.0.2.40
port 11940
proto udp4
dev tun-mfa
dev-type tun
topology subnet
server 10.93.0.0 255.255.255.0
ca /srv/academy-openvpn-mfa/pki/ca.crt
cert /srv/academy-openvpn-mfa/pki/server.crt
key /srv/academy-openvpn-mfa/pki/server.key
dh none
crl-verify /srv/academy-openvpn-mfa/pki/crl.pem
tls-crypt /srv/academy-openvpn-mfa/pki/tls-crypt.key
verify-client-cert require
remote-cert-tls client
tls-version-min 1.2
data-ciphers AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305
allow-compression no
disable-dco
plugin /srv/academy-openvpn-mfa/auth-pam.so "academy-mfa login USERNAME Verification PASSWORD"
script-security 2
auth-user-pass-verify /srv/academy-openvpn-mfa/bind-cn.py via-file
tmp-dir /srv/academy-openvpn-mfa/auth-tmp
user academy-openvpn
group academy-openvpn
persist-key
persist-tun
keepalive 10 60
reneg-sec 3600
verb 3
The complete candidate requires verified client certificates, OTP PAM and exact CN binding.
LET’S BUILD
Prepare a dedicated systemd unit
The unit is deliberately separate from distribution auto-discovery directories and existing VPN units. It starts as root so the packaged PAM helper can initialize; the OpenVPN configuration then drops the main daemon. Do not add systemd User=nobody, NoNewPrivileges or filesystem restrictions without testing their effect on PAM identity switching and state writes. The scoped unit is not a complete hardening profile.
Dedicated pilot VM; private terminal for enrollment
set -eu
sudo sh -c 'umask 022; set -C; : > "/etc/systemd/system/academy-mfa.service"'
sudo nano '/etc/systemd/system/academy-mfa.service'
A fresh isolated unit file is ready; no existing unit is overwritten.
LET’S BUILD
Run only the reviewed pilot
The unit starts as root, reads protected configuration/key and lets OpenVPN reduce the main daemon UID. Personal seed state stays user-owned 0600. Restart=no leaves a failed pilot stopped for diagnosis. Boot enablement stays off until real positive/negative client checks and operational review pass.
Dedicated pilot VM; private terminal for enrollment
[Unit]
Description=WIUNIX Academy certificate and TOTP pilot
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
ExecStart=/usr/sbin/openvpn --config /srv/academy-openvpn-mfa/server.conf
Restart=no
UMask=0077
[Install]
WantedBy=multi-user.target
The unit invokes only this dedicated configuration; automatic boot start remains off.
LET’S BUILD
Review host security policy before starting
Keep the existing firewall and MAC policy. The base DEB path inspects AppArmor; RPM labels this pilot’s files and UDP port for native openvpn_t. Never disable enforcement to conceal a denial.
Allow pilot UDP only from approved test-client sources, and tunnel INPUT only for the approved service. This pilot adds no forwarding/NAT. Preserve SSH/console access and record newly introduced firewall exceptions; a broad existing allow can defeat a new narrow rule.
Pilot VM before first service start
if command -v aa-status >/dev/null; then sudo aa-status; fi
if command -v getenforce >/dev/null; then getenforce; fi
sudo ss -lunp
sudo systemd-analyze verify '/etc/systemd/system/academy-mfa.service'The actual policy permits only the intended pilot; ready for real service and denial checks.
LET’S BUILD
Validate the unit and start with the console open
Run this on the dedicated VM with the independent console still open. OpenVPN has no general full-config dry-run flag; systemd-analyze checks unit syntax, not TLS/auth correctness. A real bounded startup is the configuration check here. Read the journal privately and stop for any plugin, CRL, key, TUN or permission failure. Never add insecure options to make startup succeed.
Dedicated pilot VM; private terminal for enrollment
set -eu
sudo systemd-analyze verify '/etc/systemd/system/academy-mfa.service'
sudo systemctl daemon-reload
sudo systemctl start 'academy-mfa.service'
sudo systemctl is-active 'academy-mfa.service'
sudo journalctl -u 'academy-mfa.service' -n 60 --no-pager
ip -br address show dev 'tun-mfa'
sudo ss -lunp
ps -eo user,pid,ppid,args | grep '[o]penvpn'
The pilot listens on its dedicated UDP port, the new TUN has 10.93.0.1/24 and the main daemon runs as academy-openvpn; the packaged PAM helper remains privileged. Authentication/application checks follow.