Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

 Windows OS Hub / Windows Server 2016 / Securing RDP Connections with Trusted SSL/TLS Certificates

August 27, 2020 Group PoliciesWindows 10Windows Server 2016

Securing RDP Connections with Trusted SSL/TLS Certificates

In this article we’ll show how to use trusted SSL/TLS certificates to secure RDP connections to Windows computers or servers in an Active Directory domain. We will use trusted SSL certs instead of default self-signed RDP certificates (then using a self-signed RDP certificate, the user receives a warning that the certificate is not trusted when connecting to the host). In this example, we will configure a custom RDP certificates template in the Certificate Authority and a Group Policy to automatically issue and bind an SSL/TLS certificate to the Remote Desktop Services.

Contents:
  • Remote Desktop Connection (RDP) Self-Signed Certificate Warning
  • Create an RDP Certificate Template in a Certificate Authority (CA)
  • How to Deploy RDP SSL/TLS Certificates using Group Policy?
  • Signing an RDP File with a Trusted TLS Certificate Thumbprint

Remote Desktop Connection (RDP) Self-Signed Certificate Warning

By default, to secure an RDP session Windows generates a self-signed certificate. During the first connection to an RDP/RDS host using the mstsc.exe client, a user sees the following warning:

The remote computer could not be authenticated due to problems with its security certificate. It may be unsafe to proceed.
Certificate error: The certificate is not from a trusted certifying authority.

To proceed and establish an RDP connection, a user has to click Yes. To prevent the RDP cert warning from appearing every time, you can check the “Don’t ask me again for connections to this computer” option.
Remote Desktop Connection (RDP) warning - Certificate is not from a trusted certifying authority

In this case the RDP certificate thumbprint is saved in the CertHash parameter of the registry key with the RDP connection history on a client (HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Servers\). If you have hidden the warning that the RDP server could not be verified, remove the certificate thumbprint from the registry to reset the settings.

rdp CertHash value in the registry

Even though a self-signed certificate is used to establish a connection, your RDP session is secure and your traffic is encrypted.

Create an RDP Certificate Template in a Certificate Authority (CA)

Let’s try to use a trusted SSL/TLS certificate issued by a corporate certificate authority to secure RDP connections. Using this certificate, a user can authenticate an RDP server when connecting. Suppose, that a corporate Microsoft Certificate Authority is already deployed in your domain. In this case, you can configure automatic issue and connection of certificates to all Windows computers and servers in the domain.

You must create a new type of certificate template for RDP/RDS hosts in your CA:

  1. Run the Certificate Authority console and go to the Certificate Templates section;
  2. Duplicate the Computer certificate template (Certificate Templates -> Manage -> Computer -> Duplicate);
    dublicate computer cetrificate template in windows ca
  3. In the General tab, specify the name of new certificate template – RDPTemplate. Make sure that the value in the Template Name field matches the Template display name;
    create CA template to issue RDP certificates
  4. In the Compatibility tab, specify the minimum client version used in your domain (for example, Windows Server 2008 R2 for the CA and Windows 7 for your clients). Thus, stronger encryption algorithms will be used;
  5. Then, in the Application Policy section of the Extensions tab, restrict the use scope of the certificate to Remote Desktop Authentication only (enter the following object identifier — 1.3.6.1.4.1.311.54.1.2). Click Add -> New, create a new policy and select it;
    ca template for Remote Desktop Authentication 1.3.6.1.4.1.311.54.1.2
  6. In the certificate template settings (Application Policies Extension), remove all policies except Remote Desktop Authentication; create Remote Desktop Authentication certificate policy template
  7. To use this RDP certificate template on your domain controllers, open the Security tab, add the Domain Controllers group and enable the Enroll and Autoenroll options for it;
    allow Enroll and Autoenroll certificates to Domain Controllers
  8. Save the certificate template;
  9. Then in the Certificate Authority mmc snap-in, click Certificate Templates folder and select New -> Certificate Template to Issue -> choose the template you have created (RDPTemplate);
    new rdp certificate template in certification authority

How to Deploy RDP SSL/TLS Certificates using Group Policy?

Now you need to configure a domain GPO to automatically assign RDP certificates to computers/servers according to the configured template.

It is supposed that all domain computers trust the corporate Certificate Authority, i.e. the root certificate has been added to the Trusted Root Certificate Authorities using GPO.
  1. Open the Domain Group Policy Management console (gpmc.msc), create a new GPO object and link it to the OU containing RDP/RDS servers or computers to automatically issue TLS certificates to secure RDP connections;
  2. Go to the following GPO section Computer Configuration -> Policies -> Administrative Templates -> Windows Components -> Remote Desktop Services -> Remote Desktop Session Host -> Security. Enable the Server Authentication Certificate Template policy. Specify the name of the CA template you have created earlier (RDPTemplate);
    configuring Server Authentication Certificate Template GPO options
  3. Then in the same GPO section, enable the Require use of specific security layer for remote (RDP) connections policy and set the value SSL for it; group policy parameter Require use of SSL security layer for remote (RDP) connections
  4. To automatically renew an RDP certificate, go to the Computer configuration -> Windows settings -> Security Settings -> Public Key Policies section of the GPO and enable the Certificate Services Client – Auto-Enrollment Properties policy. Check the “Renew expired certificates, update pending certificates and remove revoked certificates” and “Update certificates that use certificate templates” options; rdp certificate Auto-Enrollment group policy settings
  5. If you want your clients to always verify the RDP server certificate, you must configure the Configure Authentication for Client = Warn me if authentication fails policy (Computer Configuration -> Policies -> Administrative Templates -> Windows Components -> Remote Desktop Settings -> Remote Desktop Connection Client);
  6. If needed, open the incoming RDP Port TCP/UDP 3389 using firewall policies;
  7. Then update group policy settings on the client computer, launch the computer certificate console (Certlm.msc) and make sure that the Remote Desktop Authentication certificate issued by your CA has appeared in the Personal -> Certificates section.
