{"id":6820,"date":"2014-04-23T08:09:41","date_gmt":"2014-04-23T08:09:41","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/23\/iptables-messing-up-tomcat-collection-of-common-programming-errors\/"},"modified":"2014-04-23T08:09:41","modified_gmt":"2014-04-23T08:09:41","slug":"iptables-messing-up-tomcat-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/23\/iptables-messing-up-tomcat-collection-of-common-programming-errors\/","title":{"rendered":"iptables messing up Tomcat?-Collection of common programming errors"},"content":{"rendered":"<p>I encountered the following problem(s) using Tomcat 7 with iptables on.<\/p>\n<p>1) Namely, there&#8217;s this Tomcat 7 instance that I run on <strong>server-1<\/strong> (directly exposed), and this Tomcat instance hosts a REST web-service. Tomcat itself is configured with SSL (NIO, not APR\/native), with <code>clientAuth=\"true\"<\/code>. Keystores, certs, and everything seems to be set up OK and working.<\/p>\n<p>On this server, iptables are up and running allowing all traffic from <strong>server-2<\/strong>, and the last rule in the filter INPUT chain is:<\/p>\n<blockquote>\n<p>-A INPUT -j REJECT &#8211;reject-with icmp-host-prohibited<\/p>\n<\/blockquote>\n<p>Now, from <strong>server-2<\/strong>, I try to call the web-service and I fail with connection \/ read timeout exceptions.<\/p>\n<p>2) Tomcat won&#8217;t shut down &#8211; I get &#8220;No route to host&#8221; exception message when trying to shut it down via its shutdown script.<\/p>\n<p>As soon as the last rule specified above in iptables on <strong>server-1<\/strong> is removed, both problems go away&#8230; Both servers are running CentOS 6 64.<\/p>\n<p>Can someone shed some light on this?<\/p>\n<p><strong>EDIT<\/strong><br \/>\nHere are all the other current INPUT rules:<\/p>\n<blockquote>\n<p>\/\/ VPN Related -A INPUT -s xx.xx.xx.xx -j ACCEPT -A INPUT -i eth0 -p tcp -m tcp &#8211;dport 1723 -j ACCEPT -A INPUT -i eth0 -p gre -j ACCEPT -A INPUT -m state &#8211;state RELATED,ESTABLISHED -j ACCEPT -A INPUT -i eth0 -p udp -m udp &#8211;dport 1701 -j ACCEPT -A INPUT -i eth0 -p udp -m udp &#8211;dport 4500 -j ACCEPT -A INPUT -i eth0 -p udp -m udp &#8211;dport 443 -j ACCEPT -A INPUT -i eth0 -p tcp -m tcp &#8211;dport 443 -j ACCEPT -A INPUT -i eth0 -p udp -m udp &#8211;dport 500 -j ACCEPT -A INPUT -i eth0 -p tcp -m tcp &#8211;dport 1701 -j ACCEPT \/\/ FreeRadius -A INPUT -i eth0 -p tcp -m tcp &#8211;dport 1812 -j ACCEPT -A INPUT -i eth0 -p tcp -m tcp &#8211;dport 1813 -j ACCEPT -A INPUT -i eth0 -p udp -m udp &#8211;dport 1812 -j ACCEPT -A INPUT -i eth0 -p udp -m udp &#8211;dport 1813 -j ACCEPT \/\/ Tomcat -A INPUT -i eth0 -p tcp -m tcp &#8211;dport 4445 -j ACCEPT -A INPUT -i eth0 -p tcp -m tcp &#8211;dport 8345 -j ACCEPT -A INPUT -i eth0 -p tcp -m tcp &#8211;dport 8007 -j ACCEPT -A INPUT -i eth0 -p udp -m udp &#8211;dport 4445 -j ACCEPT -A INPUT -i eth0 -p udp -m udp &#8211;dport 8345 -j ACCEPT \/\/ Allow all from server-2 -A INPUT -i eth0 -s xx.xx.xx.xx -j ACCEPT \/\/ System -A INPUT -i eth0 -p tcp -m tcp &#8211;dport 22 -j ACCEPT \/\/ Reject<\/p>\n<p>-A INPUT -j REJECT &#8211;reject-with icmp-host-prohibited<\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>I encountered the following problem(s) using Tomcat 7 with iptables on. 1) Namely, there&#8217;s this Tomcat 7 instance that I run on server-1 (directly exposed), and this Tomcat instance hosts a REST web-service. Tomcat itself is configured with SSL (NIO, not APR\/native), with clientAuth=&#8221;true&#8221;. Keystores, certs, and everything seems to be set up OK and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6820","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6820","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6820"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6820\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6820"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6820"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6820"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}