Putting the Notakey Authentication Proxy in front of a RADIUS server adds a phone approval to every VPN login. How much that approval is worth depends on a handful of settings around it. This post goes through them one by one, for version 2 of the proxy. The basic setup is in VPN 2FA with RADIUS; here we assume it works and make it tight.
Where we write “in our lab”, we saw it ourselves in tests with real gateways or a test setup. The rest comes from the product manual. Where we did not test something, we say so.
1. List every gateway, by address
The proxy answers only the gateways in its clients list. A packet from any
other address is dropped without an answer and counted as
dropped_unknown_source. In our lab a request from an address that was not
on the list got no reply, and the counter went up by one.
Write each gateway as its own entry, with the address its requests come
from. A gateway behind network address translation is known by the
translated address. A network such as 198.51.100.0/24 is allowed, but it
lets every device in it talk to the proxy with the same secret, so use it
only where the gateways really share one address range.
On an installation that came from version 1 the setting
ap.allow_any_address may still be on: the proxy then takes requests from
anywhere that knows the secret, and ntk ap validate warns about it. Set
ap.clients and the warning goes away. The
upgrade article shows how to
do that without cutting off a gateway.
2. Give each gateway a secret of its own
With one secret for all gateways, anyone who learns it from one device can send requests as any of them. With a secret per gateway, a leaked secret belongs to one entry, and you change only that one.
On the appliance that is the full form of ap.clients, a list with a name,
an address and a secret for each gateway. ap.servers takes the RADIUS
servers in the same form. Each command changes only its own setting:
ntk cfg setc :ap.clients '[
{ "name": "hq-vpn", "address": "192.0.2.10", "secret": "<secret of hq-vpn>" },
{ "name": "branch-vpn", "address": "198.51.100.20", "secret": "<secret of branch-vpn>" }
]' --json-input
ntk cfg setc :ap.servers '[
{ "name": "nps-1", "address": "192.0.2.50", "secret": "<secret of the RADIUS server>" }
]' --json-input
ntk ap validate
ntk ap restart
The older settings ap.vpn_secret_in and ap.vpn_secret_out take at most
16 characters. The secrets in the lists above have no such limit.
Make the secrets long and random: the proxy warns about any secret shorter than 16 characters. A RADIUS secret is typed into a device once, so there is no reason to keep it short. For example:
openssl rand -base64 30
Where you run the container yourself, keep the secrets out of the
configuration file. secretFile (and clientSecretFile for the API client)
reads each one from a file of its own:
{
"clients": [
{
"name": "hq-vpn",
"address": "192.0.2.10",
"secretFile": "secrets/hq-vpn"
},
{
"name": "branch-vpn",
"address": "198.51.100.20",
"secretFile": "secrets/branch-vpn"
}
],
"passwordCheck": {
"servers": [
{ "name": "nps-1", "address": "192.0.2.50", "secretFile": "secrets/nps" },
{ "name": "nps-2", "address": "192.0.2.51", "secretFile": "secrets/nps" }
]
},
"notakey": {
"url": "https://2fa.example.com/api",
"serviceId": "c468f008-485b-4e1c-b11c-aad9672fbae1",
"clientId": "c1234567-d123-e123-f123-a12345678901",
"clientSecretFile": "secrets/api-client",
"proxyName": "proxy-1",
"messageTitle": "VPN login",
"messageDescription": "Allow {user} to connect? Gateway: {gateway}. From: {address}."
},
"logins": { "timeoutSeconds": 30, "pushesPerMinute": 2 },
"log": { "syslog": { "address": "192.0.2.80", "hostName": "proxy-1" } }
}
The paths are relative to the configuration file, so mount the whole
directory into the container (-v "$PWD:/etc/notakey:ro") and not only the
file. The process in the container runs as the user with the id 1654: make
the files readable for that user and for nobody else. On the appliance the
configuration file is written for you and can be read only by root and by the
proxy’s user.
3. Require signed packets in both directions
The Message-Authenticator attribute signs a RADIUS packet with the shared secret. Without it, someone on the network path can forge a reply (the attack published in 2024 as Blast-RADIUS). The proxy signs every reply to a gateway and every request to a RADIUS server. By default it requires a signature on every request from a gateway and every reply from a RADIUS server.
Keep that default wherever the other side can sign:
- Gateways. In our lab MikroTik RouterOS 7.25, OPNsense 26.7 and Cisco
ASA 9.24 signed their requests with their default settings. Windows RRAS
did only with
signature=enabled. A gateway that does not sign gets no answer, and the log saysmessage_authenticator_missing. - RADIUS servers. FreeRADIUS 3.2 signed its replies in our lab. The
Notakey RADIUS plugin image
notakey/radius-all:latestdid not: with the default setting its replies were dropped (server_reply_no_message_authenticator) and the login got no answer. - Replies to the gateway. Because the proxy signs every reply, you can turn on the check of replies at every gateway that has such a setting.
Where a device cannot sign, set "requireMessageAuthenticator": false on
its entry only, not for all of them. The proxy then warns at every start,
which is the reminder to update that device.
In our lab we also sent the proxy forged replies from the password server: wrong authenticators, another port, another identifier. Each of them was dropped, the gateway got no answer, and no request went to a phone.
4. Make the request on the phone say what is happening
The approval is only as good as the user’s reason to say no. A user who sees “Allow login?” approves out of habit. A user who sees their own name, the gateway and an address they do not recognise has something to judge.
messageDescription (on the appliance message_description) can contain
{user}, {gateway} (the name of the entry in clients) and {address}
(the Calling-Station-Id the gateway reports, usually the address of the VPN
client). Use all three. Not every gateway sends an address: in our lab
OPNsense did not, and the text then says unknown. The gateway name still
tells the user which door is being opened.
Tell users the one rule that matters: a request you did not start is somebody else with your password. Deny it and change the password.
5. Limit how often a phone can be asked
A request reaches a phone only after the RADIUS server has accepted the password. Someone who wants to wear a user down with requests therefore already has the password, and the proxy limits what they can do with it:
- one request per user waits at a time;
logins.pushesPerMinuterequests per user and minute, 3 by default;- after a denial, the same login is refused without the phone for
logins.replyCacheSeconds(30 seconds by default).
In our lab the fourth login in a minute was refused at once, without a request on the phone. Lower the limit with care: a VPN client that dials again right after a denial makes a new login, and so does each half of the MikroTik REST login, which in our lab asked the phone twice.
The proxy reuses an approval for a repeat of the same login (for 10 seconds by default) only when the gateway reports who is calling (Calling-Station-Id). Without it, anyone who knew the password could ride on the user’s approval. In our lab an approval was not reused for a request without Calling-Station-Id.
6. Align the timeouts, and never list the RADIUS server as a fallback
A gateway gives up when its RADIUS timeout runs out, and most defaults are a
few seconds. Set the gateway’s timeout to the time the user has
(logins.timeoutSeconds, on the appliance vpn_message_ttl) or a little
more. Where the gateway cannot wait that long, lower the proxy’s time, so
that the request disappears from the phone when the gateway has stopped
listening. The
proxy manual
lists what we saw with four gateways.
Do not give a gateway the RADIUS server itself as a second server beside the proxy. The proxy does not answer while the user decides. The gateway takes that as an outage, turns to the next server, and the login passes with the password alone.
7. Keep the RADIUS traffic on a network you control
Message-Authenticator protects packets against forgery, not against reading. With PAP, which many VPN gateways use towards RADIUS, the password travels hidden only by the shared secret. Keep the path between gateways, proxy and RADIUS server inside a network you control, or inside a tunnel. Do not send it across the internet.
The way from the proxy to the Notakey API is HTTPS, and the proxy checks the
server’s certificate (chain, dates, name) with no setting to turn that off.
Plain HTTP is taken only with allowInsecureHttp, and the proxy warns at
every start. It is meant for a lab, or for an API on the same host as the
proxy; do not use it across a network.
Open only what is needed: UDP 1812 from the gateways to the proxy (1813 if accounting is on), UDP 1812 from the proxy to the RADIUS servers, TCP 443 from the proxy to the API, and UDP 514 to the log collector if you use syslog.
8. Plan for the day it does not work
The proxy has no switch that lets logins through without the phone. That is on purpose, and it means you need a plan before you need it:
- Two proxies. Give each gateway two proxies as its RADIUS servers: two hosts, or two nodes of an appliance cluster. One can be updated while the other serves. In our lab each node of a cluster created its own API credentials at start, and a node restarted its proxy with the full gateway list while the other two nodes were down. We have not yet tested a real gateway failing over between two nodes.
- The same gateway timeout as above. A gateway that turns to the second proxy while the user is still deciding at the first causes a second request on the phone.
- An emergency account on each gateway that does not use RADIUS: a long password, kept sealed, limited to managing the gateway, and watched in its log. That is the way in when the whole authentication service is down.
A user who lost a phone is not an emergency of the proxy: onboard the new device in the authentication server. Nothing changes at the proxy.
9. Send the log somewhere, and read it
The proxy writes one line per login with the result, the user, the gateway
and how long it took, and a counters line once a minute while anything
changes. With log.syslog (on the appliance through ap.config) the lines
go to your collector as well. They travel as clear text over UDP and carry
user names, so keep that path on a network you control. Events worth an
alert:
- the counter
dropped_unknown_sourcegrowing: something you did not list is talking to the proxy (it has no log line of its own, only the counter); message_authenticator_wrong: a secret differs, or someone sends forged requests;push_limited: a user is getting more requests than a person makes;api_not_readyorserver_not_answering: logins are failing or about to.
The checklist
- Every gateway listed in
clientsby its own address;ap.allow_any_addressoff. - A long random secret per gateway; in a container you run yourself, secrets in files readable only by the proxy.
- Message-Authenticator required from every gateway and server that can send it; exceptions named one by one.
- The phone text shows
{user},{gateway}and{address}. pushesPerMinuteat 3 or lower; users know to deny what they did not start.- Gateway timeouts at least
logins.timeoutSeconds; the RADIUS server is not a fallback server of the gateway. - RADIUS traffic only on a network you control; HTTPS to the API.
- Two proxies, and a tested emergency account on each gateway.
- The log goes to a collector, with alerts on the events above.
ntk ap validate(or--validatefor the container) ends without warnings you have not decided to accept.
Cisco ASA, MikroTik and pfSense guides that apply this list to one gateway each are on the way.