How to Add Drop-Down Menu with Domain Names on Logon Page of NetScaler Gateway with Carbon Theme

How to Add Drop-Down Menu with Domain Names on Logon Page of NetScaler Gateway with Carbon Theme

book

Article ID: CTX118657

calendar_today

Updated On:

Description

This article describes how to add a drop-down menu with domain names on the logon page for NetScaler Gateway and send the authentication request to the appropriate server.

By default, the NetScaler Gateway does not have a drop-down menu with domain information.

Users migrating from Access Gateway Advanced Edition might rely on this for their user base. With this configuration on the NetScaler Gateway, the administrator has the capability of even sending the authentication request to the correct Active Directory domain controller based on the domain information. It also allows an easier configuration without the need to configure groups and any domain modifications.


Instructions

Note: This procedure is provided as-is. The Citrix technical support might ask you to reverse these changes when issues related to authentication occur before troubleshooting the issue. The file mentioned in this article is found in the /netscaler/ns_gui/vpn directory.

This section contains the following procedures:

    Create a cookie on the computer of the user

    To create a cookie on the computer of the user, complete the following procedure:
    Note: The name of the cookie is domainvalue and it is created to store the name of the domain chosen from the drop-down menu.

    1. Download index.html to your local machine.

    2. Open the file for editing with preferred document editor.

    3. Locate the following section (the last line should be line 40):

      <!-- Logon box -->
      <tr class="mainPane">
          <td class="carbonBoxBottom" valign="bottom">
                      <script language="javascript" type="text/javascript">
                  documentWriteGlowBoxUpper();
                  </script>
      
      
    4. Add the following in the next line:

      <SCRIPT type="text/javascript">
        function getCookie(name) { // use: getCookie("name");
          var re = new RegExp(name + "=([^;]+)");
          var value = re.exec(document.cookie);
          return (value != null) ? unescape(value[1]) : null;
        }
        var today = new Date();
        var expiry = new Date(today.getTime() + 28 * 24 * 3600 * 1000); // plus 28 days
        var expired = new Date(today.getTime() - 24 * 3600 * 1000); // less 24 hours
        function setCookie(name, value) { // use: setCookie("name", value);
          document.cookie=name + "=" + escape(value) + "; path=/; expires=" + expiry.toGMTString();
        }
        function storeValues(form) {
          setCookie("domainvalue", form.domainvalue.value);
          return true;
        }
      </SCRIPT>
      
      
    5. The next two lines should read as follows:

      <FORM method="post" action="/cgi/login" name="vpnForm" autocomplete="off" style="margin:0"
      onSubmit="clean_name_cookie(this);">

      Insert the following string into the onSubmit tag: storeValues(this);"
      The HTML code should now read as follows:

      <FORM method="post" action="/cgi/login" name="vpnForm" autocomplete="off" style="margin:0"
      onSubmit="return storeValues(this); clean_name_cookie(this);">
      
      

      Create the drop-down menu

      To create a drop-down menu, complete the following procedure:

      1. On the same index.html page, locate the following line:

        <SCRIPT language=JavaScript>ns_showpwd();</SCRIPT>
        
        
      2. Add the following line immediately after the preceding line:

        <TR><TD align=center><SPAN class="CTXMSAM_LogonFont" style="padding-right:10px;">Domain:</SPAN></TD> <TD><select name="domainvalue" size="1" style="width: 100px;"> <option value="DOMAIN1">DOMAIN1</option> <option value="DOMAIN2">DOMAIN2</option> </select> </TD></TR>
        
        

        Note: DOMAIN1 must be replaced with the name you prefer for the domain. You can add as many domains as you want by adding <option value="DOMAIN">DOMAIN</option> before the </select> section.

      3. Save the changes and copy the file to the /netscaler/ns_gui/vpn directory.
        Note: Ensure that you back up the original file.

        Create a procedure to ensure that the Custom Page endures a restart

        To create a procedure to ensure that the custom page endures a restart, complete the following tasks:

        1. Connect to the appliance using an SSH client such as PuTTY.

        2. Type shell.

        3. Create a directory on the hard drive to save the custom file:
          mkdir /var/customizations

        4. Run the following command to copy the modified page to the new directory:
          cp /netscaler/ns_gui/vpn/index.html /var/customizations/

        5. Create a startup script file called rc.netscaler in the /nsconfig directory if it does not exist:
          cd /nsconfig
          touch rc.netscaler

        6. Run the following command to copy the commands to the rc.netscaler file:
          echo cp /var/customizations/index.html /netscaler/ns_gui/vpn/index.html >> /nsconfig/rc.netscaler

        Modify the authentication profile to be based on the presence of the cookie instead of the default true value

        To modify the authentication profile to be based on the presence of the cookie instead of the default "true-value", ensure that the expression syntax is similar to the configuration, as shown in the following screen shot:

        Configure Authentication policy

        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 describes how to add a drop-down menu with domain names on the logon page for NetScaler Gateway and send the authentication request to the appropriate server.

        Additional Information

        CTX131978 - How to Add a Drop-down Menu with Domain Names on Logon Page of NetScaler Gateway with Symphony Theme
        CTX203873 - How to Add Drop-Down Menu with Domain Names on Logon Page for NetScaler Gateway 11.0 64.x and Later
        Citrix Documentation - Customizing the User Portal on NetSaler Gateway 11.0
        Citrix Blog - Re-Branding NetScaler 11 with the StoreFront 3.0 Portal Theme
        For information on customization option available on NetScaler 10.0 and 10.1, refer to Citrix Blog - Citrix Access Gateway – UI Theme Customization.

        The following is a logon page with the domain name:

        User-added image