大网数据广告活动
远程桌面与会话

Block VPN clients that use revoked certificates on Windows Server

· 52CE 我爱测

This article shows you how to configure RRAS server to block VPN clients that use a revoked IKEv2 certificate for authentication after installing any Windows update.

This article shows you how to configure RRAS server to block VPN clients that use a revoked IKEv2 certificate for authentication after installing any Windows update.

Once the RRAS server is configured for certificate revocation, any VPN clients that attempt to use a revoked IKEv2 certificate for authentication, such as device tunnel Always-on VPNs, will be denied connection.

For more information on authentication certificates in Windows, see Certificates and trust in Windows.

Configure VPN authentication

  1. Confirm that all VPN client and RRAS server certificates have CDP entries, and that the RRAS server can reach the respective CRLs.

  2. On the RRAS server, run the following PowerShell code to set the authentication method to accept root certificates with a Subject that contains the name of your certification authority. Make sure that you replace {Your Root Certification Authority} with the name of your root certification authority.

      $cert1 = ( Get-ChildItem -Path cert:LocalMachine\root | Where-Object -FilterScript { $_.Subject -Like "*CN={Your Root Certification Authority}*" } )
      Set-VpnAuthProtocol -RootCertificateNameToAccept $cert1 -PassThru
    

Configure the RRAS server to enforce IKEv2 machine certificate revocation

  1. On the RRAS server, open a Command Prompt window.

  2. In the Command Prompt window, run the following command:

    reg add HKLM\SYSTEM\CurrentControlSet\Services\RemoteAccess\Parameters\Ikev2 /f /v CertAuthFlags /t REG_DWORD /d "4"
    
  3. Restart the Routing and Remote Access service.

Note: To disable certificate revocation for these VPN connections, set CertAuthFlags = 2 or remove the CertAuthFlags value, and then restart the Routing and Remote Access service.

Revoke an IKEv2 machine VPN client certificate

  1. Revoke the VPN client certificate from the Certification Authority.

  2. Publish a new CRL from the Certification Authority.

  3. On the RRAS server, open an administrative Command Prompt window, and then run the following commands:

    certutil -urlcache * delete
    certutil -setreg chain\ChainCacheResyncFiletime @now
    

Verify that certificate revocation is working

Note: Before you use this procedure, make sure that you enable the CAPI2 operational event log.

  1. Try to connect to the VPN by using a client that has the revoked certificate. The RRAS server should refuse the connection and display a message such as "IKE authentication credentials are unacceptable."

  2. On the RRAS server, open Event Viewer, and navigate to Applications and Services Logs/Microsoft/Windows/CAPI2.

  3. Search for an event that has the following information:

    • Log Name: Microsoft-Windows-CAPI2/Operational Microsoft-Windows-CAPI2/Operational
    • Event ID: 41
    • The event contains the following text: subject="Client FQDN" (Client FQDN represents the fully qualified domain name of the client that has the revoked certificate.)

    The <Result> field of the event data should include The certificate is revoked. For example, see the following excerpts from an event:

    Log Name:      Microsoft-Windows-CAPI2/Operational Microsoft-Windows-CAPI2/Operational
    Source:        Microsoft-Windows-CAPI2
    Date:          5/20/2019 1:33:24 PM
    Event ID:      41
    ...
    Event Xml:
    <Event xmlns="https://schemas.microsoft.com/win/2004/08/events/event">
     <UserData>
      <CertVerifyRevocation>
       <Certificate fileRef="C97AE73E9823E8179903E81107E089497C77A720.cer" subjectName="client01.corp.contoso.com" />
       <IssuerCertificate fileRef="34B1AE2BD868FE4F8BFDCA96E47C87C12BC01E3A.cer" subjectName="Contoso Root Certification Authority" />
       ...
       <Result value="80092010">The certificate is revoked.</Result>
      </CertVerifyRevocation>
     </UserData>
    </Event>
    

Source: Microsoft Learn / Windows Server documentation by Microsoft and contributors (upstream author metadata: robinharwood). Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Server documentation
适用范围
Windows Server · Source date 05/04/2023
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。