Jump to content
Welcome to our new Citrix community!
  • Citrix NetScaler, Federated Authentication and Google - NetScaler Config


    cugcblogs

    dave-brett.png by David Brett, CTP

    In this part of this series we are going to tie it all together with the NetScaler Config.

    This post assumes that you have a configured NetScaler Unified Gateway set up on your NetScaler build using the inbuilt Unified Gateway Wizard

    The Google oAuth Policy on Citrix NetScaler

    You will now need to instruct the NetScaler to authenticate you with the Google oAuth Services.  Log into your NetScaler and navigate to Security - AAA Application Traffic - Policies - Authentication - Basic Policies - OAuth

    Click Add to insert a new policy

    Give the policy a name, fill out your Client ID and Client Secret you saved earlier and enter the following information in the Authorization Endpoint, Token Endpoint and ID Token Decrypt Endpoint fields

    Authorization Endpoint: https://accounts.google.com/o/oauth2/auth?client_id=

    YOUR_CLIENT_ID

    &response_type=code&scope=openid%20emailToken Endpoint: https://accounts.google.com/o/oauth2/tokenID Token Decrypt Endpoint: https://www.googleapis.com/oauth2/v1/tokeninfo

    Click ok to create the policy

    brett010717-01.png.5ca0e0e91cf0953312bff64468479057.png

    Next navigate to Security - AAA Application Traffic - Policies - Authentication - Advanced Policies - Policy and click add to insert your new policy

    Give your policy a name, set the action type to OAUTH and select your new action from the drop down list.  For the expression type in true

    brett010717-02.png.e0adba7d436b6f465c18853f8de5e141.pngbrett010717-03.png.94b35cedc12166b5581bee74f554f1f8.png

    The AAA vServer

    Next you will need to bind your new policy to an AAA vServer for authentication.  This is where we will pass the incoming requests for login.chromesummit.com for authentication, then hand them back to the NetScaler Unified Gateway from there.

    Navigate to Security - AAA Application Traffic - Virtual Servers and Add a new Virtual Server

    Give your Virtual Server a name, a free IP Address and assign the relevant certificate for the domain you are going to give your users (login.chromesummit.com - this was part of the pre-reqs in part 1).  Then add an Advanced Authentication Policy and select your new Google oAuth Policy.

    brett010717-04.png.cb56c4cfbf5545c2c49dcee480c10d20.pngbrett010717-05.png.6edc6c936cc97140fa7e23430a63657e.png

    Make sure the server shows as up

    brett010717-06.png.12473647a4889da73ccf393f6bd3426c.png

    We now need to create a Load Balancing vServer to act as a pass through for the Content Switch and AAA vServer.

    The Load Balancing vServer

    Navigate to Traffic Management - Load Balancing - Virtual Servers and click Add to configure your new Virtual Server.

    Give your vServer a name and a free IP Address, assign the same certificate that you gave to your AAA vServer and bind it to an "Always Up" Service.  Essentially this is a service configured on the NetScaler that will not go down.  Just define a new service on the NetScaler to ping itself (127.0.0.1)

    brett010717-07.png.8a25c3ebc5448410a82995b129be7822.pngbrett010717-08.png.129e091220aa0e30f9d1453477ad2aa0.png

    You now need to add your Authentication vServer to the Load Balancing vServer.  Add Authentication from the options on the right-hand side of the screen and select form based authentication.

    Fill out auth.h.1 as the Authentication FQDN, select Authentication Virtual Server from the drop-down and select your AAA vServer from the list provided

    brett010717-09.png.687d9d5098f0b7195f046d050f7a69b2.png

    The final thing you will need to do is add a responder policy to the vServer to forward you to the VPN login page.  This is because after authentication from Google you will be passed back to the root of the vServer and you want to forward the user to the NetScaler Gateway with the AAA credentials for SSO.

    Click Policies and click on Add.  Select Responder from the list, give the policy a name and click the + to add an action.

    Give the action a name, the type will be Redirect and the expression will be the following (substitute login.chromesummit.com to your Google login URL):

    "https://login.chromesummit.com/vpn/index.html"

    Set the Response Status Code to 302 and click on OK.  This will take you back to the policy screen.

    For the policy Expression enter the following:

    "http.req.url.eq("/")
    brett010717-10.png.940c345ed190434f85a17b05a5cfbc2c.png

    Click ok and thats it for the vServer.

    Bind the vServer to the AAA vServer

    Navigate to Security - AAA Application Traffic - Virtual Servers and open up your AAA vServer

    Scroll down until you see Form Based Virtual Servers and ensure that your vServer is listed there, if it is not then bind it to the AAA Server

    brett010717-11.png.08e70bb3236a9e0c93b164b0a93d555b.png

    Content Switching Policies

    At this stage, you have your Google Authentication Provider set up, your AAA vServer and Load Balancing vServer set up and linked and your responder policy to forward your users to the NetScaler Gateway once authenticated.  You now need to set up your Content Switching Policies to direct the traffic the way you want.

    This is what I am trying to achieve.

    • If a user types in citrix.chromesummit.com, then go straight to the NetScaler Gateway
    • If the URL hitting the Content Switch contains any of the AAA Traffic, "/cvpn" in the URL or "/citrix" in the URL then direct them to the NetScaler Gateway
    • If a user types in login.chromesummit.com, then go to the Load Balanced vServer (AAA Auth vServer is attached to this - and will redirect to Google for authentication)

    I am going to achieve this by using a Content Switching policy and a Default vServer on the Content Switch.

    Navigate to Traffic Management - Content Switching - Actions and create an action to redirect traffic to your NetScaler Gateway

    brett010717-12.png.7f5ca7c88a9529658c020e092fcfe5ca.png

    Navigate to Traffic Management - Content Switching - Policies

    Create a policy with the following expression:

    HTTP.REQ.URL.PATH.SET_TEXT_MODE(IGNORECASE).STARTSWITH("/cvpn") || HTTP.REQ.URL.PATH.SET_TEXT_MODE(IGNORECASE).STARTSWITH("/citrix") || HTTP.REQ.URL.CONTAINS_ANY("aaa_path") ||HTTP.REQ.HOSTNAME.CONTAINS("citrix.chromesummit.com")

    Substitute your URLs in place of mine.

    Bind this policy to your action you created in the previous step.

    brett010717-13.png.f0c702bd872eff2fd0336a930492dae8.png

    Next open up your Content Switch (This should have been created when you created your Universal Gateway during the pre-reqs stage) and locate the Content Switching Policy Binding section.

    Bind your policy as a priority of 100

    brett010717-14.png.b0cc0955e98e0cbf211b4e7278386885.png

    Set your Load Balancing vServer as the Default Load Balancing Virtual Server

    brett010717-15.png.30c7b6faa5086f3bd957aa5a94cdc2a6.png

    Unbind the SSO Domain in the NetScaler Gateway Session Policy

    Locate the Web session policy assigned to your NetScaler Gateway and under the published applications tab, remove the SSO Domain name.  The web session policy will have _WB_ in the name.

    brett010717-16.png.21cd5d3f115e6b4218c633dbee33d20a.png

    At this point your NetScaler should be configured to direct the traffic for citrix.chromesummit.com and login.chromesummit.com to different login providers.

    Fallback Policy

    One thing I did notice is that if you are already signed into Google and try to goto the login.chromesummit.com login page it will SSO you into the gateway but then when the apps and desktops should be displayed, it will try to launch the Java VPN client.  From what I can see, this is because it is not hitting any of the HTTP headers defined in the session policies you have assigned to your gateway.

    To get around this, we can create a fall back policy to handle any sessions that are uncovered in the 2 automatically created session profiles.

    Navigate to NetScaler Gateway - Policies - Session and click to add a new Session Policy

    Give the policy a name, e.g., fallback, set the expression to ns_true and bind the same web profile (_WB_) that you edited in the previous step.

    brett010717-17.png.4c666efa49d1422197a0cb9f11d4b098.png

    Next you will need to bind this as an available policy on the NetScaler Gateway, make sure that the priority of this is the lowest so that if a session policy is not met this will act as the default policy for the gateway

    brett010717-18.png.9918b64d238fcf3f81e18b5bdc3a4125.png

    NetScaler Gateway Login Once

    One thing that you will need to check is that the login once option on the NetScaler Gateway is set.  To do this, navigate to NetScaler Gateway - Virtual Servers and open up your vServer.

    Click to edit the basic settings and click on the More Twisty.  Make sure there is a tick in the Login Once box.

    brett010717-19.png.738c9c5a14b435dcf15e878e2feea103.png

    Catering for Native Receiver Access on the Login URL

    Another thing we need to be aware of and cater for is that the Google users may want to use receiver to access the apps and desktops.  This will currently fail as Native Receiver will not work with the configured oAuth policy.  Therefore we will need to redirect users that use Receiver and try to hit the login.chromesummit.com URL.

    We will do this using another Content Switching Policy.

    Navigate to Traffic Management - Content Switching - Policies

    Create a policy with the following expression:

    HTTP.REQ.HOSTNAME.CONTAINS("login.chromesummit.com") && HTTP.REQ.HEADER("User-Agent").CONTAINS("CitrixReceiver")

    Bind this to the same action you used for the previous policy (re-direction to the NetScaler Gateway).

    brett010717-21.png.7cbc44c6012694860ac20b069c22a7fe.png

    Next, bind this new policy to the Content Switch as a higher priority than the previous policy

    brett010717-22.png.e568ce57e773fe2ecbc96e59f39c3b61.png

    Now if a user tries to use Native Receiver and login to the login.chromesummit.com URL, they will be redirected back to the regular NetScaler Gateway and asked for LDAP credentials.

    That's it on the NetScaler for the moment - we will revisit it later on when we tidy up the config and add some nice-to-have bits to make the user experience better.

    Thanks,

    Dave Brett (@dbretty)


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...