5.8.2.1 Enabling SSL in Combo Setup

 

This section explains how you can enable SSL communication in a Web NMS combo setup.
 



 

Creating Key, Certificate, and Truststore files for BE Server and Transport Provider Implementation

 

The first step in setting up the SSL communication is to create the key, certificate, and truststore files that are required for establishing the secure connection for the communication layer. Run the script file available under <Web NMS Home>/bin/createCertificate.sh/bat for creating the certificate (for the Web Server of BE) and copying the files to the respective folders.

 

The createCertificates.sh/bat script does the following:

 

Note: The certificate files server.cer, server.keystore, and Truststore.truststore will be created under the <Web NMS Home>/Certs folder.  The server.keystore and Truststore.truststore is copied to <Web NMS Home>/conf folder and server.keystore is copied to <Web NMS Home>/apache/tomcat/conf folder.

 

 

Changing the Configuration Files

 

Certain configuration file modifications are required for enabling SSL. To enable SSL communication, modify the <Web NMS Home>/conf/NmsProcessesBE.conf file and the <Web NMS Home>/apache/tomcat/conf/backup/server.xml  file.

 

NmsProcessesBE.conf

 

Do the following changes in this file located in <Web NMS Home>/conf directory.

Server.xml
 

Un-comment the following entry in the <Web NMS Home>/apache/tomcat/conf/backup/server.xml file. 

 

serverparameters.conf

 

Configure the NMS_FE_SECONDARY_PORT in the serverparameters.conf file present under <WebNMS_Home>/conf directory. Ensure that the NMS_FE_SECONDARY_PORT value is different from the PORT_TO_LISTEN value specified in <WebNMS_Home>/conf/transportProvider.conf for SSL protocol.

 

 

Changing the Server and Client-Side Script Files

 

There are certain script files in Web NMS that require to be edited for enabling SSL (https) as the default communication mode. The configurations to be done in the script files vary for different OS, namely Windows, Linux, or Solaris. The script file changes to be done for the different OS are given below:

Script Files Changes in Windows Machines

 

The below given server-side and the client-side script files require modification for enabling SSL communication, by default, for the Windows OS machines.

 

startnms.bat: This file, located in <Web NMS Home>/bin directory, is used to start the Web NMS BE server. Make the following modifications (marked in bold face) in this file in the com.adventnet.nms.startnms.NmsMainBE process:
 

1. Modify the -Dwebserver.port value to %SSL_PORT%.
2. Add the -Dwebcontainer.port=%SSL_PORT% entry.
3. Add the -Djavax.net.ssl.trustStore=conf\Truststore.truststore entry.

 

startApplicationClient.bat: The standalone application client can be enabled by modifying the startApplicationClient.bat file located in <Web NMS Home>/bin directory.

    1. Add the location of the truststore file in the startApplicationClient.bat file.

    2. Provide the %SSL_PORT% parameter.
       

    3.  

      %JAVA_HOME%\bin\java .... -Djavax.net.ssl.trustStore=conf\Truststore.truststore com.adventnet.nms.startclient.WebNMSClient localhost %SSL_PORT%
       

Script Files Changes in Linux or Solaris Machines

 

The below given server-side and the client-side script files require modification for enabling SSL communication, by default, for Linux or Solaris OS machines.

 

 startnms.sh: This file, located in <Web NMS Home>/bin directory, is used to start the Web NMS BE server. Add the following (marked in bold face) in this file:

1. Modify the -Dwebserver.port value to $SSL_PORT.
2. Add the -Dwebcontainer.port=$SSL_PORT entry.
3. Add the -Djavax.net.ssl.trustStore=conf/Truststore.truststore entry.

 

startApplicationClient.sh: The standalone application client is started from the file startApplicationClient.sh located in <Web NMS Home>/bin directory.

Starting the Server and Client from Launcher

 

To Start the Server

 

Modify the launcher_conf.txt file present in the <Web NMS Home>/conf directory and include the arguments
-Dwebserver.port=8443 -Dssl.port=8443 -Djavax.net.ssl.trustStore=conf/Truststore.truststore
for the AppJavaOption property as shown below :

 

 

<application>

<property name="AppName" value="Start Web NMS Server"/>

