Request certificate for Remote Desktop Gateway

Below are general steps to purchase/install a Trusted SSL Certificate for use with Remote Desktop Gateway (RDGW) and Remote Desktop Session Host (RDSH) that are installed on the same/single server in workgroup mode.  We created this based on using a Trusted SSL Cert from GoDadddy.  Our clients can ask for a more detailed tutorial of this process too.

1. Assumes you have already installed the RDSH and RDGW roles on the remote Windows Server.

2. You need to have the subdomain/url/domain name that you will purchase the ssl cert for to forward to the IP address of the server.  In this example, we want “RDP.widgets.com” to point to IP address of the server xxx.xxx.xxx.xxx. You already own the domain name for widgets.com (which can be any domain name you own through a registrar like GoDaddy).

Go to the parent domain name in GoDaddy, click on Manage DNS, go to zone file section and click “add record”.  Add “A (Host)” record type and add “RDP” (or whatever you are using in front of the domain name) which will make it be “RDP.widgets.com” and the IP address of the remote server.  Click ok/save and after a few minutes you will be able to ping the full name/url and it should return the IP address of the remote server.

We have tried to use Let’s Encrypt (free certs expiring every 60 days) but found it difficult to use with Windows IIS at the time.

3. Create Certificate Request on the remote Windows Server using IIS Manger

Open IIS Manager on remote Windows Server, in the left side pane under connections, click on your server name.  In the middle window, double-click “server certificates” icon which will open the server certificates screen showing your currently used self-signed cert.  In the far right screen under actions, click “create certificate request”.

Fill out the appropriate fields including, Common name (use the exact name of the url you are requesting for the ssl cert – i.e. “RDP.widgets.com”), Organization and Organization unit could be your legal name, State should be spelled out and not abbreviated, and County can be US.  We recommend changing the bit length to 2048 for crypto.  Create filename for CSR (CSR=certificate signing request) which will be saved in c:\windows\system32 unless you specify full path in the file name request.

4. Purchase SSL Cert at GoDaddy by inputting CSR info

Go back into your GoDaddy account. Purchase a SSL cert (we did DV type in this example) at GoDaddy ($79.99/yr although may be able to find discount code for year 1).  After purchase go back into GoDaddy account to SSL cert and press “setup”. 

Click on New Certificate, then choose “Input a CSR” (you will use the CSR you generated on the remote server via IIS Manager).  Do not select “Domain hosted with GoDaddy”.  Type in domain/url field for what you want the SSL cert to issued for, for example “RDP.widgets.com”. 

Copy in the CSR text from the file you created on the remote server, using the entire text including “—-BEG…—- and —-END…—-” characters.  Select the default GoDaddy SSL algorithm.

You will see the SSL Cert fields change to pending verification and you will have to wait approximately 20 minutes for it to change to ready/certificate issued.

5. Download SSL Cert from GoDaddy and copy it to remote server and install it in IIS Manager

Click download, choose IIS (Windows) and it will download the .zip file with certificate.  Copy this .zip file to the remote server and extract it.

Go back into remote Windows Server, IIS manager, the server certificates icon/section and click on “complete certificate request” under actions.

Attach the security cert from the godaddy zip file and create friendly name (the friendly name is just to identify the certificate).  You can put it in the personal store.  For our example, we were able to skip doing anything with the intermediate cert and only had to attach the actual security cert.  In order to attach the security cert, we had to change the file type selection dropdown to show all files. Press OK and exist IIS manager.  Make sure you keep track of the ssl cert expiration date so you renew/reinstall prior to that date otherwise you will be locked out of the remote server.

6. Modify settings on remote Windows Server in RD Gateway Manager to use new SSL cert

Open Remote Desktop Gateway Manager, then properties and the SSL Cert tab.  Click on existing cert from personal store and select your new SSL cert.  Press Import, which will restart Gateway services and your current connection will be disconnected.  You will then have to connect with the new url/ssl cert name in your local RDP connection client. 

Go back to your local RDP connection client (shortcut on desktop if you created that previously) and change IP address in computer name field (general tab) and gateway name (advanced tab) from IP address to the url/ssl cert/fqdn you created – for example, “RDP.widgets.com”

