← Start of tutorial

WIUNIX ACADEMY

OpenVPN MFA with client certificates and Google Authenticator

Page 4 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.

Debian 13Reviewed against official documentation ·

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
16

LET’S BUILD

Prepare a private interactive client profile

On a trusted Linux pilot client, create a new0700 directory through your normal private-file workflow, and place the client CA/certificate/key and tls-crypt key there using protected transfer. Save the next file as pilot.ovpn beside them; never paste private keys into this article or reader settings. The pilot certificate CN is academyvpn. Protect the key with your endpoint policy and preferably a passphrase supported by the client.

The profile validates both serverAuth purpose and the exact server certificate name vpn-server, not only the issuing CA. The hostname vpn.example.net is the transport destination; this certificate identity is intentionally fixed by the PKI prerequisite. Other GUI platforms need an explicitly tested import/prompt/key-storage workflow.

For the copied launcher/profile path, use a separate fresh trusted Linux client from the selected distribution family with its signed OpenVPN package already installed. The 9.x profile targets the 2.5 package on both peers; other client versions and GUI imports need explicit compatibility/prompt testing. Run account, PAM and server-unit creation only on the server, not on that client.

bash

Trusted Linux pilot client

umask 077
test ! -e pilot.ovpn && test ! -L pilot.ovpn
set -C
: > pilot.ovpn
set +C
nano pilot.ovpn
How do I know it worked?

A new private profile in the client’s dedicated directory is ready, with private credentials transferred separately.

17

LET’S BUILD

Keep server validation and fresh OTP prompts

Do not append an auth-user-pass filename; that would turn a fresh prompt into stored code reuse. No inline private-key example is included. auth-nocache clears cached input but does not guarantee that every GUI client prompts correctly; test the supported versions.

text · pilot.ovpn

Trusted Linux pilot client

client
dev tun
proto udp4
remote vpn.example.net 11940
nobind
resolv-retry infinite
persist-key
persist-tun
ca ca.crt
cert client.crt
key client.key
tls-crypt tls-crypt.key
remote-cert-tls server
verify-x509-name vpn-server name
tls-version-min 1.2
data-ciphers AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305
allow-compression no
disable-dco
auth-user-pass
auth-nocache
auth-retry interact
verb 3
How do I know it worked?

The client verifies vpn-server and asks for username and a fresh code interactively.

18

LET’S BUILD

Connect and check the bounded tunnel

Run from the client’s private profile directory. At Username type academyvpn exactly; at Password type only a fresh code privately. Keep the process in the foreground for the pilot; stop with Ctrl+C after testing. Initialization Sequence Completed and an assigned pool address are necessary, but also probe an explicitly approved server-side service. A successful TLS exchange alone is not application access.

Use another terminal on that client to inspect routes and ping the VPN server if ICMP is allowed by the reviewed tunnel firewall. A blocked ping is not proof authentication failed; correlate the client log and approved service. This recipe never installs a full-tunnel default route or modifies DNS.

bash

Trusted Linux pilot client

sudo /usr/sbin/openvpn --config ./pilot.ovpn
How do I know it worked?

Matching certificate and username plus a fresh valid TOTP establish the pilot tunnel; no unrelated network access is inferred.

19

LET’S BUILD

Inspect client address and the approved endpoint

Run in a second terminal on the connected pilot client. Check only the named pilot interface shown by its log; do not mistake an existing VPN interface for this one. The sample ICMP probe is conditional on approved policy, not an instruction to open all tunnel traffic.

bash

Trusted Linux pilot client

ip -br address
ip route get 10.93.0.1
ping -c 3 -W 2 10.93.0.1
How do I know it worked?

The route points to this tunnel and an approved probe succeeds, or a documented firewall restriction explains its denial.

Prove denial before extending the pilot

Disconnect between cases. On test-only identities check: correct certificate plus wrong/empty OTP; valid code for a different named identity with the first certificate; a second connection reusing an accepted code; missing seed; expired account; and a revoked client certificate with a current CRL. Each must fail to create an authorized tunnel. Do not test by damaging the working user’s seed or changing production time. A mismatched account can consume its valid code before the binding hook rejects it; request a new code for the next attempt.

Repeated failures hit the per-user seed rate limit. Wait for the configured interval rather than deleting its state or widening the time window. Record only pass/fail, versions and sanitized reason, never the submitted code or seed. Rate limiting is local per seed, not a distributed brute-force control or lockout guarantee. Upstream firewall/rate controls and monitoring remain operational responsibilities.

20

LET’S BUILD

Diagnose privately without credential dumps

For all-user failures check package plugin resolution, PAM service spelling, time, disk space, TUN and helper privileges. For one-user failures check exact CN/username case, enrollment ownership/mode, account expiry and the phone’s time. Never cat the seed or enable verbose PAM debug just to collect evidence. The metadata-only commands below do not display its contents.

A certificate failure happens before OTP. A PAM success followed by AUTH_FAILED can be the CN binding hook. A connected tunnel without service access is a routing/firewall/application authorization problem. Do not remove either verifier to diagnose it.

bash

Dedicated pilot VM; private terminal for enrollment

sudo journalctl -u 'academy-mfa.service' -n 60 --no-pager
timedatectl show -p NTPSynchronized --value
df -h '/srv/academy-openvpn-mfa'
readlink -f '/srv/academy-openvpn-mfa/auth-pam.so'
sudo stat -c '%U %a %n' '/srv/academy-openvpn-mfa/users/academyvpn' '/srv/academy-openvpn-mfa/users/academyvpn/.google_authenticator'
sudo chage -l 'academyvpn'
sudo openssl crl -in '/srv/academy-openvpn-mfa/pki/crl.pem' -noout -lastupdate -nextupdate
How do I know it worked?

A specific cause is isolated from metadata and sanitized logs; credentials stay private and MFA remains enforced.

Explore all tutorials ↗