How to quickly test for open ports on an RSA Security Analytics appliance
Tasks
Testing 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
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.
Product Details
RSA Product Set: Security AnalyticsRSA Version/Condition: 10.4.x, 10.5.x
Platform: CentOS
O/S Version: EL6
Summary
Bash script to test serveral ports in one line, this save time using curl for every port.
Approval Reviewer Queue
ASOC Approval Group