Showing posts with label NetScaler Gateway. Show all posts
Showing posts with label NetScaler Gateway. Show all posts

Wednesday, December 31, 2014

How to Force Sessions through NetScaler Gateway

It always happens. You start a project with a clear direction and wham, you get a curve ball. Something new pops up out of no where and you have to quickly scramble to address this well timed [sarcasm] addition and try to stay on schedule. Better yet, have the schedule already very aggressive based on a customers deadline of which you cannot go past or the gates of hell, otherwise known as the project managers fury come raining down and... OK, I'm being a bit over dramatic, but you get the idea.

The above scenario happened to me (minus the project managers fury) not too long ago during a project that had an unusually  aggressive time line. I had to deploy a full XenApp environment to several hundred users spread across 3 (maybe more) continents. This in itself is not complicated or hard, it was the time line that provided the stress as there was little wiggle room for surprises.

Sure enough, as with most projects, there are surprises. This surprise was a bit more than what I wanted. I discovered, that the VLAN housing the XenApp environment, created by the client, was not accessible by any other location and was not able to be so because of an internal configuration they had. Not only this, they wanted to direct all sessions through NetScaler Gateway on the public side, but keep all the benefits of pass-through authentication, and pretty much everything else that makes sure an shortcut is presented on the users desktop with the published application and all they have to do is launch the shortcut.

My requirements were:

  • Have all sessions directed through NetScaler Gateway on the public Internet.
  • Keep pass-through authentication in place.
  • Have users access a VLAN that they cannot access.
  • Be able to view network metadata in Director per session.
My first thought was how in the world was I going to keep pass-through authentication? I knew that not too long ago NetScaler Gateway does have the ability for pass-through authentication using kerberos. But, because of the time line, we did not have time to deal with that solution. Next, I came across StoreFront optimal gateway feature which fit exactly with what I was trying to accomplish as well as all my requirements could still be kept and it was simple to implement. The work flow for this setup is as follows:


  1. Citrix Receiver launches and contacts StoreFront for single-sign-on.
  2. StoreFront retrieves the published resource list from a Citrix Delivery Controller and forwards this to the endpoint.
  3. Citrix Receiver now sees the published resources available.
  4. The user clicks on the published resource and the application is launched over NetScaler Gateway.
  5. All session traffic runs through NetScaler Gateway.
The StoreFront optimal gateway feature allows the Citrix Reciever to connect to StoreFront and then when the user launches a session, StoreFront directs the session through NetScaler Gateway of your choosing. Pass-through authentication works as you are authenticating against StoreFront and STA's are used when sessions are started through NetScaler Gateway. To combat the problem of users unable to access the XenApp VLAN, all I had to do was move the load balanced virtual server on NetScaler to a VLAN which all users had access. Problem solved, and quickly.

To configure StoreFront optimal gateway:

  1. Get the following information:
    1. The name of the farm as found in the StoreFront "Manage Delivery Controllers" section. Remember that XenApp used to have farms and not sites? Don't confuse this with the site name.
    2. Name of the NetScaler Gateway appliance as found in StoreFront "NetScaler Gateway" settings. I am talking about the logical name, not the URL, so whatever the name column has.
    3. The NetScaler Gateway URL for users to use. To direct users to the public IP, I had the internal DNS A record for the NetScaler Gateway site point to the public IP.
    4. And of course, the STA URLs. I would hope at least two.
  2. You need to modify the web.config file which is by default in C:\inetpub\wwwroot\Citrix\[store]\web.config. Keep in mind it is the store name, not the storeweb directory. Make a backup of the web.config file. Did I mention to make a backup of the web.config file? 
  3. Open the web.config file with a text editor (notepad or whatever) and search for optimalGatewayForFarmsCollection. This is the section you want to modify.
  4. Modify the text below with the information collected found in bold:


Save the file and perform the same steps on any other StoreFront servers you use and you should be set.

This post was written in reference to the following platforms and versions:

  • StoreFront 2.6
  • XenDesktop 7.6
  • NetScaler 10.5 Build 53.9

Sources:

Citrix Systems, Inc.. (Jul 21, 2014). How to Force Connections through NetScaler Gateway Using  Optimal Gateways Feature of StoreFront [Article]. Retreived from http://support.citrix.com/article/CTX200129

Friday, May 30, 2014

Book Review: Implementing NetScaler VPX


