Перейти к содержимому

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.

PlatformSoftwareModesWhat was verified
Windows Server 2022 RD Gateway + local NPS10.0.20348MFA onlymstsc 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 proxy10.0.20348MFA onlyForwarding 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.

First factorFixed to MFA only. RD Gateway checks the user’s password itself and sends none to OkYouIn.
Second factorApproval 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 timeoutmstsc shows only its generic “Remote Desktop can’t connect to the remote computer” error, never OkYouIn’s message.
Client IPNot available. RD Gateway sends no Calling-Station-Id, so rule conditions on the client network do not apply.
NAS-IdentifierRD Gateway sends none; the application has none and is identified by its source address.
  1. 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.

  2. 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.

  3. Back up NPS before changing it (step 2 below does this). The export holds the shared secrets — keep it safe.

The example uses 192.0.2.10 for OkYouIn.

  1. Install the role. Install-WindowsFeature RDS-Gateway -IncludeManagementTools also 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.

  2. Back up NPS, add OkYouIn as a remote RADIUS server and harden NPS (PowerShell, elevated):

    Terminal window
    Install-WindowsFeature RDS-Gateway -IncludeManagementTools
    New-Item -ItemType Directory -Force C:\nps-backup
    netsh nps export filename=C:\nps-backup\before.xml exportPSK=YES
    netsh nps add remoteservergroup name=OkYouIn
    netsh nps add remoteserver remoteservergroup=OkYouIn address=192.0.2.10
    netsh nps set remoteserver remoteservergroup=OkYouIn address=192.0.2.10 authport=1812 authsharedsecret="<SHARED-SECRET>" requireauthattrib=YES
    netsh nps set requiremsgauth all=enable
    netsh nps set limitproxystate all=enable

    In the NPS console this is RADIUS Clients and Servers → Remote RADIUS Server Groups → OkYouIn, with “Request must contain the message authenticator attribute” on.

  3. 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 nps accepts at most 30, so use the console.

  4. 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).

  5. 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 .rdp files you distribute:

    gatewayhostname:s:<RD-GATEWAY-FQDN>
    gatewayusagemethod:i:1
    gatewayprofileusagemethod:i:1
    promptcredentialonce:i:1

Users still need to be in Remote Desktop Users on the target computer.

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.

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.

  1. Connect with mstsc using a forced-gateway .rdp file. After the Windows credentials, approve the push on the phone.

  2. In OkYouIn, Logging ▸ RADIUS log shows the request from the gateway’s address with the outcome.

  3. 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.

SymptomLikely cause
Every request rejected with nas_identifier_mismatchA NAS-Identifier was set on the application; RD Gateway sends none — clear it.
Approvals arrive but the connection already failedThe 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 connectRDP cannot show a prompt; give them a push method or e-mail links.
Users get two MFA promptsThe target hosts also run the OkYouIn Windows logon agent. Protect the gateway or the hosts, not both — see Windows logon.