← Start of tutorial

WIUNIX ACADEMY

OpenVPN MFA with client certificates and Google Authenticator

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

Rocky Linux 10.2Reviewed 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

Recover a lost authenticator through identity verification

A previously secured emergency code can be entered in the same password box while the matching client certificate is still required. It is consumed once; it is not an MFA exemption. Lost phone recovery requires independent identity verification, deliberate seed replacement through the private enrollment process and retirement of all old emergency codes. Never send seeds/codes in a support ticket.

If the certificate device or seed may be compromised, revoke the client certificate, deploy a CA-signed current CRL atomically with readable traversal for the dropped daemon and terminate existing affected sessions through the approved VPN operations process. CRL refresh does not promise to evict an already connected session. Expiring the OS account blocks future PAM acceptance but also does not kill a current tunnel. Backup/restore of seed state can resurrect used codes; protect backups as secrets and reconcile or re-enroll rather than blindly restoring replay state.

21

LET’S BUILD

Stop the pilot without silently removing MFA

On failure stop only the new pilot listener. Keep the known production VPN and independent management console untouched. Do not restore certificate-only access on the same public endpoint, add nullok, remove the binding hook or relax certificate checks as an automatic rollback. A future migration needs an explicit access decision and a separately controlled rollback plan; an outage is preferable to an unnoticed authentication bypass.

This stops the pilot and leaves its protected evidence/configuration for inspection. It neither deletes accounts/seeds nor claims secure erasure. Do not enable the unit at boot until the actual client and operational negative tests have passed.

bash

Dedicated pilot VM; private terminal for enrollment

sudo systemctl disable --now 'academy-mfa.service'
sudo systemctl is-active 'academy-mfa.service' || true
sudo ss -lunp
How do I know it worked?

This pilot is inactive and its UDP listener is gone; no weaker replacement endpoint is started.

What was actually tested

A disposable Ubuntu24.04 container with no published host ports ran real distribution OpenVPN, auth-pam and google-authenticator PAM, temporary accounts, a private fixture CA and a TUN interface. The final recorded results below are bounded fixture evidence; no production account, firewall, route, service or credential was changed. OS release alternatives are documentation-reviewed.

22 recorded checks passed with OpenVPN 2.6.19, google-authenticator PAM 20191231 and Python 3.12.3: valid/wrong/empty TOTP, replay rejection, missing/loosely permissioned seed, expired account, rate limiting and single-use recovery. Real TLS/TUN establishment worked after daemon privilege drop; wrong OTP, mismatched certificate CN and a revoked certificate were denied. Revocation was confirmed by the explicit server rejection, not merely a client timeout. Application data between independent client/server namespaces and the alternative password+OTP stack were not tested. That historical fixture reduced to nobody/nogroup; this revision uses a separate locked daemon UID. That change and RPM/rolling policy paths are documented, not claimed as a fixture rerun.

The fixture is not acceptance of your GUI client, public internet/NAT path, time synchronization daemon, systemd boot/reboot, an HA service or backup restoration. Your actual CN issuance, revocation delivery, firewall authorization, recovery identity verification and renegotiation behavior remain pilot acceptance work. Personalizing the public examples does not run or validate your environment.

Retain the stopped pilot and reconcile its policy changes

Keep personal seed/configuration and sanitized evidence private for the review period. Remove only firewall exceptions introduced for this pilot using the existing owner’s workflow; preserve pre-existing rules and do not enable a weaker listener.

The RPM selection removes only the recorded exact local SELinux mappings. Retiring the disposable VM after secure evidence handling is the simplest complete cleanup; never delete an identity or seed still in use.

bash

Pilot VM after stopping the unit

sudo python3 - <<'PY'
import pathlib,subprocess,json
r=pathlib.Path('/srv/academy-openvpn-mfa')
if subprocess.run(['systemctl','is-active','--quiet','academy-mfa.service']).returncode==0:
    raise SystemExit('Stop the pilot first')
state=json.loads((r/'selinux-local.json').read_text(encoding='utf-8'))
if state.get('port_added'): subprocess.run(['semanage','port','-d','-p','udp','11940'],check=True)
for pattern in reversed(state['patterns']): subprocess.run(['semanage','fcontext','-d',pattern],check=True)
subprocess.run(['restorecon','-RFv',str(r)],check=True)
print('Only recorded local SELinux mappings removed; pilot stays stopped')
PY

Move from one pilot to controlled enrollment

After positive and denial checks, enroll users individually with unique CN/account/seed mapping, monitor sanitized authentication failures, certificate/CRL expiry, disk and clock health, and rehearse lost-device response. Define permitted destinations before adding any route or forwarding rule. Use WireGuard guides for a different key-based site topology, not as a drop-in replacement for this PAM workflow.

GO TO THE SOURCE

Official references

Each environment states how it was reviewed. A documentation review does not claim a hands-on test of every version.

KEEP LEARNING

Your next step

Explore all tutorials ↗