<property name="ToolTip" value="Starts the NMS Server"/>

<property name="AppType" value="java"/>

<property name="AppJavaOption" value="-Dpgsql.home=./pgsql -Dwebserver.port=8443
-Dssl.port=8443 -Dwebcontainer.port=8443
-Djavax.net.ssl.trustStore=conf/Truststore.truststore
 
-Djava.rmi.server.codebase=...

...
...
</application>

 

 

 

To Start the Application Client

 

Modify the launcher_conf.txt file and include the arguments -Djavax.net.ssl.trustStore=conf/Truststore.truststore for Application Client.

 

 

<property name="AppName" value="Application Client"/>

<property name="AppType" value="java"/>

<property name="AppJavaOption"
value="-Djavax.net.ssl.trustStore=conf/Truststore.truststore"/>

<property name="Classpath" value=".;./classes/NmsClientClasses.jar;./classes/JimiProClasses.zip;./......
 

 
 

 

Note: After making any changes to the <Web NMS Home>/conf/launcher_conf.txt file, delete the existing <Web NMS Home>/conf/launcher.config file before restarting the launcher. The updated launcher.config will be generated on starting the launcher.
 

 

 

Starting the Server as a Windows/Linux Service

 

To start Web NMS server as Windows/Linux Service in the SSL communication mode, carryout the procedure as given below.

####################### FOR SSL #######################

#Change both -Dwebserver.port & -Dwebcontainer.port to 8443 in the above properties & Add below 2 properties

#wrapper.java.additional.18=-Djavax.net.ssl.trustStore=conf/Truststore.truststore

#wrapper.java.additional.19=-Dssl.port=8443

######## For SSL ends #############################

 

 

Applet and Web Start Client Configurations

 

The following points need to be ensured for enabling the SSL mode of communication for the Applet and the Web Start clients:

  1. Place the <truststore_file>.truststore file in the browser's <JRE_HOME>jre/lib/security directory

  2. Add an entry for permission in the java.policy file located in the <JRE_HOME>jre/lib/security as,

grant {

permission java.lang.reflect.ReflectPermission "suppressAccessChecks", "";

permission javax.net.ssl.SSLPermission "setHostnameVerifier", "";

permission java.util.PropertyPermission "*", "read,write";

};

  1. For invoking the Applet and the Web Start clients, the protocol name to be specified in the browser URL is "https". The server certificate is dynamically downloaded in the respective client.

Note: For WebStart client if your own UI is to be invoked instead of the default UI (i.e., WebNMSClient.java), then the NmsClientUtil.setProtocolforWebStart("https") method must be invoked before invoking the WebNMSClient's doConnect( ) method.

 

Web Client Configurations

 

To enable the Web Client to support SSL communication mode, you must do the following configurations for Windows OS machine:

Note: After configuring for SSL by following the steps provided in this document, by default, the server will start in http and https mode. But only the web client can connect to both modes simultaneously. In the case of Java client this feature is not available.

 

Setting Up Failover in SSL Enabled Web NMS

 

If SSL-enabled WebNMS servers are running in a failover setup, the following changes has to be made in the Standby server:

  1. Create a directory named "Certs" under STANDBY's <Web NMS_Home> and copy the Primary's Truststore.truststore file into this folder.

  2. If the Standby server is running on Windows or Linux, make the following changes in the <NMS_Home>\bin\createCertificates.bat or <NMS_Home>\bin\createCertificates.sh as follows:

Windows

 

rem if EXIST %CERTIFICATE_DIRECTORY% rmdir /S /Q %CERTIFICATE_DIRECTORY%

    1. Make the following changes to include the Secserver.cer.
       

 

Change

%JAVA_HOME%\bin\keytool -export -keystore %CERTIFICATE_DIRECTORY%\server.keystore -alias bessl -storepass webnms -file %CERTIFICATE_DIRECTORY%\server.cer

 

to

 

%JAVA_HOME%\bin\keytool -export -keystore %CERTIFICATE_DIRECTORY%\server.keystore -alias secssl -storepass webnms -file %CERTIFICATE_DIRECTORY%\Secserver.cer

 

 

 

 

 

Change

 

