Putting it all together – Citrix XenDesktop, ADFS, Azure MFA, NetScaler Unified Gateway and Citrix FAS – Part 1

Putting it all together – Citrix XenDesktop, ADFS, Azure MFA, NetScaler Unified Gateway and Citrix FAS – Part 1

Putting it all together – Citrix XenDesktop, ADFS, Azure MFA, NetScaler Unified Gateway and Citrix FAS – Part 1

This post has already been read 16993 times!

I have long been an advocate of fronting everything with a NetScaler, I think it is an excellent way to Secure the perimeter of your network and with Unified Gateway a great way to simplify incoming firewall rules. Also, for those of us that have a lab and only 1 external IP this is a great way to present multiple public services on a single IP Address.

My network uses LDAPS and Azure MFA to secure access to my Apps and Desktops but I have always wanted to look into ADFS and the options around authentication using that and Citrix NetScaler Unified Gateway.

In this post series I will walk you through setting up ADFS for use with your NetScaler Unified Gateway, integrating this with Azure MFA and providing context aware authentication to your Gateway and in turn your Apps and Desktops.

I was going to write this as a single post but while putting together the screenshots for the ADFS part only I realised that it would be waaaay to long in a single post.  I have therefore decided to write this as a series.  This will be the intended order:

  • Setting Up ADFS and Internal Access
  • Setting Up Citrix FAS and StoreFront
  • Configuring NetScaler SAML Authentication and ADFS Proxy
  • Setting up Azure MFA
  • Configuring Context Aware Authentication
  • Making it look good!

I have used a number of resources to assist with bringing all of this together and I will reference and link to them during the posts.

The assumptions are:

  • You will need an external URL pointing to your publically available Unified Gateway. In my case I am going to use sts.bretty.me.uk
  • You will also need a public certificate on the NetScaler capable of handling this FQDN.
  • You have a Windows Server 2012 R2 Server built and ready to host the ADFS Role.
  • You have an existing Unified Gateway running.  In my case I have https://ug.bretty.me.uk up and running.

So, let’s get going with Part 1.  ADFS

Start up Server Manager from your ADFS Server and select to install the ADFS Role

01-adfs-base

Continue with the wizard until it shows you what its going to install and confirm that

02-confirm-adfs

Check to allow the server to restart if required

03-allow-restarts

nce ADFS is installed you will have to do some post configuration – you can see this by the below icon showing in Server Manager

04-configure-adfs

Click that and click to Configure the federation service

05-start-configuration

Click Next on the Welcome Screen

06-initial

Select a Domain Admin account to use for the ADFS configuration

07-current-user

Specify the service properties. So, this is the first stage of the deployment that you need to be aware of the external access to ADFS.  Make sure the certificate you have imported here is capable of authenticating SSL traffic on the EXTERNAL fqdn for your ADFS service.  In my case I am using sts.bretty.me.uk

Name the federation service name the same as your external fqdn

Give it a display name – this is not so important as this is just the text that will be displayed to the user on the login page and we will be changing this later on

08-service-properties

Specify a service account in Domain Admins that ADFS uses to communicate with Active Directory.   You can be more specific with the svc account rights but in this case I am just using the Domain Admins Group

09-service-account

Select a database type for ADFS.  Again, as this is just running in my lab I am going to use the inbuilt database, however in production you would want to use SQL

10-internal-database

Review the options

11-review-options

Allow the Pre Reqs to check and pass

12-pre-req-and-configure

Click on configure and let the wizard configure your ADFS Service for you.  Once it is finished open up the AD FS Management Tool

13-open-admin-tools

Expand AD FS – Service – Certificates

14-certificates

Here you will see the Public Certificate and 2 internal certificates auto generated by the ADFS wizard for Token Decrypting and Token Signing.  I am going to replace these with my own certificates

15-imported-certs

On the right you can click to add a new token signing or decrypting certificate.  You may get this error message

16-adfs-cert-error

If you do, open up powershell as an administrator and run the command listed

17-adfs-powershell

Then click again to import/select the token signing certificate and select your public certificate

18-adfs-token-signing

Then click again to import/select the token decrypting certificate and select your public certificate

19-adfs-decrypt-cert

Click on each of the new imported certificates and select to Set as Primary on the right