7. Modify setting on remote Windows Server for RD Session Host to use new SSL cert (if needed)

If you see the warning that certificate name doesn’t match and isn’t from a trusted CA, then it is because the new GoDaddy cert isn’t being used for the RDSH (it is being used for RDGW but not RDSH even though they are both on the same server) and the self signed cert is still being used for the RDSH.  This seems to almost always happen in our experience.    (Note: this warning is different than then the “unknown publisher” warning you may see because you are using a custom rdp connection file shortcut…for the “unknown publisher” warning you can click “don’t ask me again…” if you don’t want to see that message again.)

To fix this, use powershell (run as admin) below to change the certificate used for RDSH (NOT GW) to the GoDaddy SSL cert you purchased.  Type each line separately below exactly as shown except the thumbprint info in row 3 will need to be added after the row 1 info has generated (after the first line/row is entered, you will see the thumbprint for the new ssl cert which you will need to enter for line 3 between the “”). 

Get-ChildItem “Cert:\LocalMachine\My”

$PATH = (Get-WmiObject -class “Win32_TSGeneralSetting” -Namespace root\cimv2\terminalservices)

Set-WmiInstance -Path $PATH -argument @{SSLCertificateSHA1Hash=”ENTER-THUMBPRINT-HERE“}

Next try to connect again and you should not see the Certificate error message anymore.

Lastly, some clients have noted that they had to enter username as SERVERNAME\username when connecting via rdp connection client, so if you are still having issues, try that method in the rdp file too.

RD Gateway

Remote Desktop Gateway is used to allow secure connections using HTTPS from computers outside the corporate network.  The configuration has been simplified in Windows Server 2012 and 2012 R2. 

It offers the following benefits.

  • Secure connections via HTTPS (Port 443 Default) without the use of a VPN
  • Enables connections through firewalls without opening additional ports IE:3389

It is recommended to always use certificates from a public Certificate Authority or an internal Certificate Authority.

Self-signed certificates will show as untrusted as you will see in the example below.  In the real world you would deploy using certificates from a CA your client trusts.

To start deployment of the RD Gateway, it is required you already have an RDS Deployment.

Select RD Gateway
 

Select the server name below and click the arrow to add it to the right hand column.

Type the external FQDN or URL that users will be typing in their web browser to reach the RD environment.

In the below example the external clients would type rdpfarm.com to reach the RD Gateway.  For an encrypted

connection to be successful the certificate name must match the FQDN.
 

Click Next.

The information at the bottom lets us know the deployment was successful however a certificate needs to be configured.

If you click "Configure certificate" you will be able to configure each roles needed certificate, however for informational

purposes we will navigate to those settings an alternate way to show you how to get it to it in the future should you ever need

to change certificates.
 

Click Close.

Next click on Tasks and click Edit Deployment Properties.
 

From here we can edit many of the deployment settings.  Our concern now is specifying a certificate.
 

Since  all roles are installed on a single server in this deployment, we need to be sure to use the same certificate

for Web Access and Gateway.  Here it is possible to run in to some issues if using self-signed certificates

which we will discuss later.
 

Since we do not have a purchased certificate or a CA of our own, we will click Create new certificate

Pick the certificate name, which needs to match the external FQDN of the server.  We have the option to store it

on the hard drive where we can import it to other machines.  Not necessary here but a good idea if you back up

your certificates separately.

You must allow the certificate to be added to the destination clients Trusted stores.
 

Click OK.

Click Apply.

As you can see I have applied the cert to both Roles here and it is Untrusted.   This once again is because it is

a self-signed certificate and should not be used in production.
 

Click OK when finished.

Had a certificate from a Public CA or my own CA been issued and used.  It would look more like what you see here.

This is what you want for any real-world setup.
 

You have now successfully configured the RD Gateway.   Further configuration and authorization policies can be done from Administrative Tools > Remote Desktop Services > Remote Desktop Gateway Manager.

Microsoft Windows 2012 Server, Microsoft Windows 2012 Server R2

All fields are required unless marked otherwise.

Thank you for your feedback.

Sorry, our feedback system is currently down. Please try again later.

Comments cannot contain these special characters: <>()\

Video liên quan

Chủ đề