Windows RD Gateway (NPS)
This page is the step-by-step setup for the built-in Windows RD Gateway template. For how it works, what it can and cannot do, and how it compares with the Windows logon agent, read RD Gateway first. RADIUS concepts are in RADIUS.
Verified on
Section titled “Verified on”| Platform | Software | Modes | What was verified |
|---|---|---|---|
| Windows Server 2022 RD Gateway + local NPS | 10.0.20348 | MFA only | mstsc from Windows 10 through the gateway: Telegram approve, deny and 55-second timeout; Web Push (without number matching) approve |
| Windows Server 2022 NPS as a RADIUS proxy | 10.0.20348 | MFA only | Forwarding to OkYouIn with the e-mail link; waits of up to 55 seconds passed through |
The central-NPS variant (below) was verified for the NPS → OkYouIn part only, not end to end with an RD Gateway.
What works
Section titled “What works”| First factor | Fixed to MFA only. RD Gateway checks the user’s password itself and sends none to OkYouIn. |
| Second factor | Approval only: Telegram, Web Push (no number matching) or the e-mail link (sent at once, with Approve / Deny; needs the public base URL). RDP cannot show prompts. |
| On deny or timeout | mstsc shows only its generic “Remote Desktop can’t connect to the remote computer” error, never OkYouIn’s message. |
| Client IP | Not available. RD Gateway sends no Calling-Station-Id, so rule conditions on the client network do not apply. |
| NAS-Identifier | RD Gateway sends none; the application has none and is identified by its source address. |
Before you start
Section titled “Before you start”-
In OkYouIn, open Access ▸ Applications ▸ Add application and pick Windows RD Gateway. Under Sources, add the address of the RD Gateway server (or of the central NPS server, see below). The Connect tab shows the commands below with real values.
-
Make sure the users have a push method or e-mail with links (see MFA methods), and that the public base URL is set if you use e-mail links.
-
Back up NPS before changing it (step 2 below does this). The export holds the shared secrets — keep it safe.
Configure the RD Gateway
Section titled “Configure the RD Gateway”The example uses 192.0.2.10 for OkYouIn.
-
Install the role.
Install-WindowsFeature RDS-Gateway -IncludeManagementToolsalso installs NPS, and RD Gateway sends its requests to this local NPS (RD CAP store “Local server running NPS”, the default). No RADIUS client entry is needed. -
Back up NPS, add OkYouIn as a remote RADIUS server and harden NPS (PowerShell, elevated):
Terminal window Install-WindowsFeature RDS-Gateway -IncludeManagementToolsNew-Item -ItemType Directory -Force C:\nps-backupnetsh nps export filename=C:\nps-backup\before.xml exportPSK=YESnetsh nps add remoteservergroup name=OkYouInnetsh nps add remoteserver remoteservergroup=OkYouIn address=192.0.2.10netsh nps set remoteserver remoteservergroup=OkYouIn address=192.0.2.10 authport=1812 authsharedsecret="<SHARED-SECRET>" requireauthattrib=YESnetsh nps set requiremsgauth all=enablenetsh nps set limitproxystate all=enableIn the NPS console this is RADIUS Clients and Servers → Remote RADIUS Server Groups → OkYouIn, with “Request must contain the message authenticator attribute” on.
-
Set the 60-second timeout in the console. Open the OkYouIn server in the group → Load Balancing tab → “Number of seconds without response before request is considered dropped” = 60. The default is 3, and a push takes up to a minute: slower answers count as dropped, and too many of them mark OkYouIn unavailable.
netsh npsaccepts at most 30, so use the console. -
Forward the gateway’s requests. Policies → Connection Request Policies → open “TS GATEWAY AUTHORIZATION POLICY” (created with the role) → Settings → Authentication → Forward requests to the remote RADIUS server group OkYouIn. NPS then no longer evaluates the RD CAP: OkYouIn’s policy decides who may connect. RD Gateway still enforces the RD RAP (which computers).
-
Force clients through the gateway. With “Bypass RD Gateway server for local addresses” checked, computers on the LAN connect directly and skip OkYouIn. Put these lines in the
.rdpfiles you distribute:gatewayhostname:s:<RD-GATEWAY-FQDN>gatewayusagemethod:i:1gatewayprofileusagemethod:i:1promptcredentialonce:i:1
Users still need to be in Remote Desktop Users on the target computer.
Variant: a central NPS server
Section titled “Variant: a central NPS server”If RD Gateway uses Properties → RD CAP Store → Central server running NPS: add the RD Gateway there as a RADIUS client (with Message-Authenticator), put the OkYouIn remote server group and the forwarding policy on that NPS server, and use the NPS server’s address as the application’s source in OkYouIn.
BlastRADIUS
Section titled “BlastRADIUS”NPS on Windows Server 2022 with requiremsgauth enabled sends Message-Authenticator in every Access-Request, so
Strict is safe and recommended for this application. New applications start at Standard. OkYouIn’s
replies carry Message-Authenticator.
Verify
Section titled “Verify”-
Connect with mstsc using a forced-gateway
.rdpfile. After the Windows credentials, approve the push on the phone. -
In OkYouIn, Logging ▸ RADIUS log shows the request from the gateway’s address with the outcome.
-
If the connection fails, the log tells a deny or timeout apart from a problem on the Windows side: an Accept in OkYouIn followed by a refusal means the user is missing from Remote Desktop Users, or the RD RAP does not allow that computer.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Likely cause |
|---|---|
Every request rejected with nas_identifier_mismatch | A NAS-Identifier was set on the application; RD Gateway sends none — clear it. |
| Approvals arrive but the connection already failed | The Load Balancing timeout is still 3 seconds. |
| LAN users are never asked to approve | ”Bypass RD Gateway server for local addresses” is on; force the gateway in the .rdp file. |
| TOTP users cannot connect | RDP cannot show a prompt; give them a push method or e-mail links. |
| Users get two MFA prompts | The target hosts also run the OkYouIn Windows logon agent. Protect the gateway or the hosts, not both — see Windows logon. |