Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
$ als gewone gebruiker# als root (of met sudo)
The quick answer
dnf install -y openvpn easy-rsa
cp -r /usr/share/easy-rsa/3 /etc/openvpn/easy-rsa && cd /etc/openvpn/easy-rsa
./easyrsa init-pki && ./easyrsa build-ca nopass
./easyrsa build-server-full vpn.example.com nopass
./easyrsa build-client-full alice nopass
./easyrsa gen-crl
openvpn --genkey secret /etc/openvpn/server/tc.keyport 1194
proto udp
dev tun
ca /etc/openvpn/easy-rsa/pki/ca.crt
cert /etc/openvpn/easy-rsa/pki/issued/vpn.example.com.crt
key /etc/openvpn/easy-rsa/pki/private/vpn.example.com.key
dh none
tls-crypt /etc/openvpn/server/tc.key
crl-verify /etc/openvpn/easy-rsa/pki/crl.pem
server 10.8.0.0 255.255.255.0
push "route 10.10.0.0 255.255.0.0"
push "dhcp-option DNS 10.10.0.2"
keepalive 10 60
user nobody
group nobody
persist-key
persist-tun
verb 3systemctl enable --now openvpn-server@serverStep by step
- CA and certificates (quick answer) — keep the CA key (
pki/private/ca.key) safe; better on a separate machine.nopasshere only for the server key (it must start without a person); give the CA a passphrase in production. - Server config — UDP 1194, a tunnel network
10.8.0.0/24, and only the office routes pushed (split tunnel).tls-crypthides the server from scanners (no answer without the key).dh noneuses modern ECDH. - Routing — enable forwarding (
net.ipv4.ip_forward = 1in/etc/sysctl.d/) and either add a route for10.8.0.0/24on the office router, or NAT the VPN clients (firewall-cmd --add-masquerade --permanent). Open 1194/udp. - Client profile — one
.ovpnfile per user with the certificates inline:
client
dev tun
proto udp
remote vpn.example.com 1194
nobind
persist-key
persist-tun
remote-cert-tls server
verb 3
<ca>
(contents of ca.crt)
</ca>
<cert>
(contents of issued/alice.crt)
</cert>
<key>
(contents of private/alice.key)
</key>
<tls-crypt>
(contents of tc.key)
</tls-crypt>Send it over a secure channel, never by plain email.
- Revoke a user — lost laptop or person left:
cd /etc/openvpn/easy-rsa && ./easyrsa revoke alice && ./easyrsa gen-crl
systemctl restart openvpn-server@server- Better login — add MFA (a PAM or RADIUS plugin) or use the CRL plus short certificate lifetimes. For many users consider WireGuard or a commercial access tool.
Check that it worked
journalctl -u openvpn-server@server shows Initialization Sequence Completed; alice connects with the profile and gets 10.8.0.x; ping 10.10.0.2 and the wiki work through the tunnel; after the revoke her connection is refused (certificate revoked in the log).
Common problems
| Problem | Cause | Fix |
|---|---|---|
| Client connects, but no internal hosts reachable | No forwarding, NAT or return route. | ip_forward=1; masquerade or a route on the router. |
TLS handshake failed | Port blocked, or tls-crypt key differs. | Open 1194/udp; same tc.key in the profile. |
| Revoked user can still connect | CRL not regenerated or not reloaded. | gen-crl; restart; check crl-verify path and rights. |
CRL has expired — nobody can connect | The CRL has an expiry date. | Run gen-crl regularly (timer), restart. |
| DNS names do not resolve | DNS option not applied on the client. | Linux clients need update-systemd-resolved or the NetworkManager plugin. |
Server fails after user nobody | Files not readable after dropping rights. | persist-key/persist-tun; check rights of the CRL. |
Go further
- Command pages: openvpn, openssl, firewall-cmd.
- Next how-tos: Connect two servers with a WireGuard VPN, Change kernel settings with sysctl, Run your own DNS zone with BIND, Check when a TLS certificate expires.
- Learn it: Network services — OpenVPN. Full guide: OpenVPN.
1Why give every user their own certificate?
One lost or leaked certificate can be revoked on its own without changing the access of everyone else.
2What does tls-crypt add?
It encrypts and authenticates the TLS handshake with a shared key, so the server does not answer anyone without the key.