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.