000031517 - How to quickly test for open ports on an RSA Security Analytics appliance

Document created by RSA Customer Support Employee on Jun 14, 2016Last modified by RSA Customer Support Employee on Apr 21, 2017
Version 2Show Document
  • View in full screen mode

Article Content

Article Number000031517
Applies ToRSA Product Set: Security Analytics
RSA Version/Condition: 10.4.x, 10.5.x
Platform: CentOS
O/S Version: EL6
TasksTesting a list of ports can be a time consuming task.  
The script below saves time checking connectivity to a list of ports, and is useful to check if there is a firewall blocking connections between appliances.

IPTOCHECK="192.168.12.108";for ports in $(echo -e 22 80 443 8140 61614);do timeout 5 bash -c "cat < /dev/null > /dev/tcp/$IPTOCHECK/$ports"; if [[ $? -eq 0 ]]; then echo -e "$IPTOCHECK:$ports OK" ; else echo -e "$IPTOCHECK:$ports NOK" ; fi ; done; unset IPTOCHECK 
 

Replace the value for IPTOCHECK with the IP address on which you wish to check the ports.
Replace the values after echo -e with the ports you wish to check.  (example uses 22 80 443 8140 61614 64000)

Output:
[root@rsaaio logs]# IPTOCHECK="192.168.12.108";for ports in $(echo -e 22 80 443 8140 61614 64000);do timeout 5 bash -c "cat < /dev/null > /dev/tcp/$IPTOCHECK/$ports"; if [[ $? -eq 0 ]]; then echo -e "$IPTOCHECK:$ports OK" ; else echo -e "$IPTOCHECK:$ports NOK" ; fi ; done; unset IPTOCHECK
192.168.12.108:22 OK
192.168.12.108:80 OK
192.168.12.108:443 OK
192.168.12.108:8140 OK
192.168.12.108:61614 OK
bash: connect: Connection refused
bash: /dev/tcp/192.168.12.108/64000: Connection refused
192.168.12.108:64000 NOK

 

The "Connection refused" and NOK message indicates that the port is not reachable on that IP address.

Attachments

    Outcomes