Configuring Terminal Server Gateway on Windows 2008

Terminal Services on Windows 2008 bring a new feature called “TS Gateway” that we use to connect from outside the organization to computers that use Terminal Server in the local area network. To be able to use this feature, we have to install it on a server on the network, we don't care if you have Terminal Server services installed or not. In the router/firewall we will redirect port 443tcp to this server and this in turn will redirect us to the Terminal Servers securely through 3389tcp, we can also apply certain directives to secure the connection a little more.

Terminal Server 2008

This would be a schematic of a network of Terminal Servers, so that they can be connected from the outside (Internet) to Terminal Services servers, we must install TS Gateway or Gateway in one of them, and redirect HTTPS traffic to it, and it will take us to the server we have requested when connecting, since the Gateway server uses RDP over HTTPS. For this document, the gateway server will be w2k803 and the Terminal Services server will be w2k802.

TS Gateway

To add this feature, We need to go to the server management console and add the following function: “TS Gateway”,

TS Gateway

By checking this component, the requirements you have will be installed, Of course they have to be installed, Click on “Add required features”,

TS Gateway

We can install a certificate now so that the RDP connection is encrypted with the SSL layer and is more secure, If we already have a certificate we can take advantage and install it now, otherwise, after, Checking the third option. “Following”, The installation of a certificate will be mandatory at a later date.

TS Gateway

We can now create authorization policies for the connection using TS Gateway/TS Gateway, but we will do it later from the console. “Following”,

TS Gateway

We confirm what we are going to install and click on “Install”,

TS Gateway

… We wait while it is installed…

TS Gateway

OK, Installation completed successfully, Click on “Close”,

TS Gateway

To open the Admin console, We're going to “Beginning” > “Programmes” > “Administrative tools” > “Terminal Services” > “TS Gateway Manager”.

TS Gateway

If it is the first time we open it we will see that it is totally unconfigured, it will show us different alerts. Now let's go about configuring the gateway server properties, To do this on the right-click server we are going to “Properties”. And we go over the tabs to configure it as we are interested.

TS Gateway

On the “General” We can enable a maximum number of simultaneous connections or directly disable connections through this server.

TS Gateway

On the “SSL Certificate” is where we will install an SSL certificate, we can create one from here or if we install it from the Control Panel we could choose it here. In this case, we just have to create a certificate to secure the connection, To do this, click on “Create certificate…”,

TS Gateway

Up, We must indicate the full name of this server, below where we will save a copy of the certificate that users will later install. “Accept”,

TS Gateway

Vale, “Accept”,

TS Gateway

Now we see that the screen has changed indicating that we have a certificate correctly installed, but this certificate being from an untrusted certificate authority (because we have generated it, not a certificate authority, a CA – Certificate Authority). Click on “Examine” to save a copy of the certificate in a directory where users can later install it.

TS Gateway

Select the certificate and click on “View certificate…”,

TS Gateway

On the “Details” Click on the Down button “Copy to file…”,

TS Gateway

We will get the wizard for the export of certificates, Ok, We continue it, “Following”,

TS Gateway

Mark “Do not export the private key” and “Following”,

TS Gateway

“X.509 encoded binary DER (.CER) & “Following”,

TS Gateway

Select the path where we will save it and the name. “Following”,

TS Gateway

“End” to copy the certificate to this folder.

TS Gateway

Vale, “Accept”, We will then follow this when we want to see how a user connects.

TS Gateway

Tells us where to use Terminal Services connection authorization policies (The CAP_TS) if from an NPS server ( Network Policy Server) local or a central one that will be the server of these policies. NPS is the component that replaces Microsoft Windows IAS 2003. If we will only have one Terminal Services Gateway server, it will be normal to dial local, but a central one so as not to have to duplicate policies on both servers.

TS Gateway

On the “Server Farm” we find the servers that will balance to allow access to the connections from the outside, here if we have more than one PE server is where we must add them so that the connections are balanced, Enter the name of the server and click on “Add”, Below you will see the list of the servers belonging to that farm and their status.

TS Gateway

On the “Audit” We will be able to audit all events that interest us to check the security of our systems, from seeing who connects, Who is trying to connect, Authorization errors, Access to Resources…

TS Gateway

On the “SSL Bridging Protocol” is to secure the connection if we have an ISA Server within the network or a device to establish a secure SSL connection between it and the Gateway server. We have more info for ISA HERE (at the end of the document).

TS Gateway

Now what we need to do is create two directives, a first call CAP (Connection Authorization Policies), Allows you to specify groups of users and/or computers, who can access a TS server Gateway. To create such a policy in the “Gateway Administrator” envelope “Policies” con botón derecho en “Connection authorization policies” > “Create new policy” > “Custom”.

