Background
It is a requirement of SLAC's security policy to keep as little number of ports open as possible on its perfSONAR machines. Therefore a group of XML based services can be instructed to listen on one port only instead of using a separate port for each. Services and ports in original configuration:
- snmp-MA uses port 8065
- PingER uses port 8075
- perfSONARBUOY (pSB) uses 8085
- LookupService (hLS) uses 8095
Services and ports in modified configuration:
- snmp-MA, PingER, pSB and hLS should all listen on lets say 8075
The steps to do so are described below:
Step 1. Create an init script
Browse to /etc/init.d/ and copy an existing script (say snmpMA.sh) to ps-universal.sh. That init script would be responsible for starting up a single instance of the daemon that handle all the services. Open the script and modify the TOOL_EXE to be something like:
{align:left}TOOL_EXE="perl -I /usr/local/perfSONAR-PS/perfSONAR_PS-PingER/lib -I /usr/local/perfSONAR-PS/perfSONAR_PS-perfSONARBUOY/lib -I /usr/local/perfSONAR-PS/perfSONAR_PS-SNMPMA/lib -I /usr/local/perfSONAR-PS/perfSONAR_PS-LookupService/lib /usr/local/perfSONAR-PS/Shared/scripts/perfsonar-daemon.pl" {align}
Also change TOOL_CONF and TOOL_LOGGER to tell the init script to point to the "combined.conf" and "combined_logger.conf" files.
TOOL_CONF=${CONF_PREFIX}/combined.conf TOOL_LOGGER=${CONF_PREFIX}/combined_logger.conf
And change TOOL for message display purposes:
TOOL="Services"
Step 2. Creating conf files
Browse now to /usr/local/etc/perfSONAR/ and do a concatenate to merge all conf files into one so that the script can read configurations for all four services from a single file:
cat /usr/local/etc/perfSONAR/*conf > /usr/local/etc/perfSONAR/combined.conf
Then go through and remove duplicate entries at the top-level, e.g. you'll have "disable_echo 0" in there repeatedly. Note: this does not apply to anything inside an <endpoint> block. Also, remove the extraneous <port> entries so that all the endpoint elements are under a single port entry. Modify the <port> tag so that it now reads <port 8075> or whatever port number you may want to use. Since this can be confusing, I am attaching a working sample for combined.conf.
One more conf file defined in the ps-universal.sh was the logger configuration file (also attaching) combined_logger.conf.
Step 3. Test run the script
Make sure that the services aren't already started. If so then stop them using the following commands:
/etc/init.d/PingER.sh stop /etc/init.d/snmpMA.sh stop /etc/init.d/pSB.sh stop /etc/init.d/hLS.sh stop
Once done see whether any services running on 8065, 8075, 8085 and 8095 (just to make sure) using netstat or telnet. Resume testing by executing the services using the following command:
/etc/init.d/ps-universal.sh start