Generating one OpenVPN client cert is trivial. Doing it for forty users across three years — with leavers, lost laptops, rotated CAs, and audit questions — is where most self-rolled VPNs fall apart. This runbook covers the workflow we use: structured per-client requests, packaged .ovpn profiles, a Certificate Revocation List that the server actually consults, and a paper trail that survives a security review.
How to verify
Before issuing a new profile, confirm the PKI is in a state that can be reasoned about and that the server is reading the CRL.
ls -la /etc/openvpn/easy-rsa/pki/issued/
ls -la /etc/openvpn/easy-rsa/pki/private/
openssl crl -in /etc/openvpn/easy-rsa/pki/crl.pem -noout -lastupdate -nextupdate
grep -E '^crl-verify' /etc/openvpn/server/server.conf
If crl-verify is missing from server.conf, revocation does nothing — every old certificate still works. If nextupdate on the CRL is in the past, OpenVPN will refuse new connections until you regenerate it. Both are weekly findings in audits.
What’s happening
A client OpenVPN profile (.ovpn) is three pieces of plumbing glued together: a configuration block (remote host, port, cipher), the CA certificate, and the client’s certificate + private key. The server trusts any client whose certificate is signed by the CA — full stop. There is no central session database; the only mechanism to refuse a previously valid client is the CRL.
Easy-RSA stores the PKI as a directory tree under pki/. Each issued cert lives in pki/issued/<name>.crt; its private key (if generated on the CA host) in pki/private/<name>.key. The CRL at pki/crl.pem is regenerated by easyrsa gen-crl and must be copied to a location the OpenVPN process can read after every revocation.
The packaged .ovpn is generated by inlining the CA cert, client cert, client key, and TLS-crypt key into one file using <ca>, <cert>, <key>, and <tls-crypt> blocks. That single file is what the user imports into the OpenVPN Connect, Tunnelblick, or Viscosity client.
The procedure
-
Issue a per-client certificate. Name it after the user, not the machine —
alicenotmacbook-pro-12. This is the field you will read in audit logs.cd /etc/openvpn/easy-rsa ./easyrsa --batch gen-req alice nopass ./easyrsa --batch sign-req client alice -
Package the profile. Use a script — never hand-edit forty
.ovpnfiles.cat > /usr/local/bin/make-ovpn <<'EOF' #!/bin/bash set -euo pipefail CLIENT=$1 BASE=/etc/openvpn/easy-rsa/pki TEMPLATE=/etc/openvpn/client-template.conf OUT=/etc/openvpn/profiles/${CLIENT}.ovpn { cat $TEMPLATE echo "<ca>"; cat $BASE/ca.crt; echo "</ca>" echo "<cert>"; openssl x509 -in $BASE/issued/${CLIENT}.crt; echo "</cert>" echo "<key>"; cat $BASE/private/${CLIENT}.key; echo "</key>" echo "<tls-crypt>"; cat /etc/openvpn/tls-crypt.key; echo "</tls-crypt>" } > $OUT chmod 600 $OUT echo "Wrote $OUT" EOF chmod +x /usr/local/bin/make-ovpn make-ovpn alice -
Distribute through an authenticated channel. Not email. Use a one-time-link tool (e.g. self-hosted PrivateBin or a SaaS equivalent) with an expiry of 24 hours, or hand the file off through the same chat platform the user already authenticates against with SSO + MFA.
-
Revoke when the laptop walks off. This is the part most teams skip.
cd /etc/openvpn/easy-rsa ./easyrsa --batch revoke alice ./easyrsa gen-crl install -m 644 pki/crl.pem /etc/openvpn/server/crl.pem systemctl reload openvpn-server@server -
Confirm the CRL is loaded. OpenVPN reads the CRL on reload but does not announce success loudly.
journalctl -u openvpn-server@server --since '5 min ago' | grep -i crl openssl crl -in /etc/openvpn/server/crl.pem -noout -text | grep -A1 'Revoked Certificates' -
Keep an issuance ledger. A plain CSV in the PKI repo:
username, fingerprint, issued_at, revoked_at, requested_by, hostname. When auditors ask “who has VPN access today,” you read the file.
Common pitfalls
- Generating client keys on the OpenVPN server itself — fine for a homelab, untenable for a regulated client. Use a dedicated CA host (offline if you can) and ship only the signed cert back.
- Email-attaching
.ovpnfiles — they contain the private key. Treat them like passwords; one-time links or chat DMs with retention controls only. - Forgetting to regenerate the CRL after revoke —
easyrsa revokeonly marks the database;easyrsa gen-crlwrites the file the server reads. - Letting the CRL expire — default validity is 180 days. Past
nextupdate, OpenVPN refuses connections. Croneasyrsa gen-crlquarterly. - Naming certs by laptop hostname — when Alice gets a new laptop the cert name no longer maps to a human. Always name by user identity.
In the engagements we run, OpenVPN client distribution is a managed pipeline — request goes through ticketing, profile is generated on the CA host, link expires, and the ledger updates without anyone touching a spreadsheet. That is what Managed Operations buys: not just a working VPN, but a working VPN that an auditor can examine and an on-call engineer can revoke from at 2 a.m.