Skip to content

OpenVPN

This page covers the built-in OpenVPN template: an OpenVPN server that asks OkYouIn through the RADIUS plugin (radiusplugin). For RADIUS concepts see RADIUS.

ServerClientModesWhat was verified
OpenVPN 2.7.0 + radiusplugin 2.1 on Ubuntu 26.04OpenVPN Connect 3.8.2; OpenVPN 2.6 CLIpassword, MFA only, password + MFATOTP through the static challenge; Web Push approval (any character as the response); Push only client prompt (Web Push approve / deny, e-mail links, TOTP user refused, wrong password sends no push); accounting Start / Interim / Stop; Framed-IP-Address and Framed-Route

Not verified: Telegram with OpenVPN Connect. Byte counters stay 0 with OpenVPN 2.6 or newer (see Accounting).

First factorOkYouIn checks the password, or MFA only — the client certificate is the first factor and the password field is ignored.
Second factorTOTP and the Web Push offline code typed in the code window; push (Web Push, Telegram) and e-mail with Approve / Deny links. E-mail codes never work with OpenVPN.
PromptsThe RADIUS plugin cannot answer an Access-Challenge (it treats it as a reject). A code can only travel in the static challenge, typed together with the password.
AccountingStart / Interim / Stop with session time; see the byte-counter note below.
Client IPCalling-Station-Id is the client’s address.

The application’s Settings tab has a Client prompt field. It decides what the client profile asks for, and the Connect tab shows the matching client lines.

Client promptWhat users seeMethods
Code window (default)Password, then a second field. TOTP: the code. Web Push: the device’s offline code, or any character for the push. Telegram or e-mail links: any character.Every method except e-mail codes. A profile without the static-challenge line cannot log in with TOTP.
Push onlyUsername and password only. A correct password sends the push; the connection waits for the approval. A wrong password is refused at once and sends no push.Web Push, Telegram, e-mail with Approve / Deny links. Users whose only method is TOTP are refused (incompatible_method).

OpenVPN Connect 3.x refuses an empty response in the code window; OkYouIn ignores whatever is typed when the user approves a push.

  1. In OkYouIn, open Access ▸ Applications ▸ Add application and pick OpenVPN. Add the VPN server’s address under Sources. The Connect tab shows the files below with real values.

  2. Install the RADIUS plugin (Debian / Ubuntu: package openvpn-auth-radius).

  3. Find the server config your OpenVPN service runs: systemctl list-units 'openvpn-server@*' shows openvpn-server@<name>; on Debian / Ubuntu its config is /etc/openvpn/server/<name>.conf. Use that name everywhere below.

  4. Create /etc/openvpn/radiusplugin.cnf (example: OkYouIn at 192.0.2.10, NAS-Identifier vpn-hq) and make it root-only, since it holds the shared secret: sudo chown root:root /etc/openvpn/radiusplugin.cnf && sudo chmod 600 /etc/openvpn/radiusplugin.cnf.

    NAS-Identifier=vpn-hq
    Service-Type=5
    Framed-Protocol=1
    NAS-Port-Type=5
    OpenVPNConfig=/etc/openvpn/server/<name>.conf
    overwriteccfiles=false
    nonfatalaccounting=true
    useauthcontrolfile=true
    server
    {
    name=192.0.2.10
    authport=1812
    acctport=1813
    sharedsecret=<SHARED-SECRET>
    retry=1
    wait=60
    }
  5. Add these lines to your existing /etc/openvpn/server/<name>.conf — do not create a new file, OpenVPN reads only the config its service runs:

    plugin /usr/lib/openvpn/radiusplugin.so /etc/openvpn/radiusplugin.cnf
    username-as-common-name
    # Push needs time: keep the TLS handshake window above the RADIUS wait.
    hand-window 90
    # Renegotiations and reconnects use the session token, not RADIUS.
    reneg-sec 3600
    auth-gen-token 0
    # radiusplugin reads byte counters from this status file (version 1)
    status /run/openvpn-server/status-<name>.log 10
    status-version 1
  6. Restart and check: sudo systemctl restart openvpn-server@<name>, then journalctl -u openvpn-server@<name> must show radiusplugin.so loading (a PLUGIN_INIT line). Without it OpenVPN never asks OkYouIn.

  7. Add the client lines to every client profile:

    auth-user-pass
    static-challenge "Code (for a push, type any character)" 1
    auth-nocache
    # Wait for the push longer than OkYouIn does (client default: 60 s).
    hand-window 90

