{"id":4890,"date":"2012-06-22T05:46:00","date_gmt":"2012-06-22T05:46:00","guid":{"rendered":""},"modified":"2026-04-18T22:48:01","modified_gmt":"2026-04-18T22:48:01","slug":"firewall-verification-using-a-script","status":"publish","type":"post","link":"https:\/\/hellem.org\/wblog\/?p=4890","title":{"rendered":"Firewall verification using a script"},"content":{"rendered":"<p>Needed to verify a lot of ports that should be opened making it possible to connect to three hosts. Had to do some surfing, and as always by the help of Google I managed to create a bash-script solving the issue for me.<\/p>\n<p><!-- codeblock lang=\"bash\" line=\"1\" --><\/p>\n<pre><code>\r\n#!\/bin\/bash\r\n \r\n###### Set variables ########\r\n# IP of WAS-server 4,5,6\r\nPREIP=10.10.31.\r\nPOSTIP=\"4;5;6\"\r\n# Use Notepad++ and see http:\/\/ccapeng.blogspot.no\/2008\/06\/notepad-replace-pattern-with-line-break.html to create the below listings\r\nCSIV2_SSL=\"10113;10036;10046;10056;10066;10076;10086;10096\"\r\nORB_LISTENER=\"10014;10024;10034;10044;10054;10064;10074\"\r\nBOOTSTRAP=\"10111;10032;10042;10052;10062;10072;10082\"\r\n \r\n###### DO THE MAGIC ######\r\necho \"Testing from `hostname`\"\r\necho \"***********************\"\r\n# Use of IFS, see http:\/\/stackoverflow.com\/questions\/918886\/split-string-based-on-delimiter-in-bash\r\nOIFS=$IFS\r\nIFS=';' read -ra IPARR &lt;&lt;&lt; \"$POSTIP\"\r\nfor ip  in \"${IPARR[@]}\";\r\ndo\r\n    MACHINE=$PREIP$ip\r\n    echo \"\"\r\n    echo \"\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\"\r\n    echo \"Testing connectivity against ip $MACHINE\"\r\n    echo \"\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\u00a4\"\r\n    echo \"\"\r\n    echo \"Checking CSIV2_SSL_SERVERAUTH_LISTENER_ADDRESS\"\r\n    IFS=';' read -ra CSIV2ARR &lt;&lt;&lt; \"$CSIV2_SSL\"\r\n    for port in \"${CSIV2ARR[@]}\";\r\n    do\r\n        # Ignore errors, instead print below\r\n        exec 3&gt;\/dev\/tcp\/${MACHINE}\/$port 2&gt;\/dev\/null\r\n        if [ $? -eq 1 ]\r\n        then\r\n            #Only report errors, ret.value = 1 (success = 0)\r\n                echo \"Telnet connections not possible on port $port\"\r\n        fi\r\n    done\r\n    \r\n    #...as above, for the rest of the ports needed to be checked, \r\n    #...copy the above statements and change the source variable.\r\n    #...a bit dirty, but hey, solving a one time issue...who cares :-)\r\n\r\ndone\r\n# Set IFS back to old value\r\nIFS=$OIFS<\/code><\/pre>\n<p><!-- \/codeblock --><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Needed to verify a lot of ports that should be opened making it possible to connect to three hosts. Had to do some surfing, and as always by the help of Google I managed to create a bash-script solving the issue for me. #!\/bin\/bash ###### Set variables ######## # IP of WAS-server 4,5,6 PREIP=10.10.31. POSTIP=&#8221;4;5;6&#8243; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47],"tags":[],"class_list":["post-4890","post","type-post","status-publish","format-standard","hentry","category-work-geek"],"_links":{"self":[{"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=\/wp\/v2\/posts\/4890","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4890"}],"version-history":[{"count":1,"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=\/wp\/v2\/posts\/4890\/revisions"}],"predecessor-version":[{"id":12717,"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=\/wp\/v2\/posts\/4890\/revisions\/12717"}],"wp:attachment":[{"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4890"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4890"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4890"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}