Recently, I had the pleasure of reading "Implementing NetScaler VPX" written by Marius Sandbu and published by Packet Publishing. Packet Publishing had asked me to read the book and provide a review. Before I begin, I want to give you a bit of my background to help understand my point of view. I am a consultant and have been architecting, implementing, and administering Citrix products since MetaFrame 1.8. In most of my projects, NetScaler is involved and I am architecting the integration and/or implementation which touches on many different aspects of the client environment, not just their XenApp or XenDesktop environment. NetScaler can be a complex subject as it bridges between systems and network.

Author

"Implementing NetScaler VPX" is written by Marius Sandbu who is a Consultant and Trainer in Norway. He has been heavily involved with Microsoft for over 9 years, during that time he was awarded a Microsoft MVP title for his involvement in the Microsoft community.

Overview


Again, NetScaler is a complex subject, and depending on what you are trying to accomplish, it can be very complex. But most clients that I run into initially start of with NetScaler because they want secure remote access to their XenApp or XenDesktop environment. With this in mind, I was wondering how the book would be laid out, and Marius Sandbu used the most common approach many of my clients take.

Marius starts out with an overview of NetScaler, platforms, editions, features, and modes. Brief scenarios are used to help identify when you would use a certain platform or edition. In the same chapter he walks you through a base setup. Then he proceeds to review networking components. One of the bits I really did like is that Marius opted to not use the wizards, and used command line instead. Running through wizards is great and easy, but it doesn't give you the same understanding when you have to perform the steps in order on your own. And of course, I am a command line junkie, so I was glad he opted for this input method.

Now, NetScaler Gateway makes its appearance in the book. In implementing NetScaler Gateway, you can gloss over some nice features, and just get it up and running. But, Marius decided not to go that route. He first does an overview of the features and dives right in to deploying ICA Proxy using StoreFront. Most deployments I have done use ICA proxy, but there are a few that needed a SSL VPN and Marius goes over these steps as well. One bit of information I was glad to see included is the NetScaler out-of-the-box SSL vulnerability fix as well as how to test this for this vulnerability.

Up next is load balancing. Oh boy do I love load balancing. To help the reader get a better understanding of the subject, Marius starts of with load balancing of a generic web application. This is a good primer before heading into the next sections of load balancing Citrix products. Prior to NetScaler 10.1 load balancing TFTP, namely for Provisioning Services, was a task and not easily understood. But after NetScaler 10.1 came out load balancing TFTP became as easy as load balancing DNS. Marius of course included the section on how to load balance TFTP, as well as other topics outside the realm of Citrix that are commonly configured with NetScaler. Second to load balancing Citrix services and setting up NetScaler Gateway is almost always load balancing Exchange. Now, Exchange load balancing changes with each version of Exchange that is released. Marius goes over what is needed to load balance an Exchange 2013 environment. He also touches on load balancing SharePoint 2013 and SQL.

The next subject covered is compression and caching. He does a great overview of these subjects. Now, if you have seen caching at work, give it a try as it can be eye opening. For example, a query that takes 60 seconds to process can be cached and returned to the client within seconds. Compression is a must read, especially if you are front ending web services to clients.

High availability (HA) and global server load balancing (GSLB). These are simple ideas to grasp, but GSLB in particular can be difficult to implement if you have never done so before. Now Marius does show you how to configure HA, but only does an overview of GSLB. Next, Marius goes on to explain how to perform traffic analysis. I really like that Marius included this in his book, although it doesn't take up much room, it is a must know for anybody who implements or administers NetScaler. Then finally, Marius touches on app firewall.

Impressions


I honestly did enjoy this book. The way Marius laid out the subjects, even the order he chose, and the level of depth of the subjects was just right. NetScaler goes much deeper than this book, but for the intended audience, the amount of depth is perfect. I highly recommend this book, if you are just starting out with NetScaler, or even if you have been working with NetScaler.

Thursday, March 1, 2012

(Updated) Page Hangs at agesso.jsp After Logging in Through Access Gateway on NetScaler 9.3


This is an update to my original post.  I've decided to update this post to include some more troubleshooting tips to help resolve this issue.  I have seen this error a few times and as of now each time was a different problem.  The previous article was posted here.

Step 1: Verify STA / XML servers are responding

  1. Verify the STA URL.  The URL should be in the following format: http[s]://[FQDN of STA server]/scripts/ctxsta.dll
  2. Confirm you can reach the XML service:
    1. Start your favorite telnet client
    2. Open a session to the FQDN of your STA server on the port which your XML service is running
    3. You should receive some sort of response, which verifies the XML service is responding
  3. If steps 1 and 2 are failing, or you are still having issues, check the event log on the STA servers for any issues and check to make sure all your services that are set to automatic are started.