Why these settings:

  • useauthcontrolfile=true defers the RADIUS request, so the server keeps serving other clients while one user approves a push.
  • Do not add requirema=yes. OkYouIn’s Accounting-Response carries no Message-Authenticator, so the plugin would drop it and the client would get AUTH_FAILED although the login was accepted. The default works — every Access-Accept and Access-Reject carries Message-Authenticator.
  • username-as-common-name makes the typed, MFA-checked username the client’s common name in logs, status and client-config-dir. It does not check that the certificate belongs to that user.
  • reneg-sec 3600 with auth-gen-token 0: after the first login the server pushes a session token, and renegotiations and reconnects use it instead of RADIUS — no second code prompt.

The user has Max request time (seconds) (Access ▸ Settings ▸ RADIUS) minus 5 seconds to approve — 55 s at the default 60. Keep Max request time at or below wait=60 in radiusplugin.cnf, and hand-window 90 above both in the server config and the client profile. With the client’s default of 60 s the client gives up first and reconnects, which sends a second push. Raise all three together if users need longer.

With First factor set to MFA only, the client certificate is the first factor and the password field is ignored (any value works). Keep MFA cache (minutes) at 0: a cached MFA would also let another certificate holder behind the same IP log in as that user. When users have a directory or local password, password + MFA is the natural mode, since every OpenVPN client asks for a password anyway.

AttributeEffect
Framed-IP-AddressFixed tunnel address for the user (the plugin writes ifconfig-push into the user’s CCD file).
Framed-RouteA network behind the client (the client is a router), e.g. 192.168.50.0/24 10.8.0.50/32 1: the plugin writes iroute and adds the kernel route itself. It is not a route pushed to the user.

Both need, in radiusplugin.cnf, overwriteccfiles=true and subnet=<netmask of your server line> (e.g. subnet=255.255.255.0), and fixed addresses outside the dynamic pool: server <network> <netmask> nopool plus ifconfig-pool <first> <last> <netmask>. The plugin then overwrites the client-config-dir file of every user it authenticates — your own CCD content for those users is lost.

radiusplugin sends Accounting Start and Stop to the accounting port; with nonfatalaccounting=true a lost Accounting-Response does not refuse the login. OkYouIn asks for an Interim-Update every Interim interval (seconds) (300 by default for this template; empty sends none). Sessions with their timeline are on the application’s Sessions tab.

Keep the status and status-version 1 lines: radiusplugin reads byte counters from that file and understands only version 1. With OpenVPN 2.6 or newer, radiusplugin 2.1 still reports 0 bytes (it cannot match the address format these versions write). Sessions, duration, Interim-Updates and the timeline work; traffic stays 0.

radiusplugin 2.1 sends Message-Authenticator in every Access-Request, so Strict is safe and recommended for this application. New applications start at Standard.

  1. Connect with a client profile and complete the code or push.

  2. Check Logging ▸ RADIUS log for the Accept and the application’s Sessions tab for the session.

SymptomLikely cause
OkYouIn never sees a requestThe plugin is not loaded (no PLUGIN_INIT in the journal), or the lines went into a config file the service does not run.
AUTH_FAILED although the log shows Acceptrequirema=yes in radiusplugin.cnf.
Two pushes for one connectionThe client’s hand-window is below the push wait; set hand-window 90 in the profile.
TOTP user refused (incompatible_method)Client prompt is Push only; switch to Code window or give the user a push method.
Wrong codes and challenges add upTOTP codes are single-use; each attempt counts toward the per-user limits in Access ▸ Settings ▸ RADIUS.