%JAVA_HOME%\bin\keytool -import -keystore %CERTIFICATE_DIRECTORY%\Truststore.truststore -alias bessl -file %CERTIFICATE_DIRECTORY%\server.cer -storepass webnms -noprompt

 

to

 

%JAVA_HOME%\bin\keytool -import -keystore %CERTIFICATE_DIRECTORY%\Truststore.truststore -alias secssl -file %CERTIFICATE_DIRECTORY%\Secserver.cer -storepass webnms -noprompt

 

 

 

Linux

 

#rm -rf $CERTIFICATE_DIRECTORY > null.txt

    1. Make the following changes to include the Secserver.cer.
       

 

Change

$JAVA_HOME/bin/keytool -export -keystore $CERTIFICATE_DIRECTORY/server.keystore -alias bessl -storepass webnms -file $CERTIFICATE_DIRECTORY/server.cer

 

to

 

$JAVA_HOME/bin/keytool-export -keystore $CERTIFICATE_DIRECTORY/server.keystore -alias secssl -storepass webnms -file $CERTIFICATE_DIRECTORY/Secserver.cer

 

 

 

 

 

Change

 

$JAVA_HOME/bin/keytool -import -keystore $CERTIFICATE_DIRECTORY/Truststore.truststore -alias bessl -file $CERTIFICATE_DIRECTORY/server.cer -storepass webnms -noprompt

 

to

 

$JAVA_HOME/bin/keytool -import -keystore $CERTIFICATE_DIRECTORY/Truststore.truststore -alias secssl -file $CERTIFICATE_DIRECTORY/Secserver.cer -storepass webnms -noprompt

 

 

 

 

Migrating Certificates

 

The BETransKey.key and Truststore.truststore certificates created for SSL communication in Web NMS 4.7.x, can be migrated to Web NMS 5 and reused. This is achieved by importing the BETransKey.key and Truststore.truststore files. (If you have renamed these files, please substitute your file name instead of BETransKey.key and Truststore.truststore)

  1. Copy BETransKey.key created for Transport Provider implementation to <NMS5_Home>\conf and <NMS5_Home>\apache\tomcat\conf.

    (BETransKey.key is the output of keytool -genkey -alias betransssl -validity 3000 -keystore BETransKey.key -storepass webnms -keypass webnms)

  2. Copy Truststore.truststore file to <NMS5_Home>\conf.

  3. Replace server.keystore with BETransKey.key in <NMS5_Home>\conf\transportProvider.conf and <NMS5_Home>\apache\tomcat\conf\backup\server.xml files.

    Complete the configurations specified in this document before starting the server with the imported certificates.

 

Developer Tips on SSL


  1. How to start Web NMS server only in SSL port (8443)?

  2. What are the reasons for the "Gracefully shutting down" issue when starting the server in SSL?

  3. Can we have separate Key and Certificates for different client machines or is it only one Key and certificates we created?


To start the server only in the SSL_PORT (e.g., 8443), comment out the following entry in the <Web NMS Home>/apache/tomcat/conf/backup/server.xml file.

 

<Connector port="WEBCONTAINER_PORT" maxThreads="50" minSpareThreads="3" maxSpareThreads="10" enableLookups="true" acceptCount="100" connectionTimeout="0" disableUploadTimeout="true" URIEncoding="UTF-8" compression="force" compressionMinSize="1024" noCompressionUserAgents="gozilla, traviata" compressableMimeType="text/html,text/xml"/>

 

 

In the case of Windows OS, in startnms.bat file present in <Web NMS Home>\bin directory, the CLASS_PATH should be replaced with CLASSPATH variable and the following CODEBASE entry should be removed:

 

-Djava.rmi.server.codebase=%CODEBASE_LIST%  

 

In the case of Linux OS, in startnms.bat file present in <Web NMS Home>\bin directory, the following CODEBASE entry should be removed:

 

-Djava.rmi.server.codebase=$CODEBASE_LIST

The following are the possible reasons for the "Gracefully Shutting down the Web NMS server" in the SSL setup:

The Key and Certificates are the same for the clients connecting to a particular server. Need not create separate Key and Certificates for different client machines connecting to the same server.



Copyright © 2011, ZOHO Corp. All Rights Reserved.