May 13, 2014

Customizing Access Gateway using a custom theme in Netscaler 10.1

Reblogged from blog.codestructure.com:

I am often asked for help by my customers on changing the theme of the Netscaler Gateway.  There is a lot of confusion out there on how it actually works and what you need to do to get a custom theme to work.  In this example, I will be customizing the "Green Bubble" theme and converting it to a "Custom" theme.

Beginning in the v10 enhancement release (10.0.71.6014.e) a pull-down was added to the global settings of each Netscaler Gateway allowing you to make a global change to the UI Theme by changing this setting.  This configuration option was made standard once Maintenance and Enhancement releases were merged in v10.1.



The files that make up the Access Gateway exist at /var/netscaler/gui.  They are read
from a symbolic link at /netscaler/ns_gui.  When  you switch from "Default" to "Green Bubble" the symbolic link stays the same and the "Green Bubble" theme files are used instead of the "Default" files.



You will see the file location when you list the directory at /netscaler:



The "Default" and "Green Bubble" files are intermingled.  Choosing one of the two themes will allow us to customize the theme and add our own backgrounds and logos.

In this case, say I wanted to change the logo and background of the "Green Bubble" theme.  I would replace /var/netscaler/gui/vpn/media/logo_notagline.png and bg_bubbles.jpg.  Open a browser and test.

So if I stopped there, you would see your customizations in the browser but they would not persist through a reboot.  Previous to the custom theme feature you would have had to put the custom files in /var somewhere and configured the rc.netscaler file to copy them at boot time.

This is where the Custom option comes in and things get awesome.

When you switch from "Green Bubble" to "Custom".



The Netscaler changes the symbolic link from ns_gui -> /var/netscaler/gui to ns_gui -> /var/ns_gui_custom/ns_gui.



The custom theme itself is expected to be a single tar file in a user created directory called /ns_gui_custom.  The file needs to be called customtheme.tar.gz, and most importantly, the stored path has to be such that when the Netscaler extracts the file contents they are at /var/ns_gui_custom/ns_gui.



So here are the steps to customizing:

1. Backup your config.

logon, and type:

shell
cd /nsconfig
cp ns.conf ns.conf.save

or snapshot your appliance in vpx.  Or both.

1. Customize your theme.  Like I said before the most common changes are logo and background -  /var/netscaler/gui/vpn/media/logo_notagline.png and bg_bubbles.jpg.

2. Create the directory - /var/ns_gui_custom

mkdir /var/ns_gui_custom

3. Create the customtheme.tar.gz file.  In order to get all the needed files into the theme and keep the stored path at the right level, you will change to the /netscaler directory:

cd /netscaler

and then tar the contents of the /ns_gui symbolic link to the custom theme file:

tar -cvzf /var/ns_gui_custom/customtheme.tar.gz ns_gui/*

Head back into the Netscaler GUI, expand the Netscaler Gateway node, select Global Settings.  First column in the right pane is settings, click on "Change Global Settings"

Switch to the 'Client Experience' tab, click the pull-down box to set the UI Theme to be 'Custom' then click 'ok'.  There is a pause as the Netscaler extracts the custometheme.tar.gz file to the custom directory.

Save your changes.  Test.

If something has gone south, you can easily revert by:

Logon and type:

shell
cp /nsconfig/ns.conf.save /nsconfig/ns.conf
exit
save config
reboot

or snapshot revert.

No comments:

Post a Comment