Customize Logon Page for Each NetScaler Gateway Virtual Server and Redirect Users Based on Each FQDN

Customize Logon Page for Each NetScaler Gateway Virtual Server and Redirect Users Based on Each FQDN

book

Article ID: CTX123736

calendar_today

Updated On:

Description

This article helps you customize a different logon page for each VPN virtual server hosted on NetScaler Gateway, and configure the NetScaler appliance to redirect users to the customized page based on the FQDN.

Prerequisites

The NetScaler Gateway must be licensed for the Responder feature to address this scenario. To ensure that the NetScaler Gateway appliance is licensed for the Responder feature, complete one of the following tasks:

  • From the GUI, expand the System node and click Licenses. In the Licenses page, verify if the Responder feature is enabled, as shown in the following screen shot:

    User-added image

  • Run the following command from the Command Line Interface:
    >show license

    User-added image

    Verify if the Responder feature is enabled, as shown in the preceding screen shot.

Background

There are situations where more than one VPN virtual servers are hosted on the NetScaler Gateway appliance. You might want to customize a different logon page for each VPN virtual server.

In this example the following VPN virtual servers are hosted on the NetScaler Gateway appliance. VPN virtual server "example.com" is configured for Lightweight Directory Access Protocol (LDAP) authentication. The logon page is displayed as shown in the following screen shot:

User-added image

When VPN virtual server "example.org" is configured for RADIUS and LDAP authentications, the logon page is displayed as shown in the following screen shot:

User-added image

You must change the passcode field to password on the VPN virtual "server example.com".

User-added image

However, if the logon page is customized, it affects the VPN virtual server "example.org". It is recommended to keep the logon page unchanged, otherwise it appears as shown in the following screen shot:

User-added image

This article helps you customize a different logon page for each VPN virtual server hosted on NetScaler Gateway, and configure the NetScaler appliance to redirect users to the customized page based on the FQDN


Instructions

To customize a different logon page for each VPN virtual server hosted on the NetScaler Gateway appliance and configure the NetScaler appliance to redirect users to the customized page based on the FQDN, complete the following procedure:

  1. To enable the Responder feature on the NetScaler appliance, complete one of the following tasks:
    From the Command Line interface, run the following command:
    >enable feature Responder

    OR

    From the GUI, navigate to System > Settings. In Modes and Features, select Configure Advanced features (ensure that you select the Responder feature), click OK, and then click Close.

    User-added image

  2. You can create multiple index.html and login.js files for multiple logon page for each VPN virtual server.

    1. Navigate to /netscaler/ns_gui/vpn folder using a secure copy utility like WinSCP. Retain the default index.html and login.js files for VPN virtual server "example.org".

      User-added image

    2. Create index_modified.html and login_modified.js files for the VPN virtual server "example.com".

      User-added image

    3. Using a text editor modify the line 7 of index_modified.html file to refer to the new login_modified.js file as shown in the following screen shot:

      image.png

  3. Customize the logon page for each VPN virtual server (example.com and example.org) 

  4. To configure a Responder Action where you redirect users accessing https://example.com to the modified index.html file, complete one of the following tasks:

    From the command line interface run:
    >add responder action redirect_remotesite redirect "\"https://example.com/vpn/index_modified.html\""

    OR

    From the GUI:

    1. Select Responder > Actions > Add.

    2. Enter a name for the action.

    3. Select Redirect under Type*.

    4. Enter the target URL as "https://example.com/vpn/index_modified.html".
      Note: Ensure that you include the quotes.

      User-added image

  5. To configure a Responder Policy to define the condition that redirects users, complete one of the following tasks:
    Note: Ensure you include the URL condition, otherwise you might experience issues such as loops.

    From the command line interface, run the following command:
    >add responder policy redirect_remotesite_policy "HTTP.REQ.HOSTNAME.EQ(\"example.com\") && HTTP.REQ.URL.CONTAINS(\"index.html\")" redirect_remotesite_action

    OR

    From the GUI, complete the following procedure:

    1. Select Responder > Policies > Add.

    2. Enter a name for the policy.

    3. In the Action field, select the action you defined previously.

    4. In the Expression field, enter the following expression:
      HTTP.REQ.HOSTNAME.EQ("example.com") && HTTP.REQ.URL.CONTAINS("index.html")

      User-added image

  6. To bind the policy globally, complete one of the following tasks.

    From the command line interface, run the following command:
    >bind responder global redirect_remotesite_policy 1 END -type REQ_DEFAULT

    OR

    From the GUI, complete the following procedure:

    1. Go to Responder > Policies > Click Policy Manager.

    2. Select Default Global > Insert Policy and select the Responder Policy you created.

    3. Double-click the Priority field to define the Priority.

    4. Click Apply Changes.

    5. Click Close.

      User-added image

    • Users accessing https://example.org are redirected to https://example.org/vpn/index.html.

      User-added image

    • Users accessing https://example.com are redirected to https://example.com/vpn/index_modified.html.

      User-added image

  7. To make the changes persistent after you restart the appliance, complete the following tasks:

    1. Create a new folder to hold the customized logon files of NetScaler Gateway virtual server.
      For example, in this case the folder is named as customizations and stored in the /var directory:

      User-added image

    2. Using a text editor, create the text file named rc.netscaler with the following single line of content:
      #cp -R /var/customizations/* /netscaler/ns_gui/

      Note: Make sure there are no blank lines after this line.

  8. Connect to the appliance using WinSCP, and copy all the folders from directory /netscaler/ns_gui to directory /var/customizations.

  9. Using WinSCP, copy the rc.netscaler file to the /nsconfig folder of the appliance.

  10. Restart the appliance.

Environment

The above mentioned sample code is provided to you as is with no representations, warranties or conditions of any kind. You may use, modify and distribute it at your own risk. CITRIX DISCLAIMS ALL WARRANTIES WHATSOEVER, EXPRESS, IMPLIED, WRITTEN, ORAL OR STATUTORY, INCLUDING WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NONINFRINGEMENT. Without limiting the generality of the foregoing, you acknowledge and agree that (a) the sample code may exhibit errors, design flaws or other problems, possibly resulting in loss of data or damage to property; (b) it may not be possible to make the sample code fully functional; and (c) Citrix may, without notice or liability to you, cease to make available the current version and/or any future versions of the sample code. In no event should the code be used to support ultra-hazardous activities, including but not limited to life support or blasting activities. NEITHER CITRIX NOR ITS AFFILIATES OR AGENTS WILL BE LIABLE, UNDER BREACH OF CONTRACT OR ANY OTHER THEORY OF LIABILITY, FOR ANY DAMAGES WHATSOEVER ARISING FROM USE OF THE SAMPLE CODE, INCLUDING WITHOUT LIMITATION DIRECT, SPECIAL, INCIDENTAL, PUNITIVE, CONSEQUENTIAL OR OTHER DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Although the copyright in the code belongs to Citrix, any distribution of the sample code should include only your own standard copyright attribution, and not that of Citrix. You agree to indemnify and defend Citrix against any and all claims arising from your use, modification or distribution of the sample code.

Issue/Introduction

This article helps you customize a different logon page for each VPN virtual server hosted on NetScaler Gateway, and configure the NetScaler appliance to redirect users to the customized page based on the FQDN

Additional Information