If the new Group Policy settings have not been applied, use the gpresult tool and this article to diagnose.

issued RDP certificates

To apply the new RDP certificate, restart Remote Desktop Services:

Get-Service TermService -ComputerName mun-dc01| Restart-Service –force –verbose

After that, when connecting to a server using RDP, you won’t see a request to confirm that the certificate is trusted (to see the request, connect to the server the certificate is issued for using its IP address instead of the FQDN). Click View certificate, go to the Details tab and copy the value in the Thumbprint field.
get rdp certificate Thumbprint

In the Issued Certificates section of the Certification Authority console, you can make sure that an RDPTemplate certificate has been issued for the specific Windows server/computer. Also check the certificate Thumbprint value:

get certificate Thumbprint via the certsrv mmc console

Then compare this thumbprint with the certificate thumbprint used by the Remote Desktop Service. You can view the value of the RDS certificate thumbprint in the registry (HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations, the TemplateCertificate parameter) or using the following PowerShell command:

Get-WmiObject -Class "Win32_TSGeneralSetting" -Namespace root\cimv2\terminalservices|select SSLCertificateSHA1Hash
get rdp certificate thumbprint using powershell

Then, when connecting to the remote desktop of any Windows host, you won’t see a warning of an untrusted RDP certificate.

Signing an RDP File with a Trusted TLS Certificate Thumbprint

If you don’t have a CA, but you do not want your users to see warnings when they connect to an RDP/RDS host, you can add the certificate to the trusted ones on user computers.

Get the value of the RDP certificate thumbprint as described above:

Get-WmiObject -Class "Win32_TSGeneralSetting" -Namespace root\cimv2\terminalservices|select SSLCertificateSHA1Hash

Use this fingerprint to sign the .RDP file with the RDPSign.exe tool:

rdpsign.exe /sha256 25A27B2947022CC11BAFF261234567DEB2ABC21 "C:\ps\mun-dc01.rdp"

Then add this thumbprint to the trusted certificates on user computers using GPO. Specify the thumbprints (separated by a semicolon) in the Specify SHA1 thumbprints of certificates representing trusted .rdp publishers policy in Computer Configuration -> Policies -> Administrative Templates -> Windows Components -> Remote Desktop Settings -> Remote Desktop Connection Client.

Remote Desktop Connection Client policy, adding trusted .rdp publishers

To configure the transparent RDP logon without entering a password (RDP Single Sign On), configure the Allow delegation defaults credential policy and specify RDP/RDS host names in it (see this article on how to do it).

2 comments
0
Facebook Twitter Google + Pinterest
previous post
Unable to Add/Remove Role: Windows Server Requires Restart
next post
Fix: VPN not Working on Windows 10

Related Reading

How to Connect VPN Before Windows Logon

November 14, 2023

Using WPAD (Web Proxy Auto-Discovery Protocol) on Windows

November 7, 2023

Zabbix: How to Get Data from PowerShell Scripts

October 27, 2023

Tracking Printer Usage with Windows Event Viewer Logs

October 19, 2023

How to Use Ansible to Manage Windows Machines

September 25, 2023

2 comments

Harry B. November 29, 2022 - 4:51 pm

thx for the guide, it’s valuable information.
one minor thing… how were you able to sign any RDP files with certificates created according to the guide?
my research suggests, that one would have to add client/server authentification purposes to the template for signing to function properly. see here: https://social.technet.microsoft.com/Forums/en-US/732c2e27-6d24-47dc-91da-ae46d831f4b4/rdpsignexe-unable-to-use-certificate-0x8007000d?forum=winserverTS

rdpsign keeps bugging me with error 0x8007000d .

any idea?

Reply
admin January 9, 2023 - 3:46 am

Try to use the latest version of the rdpsign tool (https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/rdpsign)

If you attempting to sign an RDP file with an SHA-1 certificate on the newer version of Windows, you will encounter the following error:
Unable to use the certificate specified for signing. Error Code: 0x8007000d
The rdp file could not be signed. Error Code: 0x8007000d

Use the following command to sign the RDP file:
rdpsign.exe /sha256 yourcertthummbprint

Reply

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • How to Connect VPN Before Windows Logon

    November 14, 2023
  • Removing Azure Arc Setup Feature on Windows Server 2022

    November 9, 2023
  • Using WPAD (Web Proxy Auto-Discovery Protocol) on Windows

    November 7, 2023
  • Send Emails with Microsoft Graph API and PowerShell

    November 6, 2023
  • Zabbix: How to Get Data from PowerShell Scripts

    October 27, 2023
  • Tracking Printer Usage with Windows Event Viewer Logs

    October 19, 2023
  • PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

    October 15, 2023
  • Reset Root Password in VMware ESXi

    October 12, 2023
  • How to Query and Change Teams User Presence Status with PowerShell

    October 8, 2023
  • How to Increase Size of Disk Partition in Ubuntu

    October 5, 2023

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • How to Hide or Show User Accounts from Login Screen on Windows 10/11?
  • Configuring Proxy Settings on Windows Using Group Policy Preferences
  • How to Disable NetBIOS and LLMNR Protocols in Windows Using GPO?
  • Changing Desktop Background Wallpaper in Windows through GPO
  • Restricting Group Policy with WMI Filtering
  • Windows: Block Remote Network Access for Local User Accounts
  • How to Disable/Remove Thumbs.db File on Network Folders in Windows?
Footer Logo

@2014 - 2023 - Windows OS Hub. All about operating systems for sysadmins


Back To Top