At one customer site, I found an issue with the XML service not responding on one of the servers.  I also found other issues on that server, the SID was not randomized causing authentication issues.  So I performed a Sysprep on that server to randomize the SID and re-add it to the domain.  After the server was back online the XML service was responding correctly.  For more detailed information on how to sysprep a server please see the section Solution 1: How to generalize a computer SID.

Step 2: Check the Web Interface log on the NetScaler

  1. Start your favorite SSH client
  2. Open a session to the NetScaler
  3. Type shell
  4. Type cd /var/wi/tomcat/logs
  5. There will be a bunch of files named localhost.[date].log.  Find the log file with the most recent date and open it.
  6. Scroll down to the bottom of the file to see the most recent entries and look for any errors or issues.
I found an issue here in one instance with the following error message:

..."Event Log ID: 18001 A communication error occurred while attempting to contact the Access Gateway authentication service at https://[fqdn of Access Gateway]/CitrixAuthService/AuthService.asmx.  Check that the authentication service is running.  The message reported by the underlying platform was: ; nested exception is: You have not chosen to trust "GTE Cybertrust Global Root", the issuer of the server's security certificate"...

With the above error, the problem was that the Web Interface call back to Access Gateway isn't working because the Java the certificate wasn't being imported to the java trusted store.  This was verified when I went to the Web Interface in question on the NetScaler with the Access Gateway attached and the option "Trust SSL Certificates" was selected but when you next through the options you get to the end and you get the following error:

"Import SSL certificate failed.  Following command execution failed: ./export_cert.sh"...

So at this point I needed to manually add the certificate as a trusted certificate in the java store.  Please see the section Solution 2: How to manually add a trusted certificate in the java store.

Solution 1: How to generalize a computer SID

The steps below will not delete any data on the computer. But, make sure your data is backed up before proceeding.
  1. Remove the computer from the domain.
  2. Navigate to: c:\Windows\System32\sysprep\sysprep.exe.
  3. The System Preparation Tool will open.
  4. Under System Cleanup Action, select Enter System Out-of-Box Experience (OOBE).
  5. Make sure the Generalize checkbox is selected.
  6. Under Shutdown Options, select Reboot.
  7. The server will then reboot and the SID will be generalized.
  8. Go through the normal system setup steps.
  9. Add the server back to the domain.
Solution 2: How to manually add a trusted certificate in the java store

  1. Open your favorite SSH client and open a session to your NetScaler.
  2. Access the shell by typing: shell and press enter.
  3. Backup your existing java store:
    1. Type: mv /var/wi/java_home/lib/security/cacerts /var/wi/java_home/lib/security/cacerts.bak
    2. Modify the export_sh.sh file:
      1. You can use WinSCP or if you are familiar with a Linux text editor to modify /netscaler/wi/export_cert.sh.
      2. Find line STOREPASS=
      3. Type in a 6 digit keystore password after STOREPASS= (e.g. STOREPASS=abc123)
      4. Save the file.
      5. Copy the file:
        1. cp /netscaler/wi/export_cert.sh /var/wi/
    3. Modify the rc.netscaler file to make these changes persistent across reboots:
      1. You can use WinSCP or if you are familiar with a Linux text editor to modify /netscaler/rc.netscaler.
      2. Enter the following line: cp /var/wi/export_cert.sh /netscaler/wi/export_cert.sh.
    4. Add the certificate to your store:
      1. Please note, the certificate you need is in the X.509 format, not PEM.  So you will need to grab a copy of your certificate in the X.509 format but you do not need to export the private key.
      2. Copy the X.509 certificate to your NetScaler in the following directory: /var/wi/java_home/bin
      3. In the SSH shell session, type: cd /var/wi/java_home/bin.
      4. Type the following command to import the X.509 certificate: ./keytool -import -trustcacerts -file [certificate file name] -alias [certificate file name] -keystore /var/wi/java_home/lib/security/cacerts.
      5. You will be prompted to enter the keystore password which you defined earlier in the export_cert.sh file.
      6. When prompted Trust this certificate? [no] type yes.

This post was written in reference to the following platforms and versions:

  • Citrix Web Interface 5.4
  • Citrix NetScaler 9.x
  • Citrix XenApp 6.5
  • Microsoft Windows 2008 R2

Sources:

Citrix Systems, Inc.. (March 26, 2014). How to Manually Configure Certificate Trust in Web Interface for NetScaler [Article]. Retreived from http://support.citrix.com/article/CTX127615