20-set-primary

Next Expand AD FS – Trust Relationships – Relying Party Trusts

21-relying-party

You need to add a trust to let ADFS know about the NetScaler Unified Gateway that will be passing over authentication requests.  Right click and select to add a new relying trust

22-add-party

Click on next and select “Manually” for setting up the Relying Party

23-manual-config

Give your party a name and description

24-description

Select AD FS profile and click next

25-adfs-profile

Click on next without importing a certificate

26-token-encryption

Check the box for Enable support for the SAML 2.0 WebSSO protocol and enter the following in the URL textbox

https://YOUR_UNIFIED_GATEWAY_FQDN/cgi/samlauth – eg: https://ug.bretty.me.uk/cgi/samlauth

27-identifier

Click Next and add the trust identifiers.

NOTE: This is important and you will have to remember the identifiers you add here as these will be needed for the NetScaler SAML Policy configuration later in this blog post series

28-identifiers-pt-2

Click next and select NO for MFA – we will be configuring this eventually but at a later time

29-no-mfa

Select to Permit all users – again you would lock this down more in production but in this case this setting should be fine

30-all-users

Click next without reviewing the settings – we will do this later in this post

31-leave-blank

Take the tick out of the Add Claims option and click Close

32-untick-claims

You will now see your Relying Party Trust listed.  We need to check that the options and all correct in this so right click your new trust and click Edit

On Identifiers check that your Unified Gateway is listed there.  I put in HTTPS:// and the straight FQDN just to be sure that the NetScaler passes over the right ID

33-check-identifiers

Select Encryption and make sure there is no certificate listed here – if there is then remove it

34-no-enc-cert

Select Signature and you will notice there is no certificate there

35-no-signing-cert

Click on Add and select an x509 formatted certificate appropriate for the external URL for ADFS

36-cert-added

Select Advanced and ensure that the Hash is SHA-256

37-advances-sha-2

Select Endpoints and make sure that the SSO endpoint you added earlier is listed there

38-endpoints

Click on Add SAML to add an endpoint for the logout action.

Select SAML Logout and POST and enter the following URL:

https://YOUR_EXTERNAL_ADFS_FQDN/logout.jsp – eg: https://sts.bretty.me.uk/logout.jsp

39-saml-logout

Click on OK and OK again to close the Relying Party Identifier.  Now you need to add the claims for this relying party that the NetScaler will be passing over to ADFS.  Right click the relying party and click on Edit Claim Rules

Click to Add the first rule

40-claim-rules

Select Send LDAP Attributes as Claims and click Next

41-ldap-claim-rule

Give it a name, select Active Directory as the Attribute Store and select User Principle Name on the left and Name ID on the right (shown below)

42-name-id

Click Finish then click to add another rule

43-claim-1

Select Send Claims using a custom rule and click next

44-custom-claim

Give it a name and paste the following as the custom rule

 => issue(Type = "logoutURL", Value = "https://YOUR_EXTERNAL_ADFS_FQDN/adfs/ls/", Properties["http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/attributename"] = "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified");

Replace YOUR_EXTERNAL_ADFS_FQDN with your own external FQDN – eg: sts.bretty.me.uk

45-send-logout-url

Click Finish and you will see your 2 claims listed

46-claims-in-place

Click ok and you will see your configured Relying Party listed

47-new-rely-party

Internal Access to the ADFS service will be required to ensure that there is a context aware login experience for the user.  If I ping my adfs server it resolves to 192.168.0.94

I need sts.bretty.me.uk to resolve to this internally

48-adfs-server

Open up DNS Management and add a new lookup zone for sts.bretty.me.uk and add a blank host record with the IP Address of your ADFS Server

49-internal-lookup

Open up a browser and navigate to the URL (https://sts.bretty.me.uk/adfs/ls/IdpInitiatedSignOn.aspx) and you should see your ADFS Login Screen shown below

50-sign-in

Thats it, ADFS is up and running and we can start to think about the other moving parts in this blog series.  In the next part I will talk about the Citrix FAS Service and setting that up ready for ADFS and XenDesktop.

Once you have this all set up you can move onto Part 2 – Setting up Citrix FAS and StoreFront

Laters,

b@m