TS Gateway

On the “General” We provide you with a policy name, for example, TS_CAP and we enable it.

TS Gateway

On the “Requirements” it will be where let's say what authentication method will be used to connect, Yes with “Password” or “Smart card”. And then we have to select a group of users to indicate who has access to connect, I have a group in the Active Directory called “TS Users” where I put the users I want to connect, Here I add it to indicate this. In addition, if we want for greater security, we can create a group in the Active Directory and put computers in it to allow only these connections from certain computers.

TS Gateway

And on the “Device redirection” we need which devices we want to be redirected by the RDP connection of Terminal, We can enable all devices, disable or customize them.

TS Gateway

Now what we need to do is create another directive, this second one called RAP (Resource Authorization Policies), allows you to specify the internal network resources that remote users will be able to access through a TS Gateway server. When you create a RAP policy, additionally, computer groups can be created and associated with the RAP policy. Remote users will have access only if they meet at least one of the conditions specified in the TS CAP and one of the TS RAP. To create such a policy in the “Gateway Administrator” envelope “Policies” con botón derecho en “Resource authorization policies” > “Create new policy” > “Custom”.

TS Gateway

On the “General” We provide you with a policy name, for example, TS_RAP and enable it.

TS Gateway

The tab “User groups”, it is the same as in the CAP directive, here we indicate groups of users to allow them connectivity using the TS Gateway. Who has access to connect, I have a group in the Active Directory called “TS Users” where I put the users I want to connect.

TS Gateway

On the “Equipment Group” we add if we are interested in any group in the Active Directory to give access to certain computers through TS Gateway.

TS Gateway

And in the “Allowed Ports” we will see which port the Remote Desktop clients will connect to the Terminal servers, We can only allow connections to the 3389, to any port or customize it.

The configuration of a Terminal Services Gateway server would be completed here, now what we are going to see is how a user who is on the Internet should connect to a Terminal Server that is within the network through the PE server.

TS Gateway

First of all, how on the Gateway server we have generated an invalid certificate, not with a valid Certificate Authority such as: VeriSign, RapidSSL,CAcert, Comfortable, Thawte… Well, on the client PC you have to install the certificate above to indicate that you trust the Issuing Entity of this certificate. To do this,, before we have saved the certificate in a directory called SHARED on the Gateway server, assuming it's shared and users can access it, About the previously generated certificate, right-click on the certificate “Install certificate”,

TS Gateway

We will get a certificate import wizard “Following”,

TS Gateway

We must check the “Place all certificates in the following store” and on the “Examine” Select “Trusted Root Issuers”, “Following”,

TS Gateway

“End” To import the certificate correctly,

TS Gateway

Confirm, “Yes”,

TS Gateway

Accept,

TS Gateway

Again, on the client PC with the certificate already installed, We open the client of “Remote Desktop Connection” (“Beginning” > “Execute” > MSTsc). Of course it has to be the version 6 of the customer, otherwise, we have to download it from the Microsoft website (http://support.microsoft.com/default.aspx/kb/925876). We go to the “Advanced options” and click on the “Configuration”. In the new window that opens we have to check “Use this TS Gateway server configuration” and in “Server Name” we indicate which is the Gateway server of the organization”.

We accept the configurations and indicate which server we are going to connect to, it will ask us for authentication before reaching the Terminal Services window for security, since I have NLA enabled (Network Level Authentication), A new type of authentication, that authenticates the user, to the client computer and the server's credentials to each other. This means that authentication is now performed before the Terminal Services session is lifted and the user is presented with the login screen. With previous Remote Desktop Connection clients 6.0, TS sessions were initiated as soon as the user clicked on “Connect”, and this creates a window of opportunity for malicious users to perform Denial of Services attacks (Two) and steal credentials via a man-in-the-middle attack (MITM).

TS Gateway

Well, we see that it would already be connected to Terminal Services, now to check if I'm doing it through the Gateway we go to the console.

TS Gateway

We open the “TS Gateway Manager” and in “Supervision” We'll see who's connected and see that they're connected to the server named w2k802.bujarra.com through the gateway server called w2k803.bujarra.com. From here we can also log out the user “Break this connection” or disconnect it “Disconnect this user”.

www.bujarra.com – Héctor Herrero – Nh*****@bu*****.cOm – v 1.0


Recommended Posts

Author

nheobug@bujarra.com
Autor del blog Bujarra.com Cualquier necesidad que tengas, Do not hesitate to contact me, I will try to help you whenever I can, Sharing is living ;) . Enjoy documents!!!