{"id":326,"date":"2014-08-08T21:00:24","date_gmt":"2014-08-08T15:00:24","guid":{"rendered":"http:\/\/hasibul.info\/blog\/?p=326"},"modified":"2014-08-08T21:05:43","modified_gmt":"2014-08-08T15:05:43","slug":"configserver-installation-iptables-problem-in-openvz-or-virtuozzo-vps-solved","status":"publish","type":"post","link":"https:\/\/hasibul.info\/blog\/2014\/08\/08\/configserver-installation-iptables-problem-in-openvz-or-virtuozzo-vps-solved\/","title":{"rendered":"ConfigServer installation IPtables problem in OpenVZ or Virtuozzo (solved!)"},"content":{"rendered":"<p style=\"text-align: justify;\">ConfigServer Firewall (AKA csf) is an essential security tool for Linux based server and VPS.<\/p>\n<p style=\"text-align: justify;\">The installation of CSF is pretty straight forward and is described here: http:\/\/configserver.com\/free\/csf\/install.txt<\/p>\n<p style=\"text-align: justify;\">However, some of the iptables modules required by the csf might not be present in the server and when the perl test command ( # <em>perl \/usr\/local\/csf\/bin\/csftest.pl<\/em> ) is run in the VPS container while installing csf &#8211; the following fatal error may be encountered:<\/p>\n<blockquote><p><span style=\"margin: 0px; padding: 0px; color: #333333; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; font-size: small; font-family: verdana, geneva;\">[root@vps-xyz ~]# perl \/etc\/csf\/csftest.pl<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;\" \/><span style=\"margin: 0px; padding: 0px; color: #333333; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; font-size: small; font-family: verdana, geneva;\">Testing ip_tables\/iptable_filter&#8230;OK<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;\" \/><span style=\"margin: 0px; padding: 0px; color: #333333; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; font-size: small; font-family: verdana, geneva;\">Testing ipt_LOG&#8230;FAILED [ 4294967295] &#8211; Required for csf to function<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;\" \/><span style=\"margin: 0px; padding: 0px; color: #333333; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; font-size: small; font-family: verdana, geneva;\">Testing ipt_multiport\/xt_multiport&#8230;FAILED [FATAL Error: iptables: Unknown error 4294967295] &#8211; Required for csf to function<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;\" \/><span style=\"margin: 0px; padding: 0px; color: #333333; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; font-size: small; font-family: verdana, geneva;\">Testing ipt_REJECT&#8230;OK<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;\" \/><span style=\"margin: 0px; padding: 0px; color: #333333; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; font-size: small; font-family: verdana, geneva;\">Testing ipt_state\/xt_state&#8230;FAILED [FATAL Error: iptables: Unknown error 4294967295] &#8211; Required for csf to function<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;\" \/><span style=\"margin: 0px; padding: 0px; color: #333333; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; font-size: small; font-family: verdana, geneva;\">Testing ipt_limit\/xt_limit&#8230;FAILED [FATAL Error: iptables: Unknown error 4294967295] &#8211; Required for csf to function<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;\" \/><span style=\"margin: 0px; padding: 0px; color: #333333; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; font-size: small; font-family: verdana, geneva;\">Testing ipt_recent&#8230;FAILED [Error: iptables: Unknown error 4294967295] &#8211; Required for PORTFLOOD and PORTKNOCKING features<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;\" \/><span style=\"margin: 0px; padding: 0px; color: #333333; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; font-size: small; font-family: verdana, geneva;\">Testing xt_connlimit&#8230;FAILED [Error: iptables: Unknown error 4294967295] &#8211; Required for CONNLIMIT feature<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;\" \/><span style=\"margin: 0px; padding: 0px; color: #333333; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; font-size: small; font-family: verdana, geneva;\">Testing ipt_owner\/xt_owner&#8230;FAILED [Error: iptables: Unknown error 4294967295] &#8211; Required for SMTP_BLOCK and UID\/GID blocking features<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;\" \/><span style=\"margin: 0px; padding: 0px; color: #333333; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; font-size: small; font-family: verdana, geneva;\">Testing iptable_nat\/ipt_REDIRECT&#8230;FAILED [Error: iptables v1.3.5: can&#8217;t initialize iptables table `nat&#8217;: Table does not exist (do you need to insmod?)] &#8211; Required for MESSENGER feature<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;\" \/><span style=\"margin: 0px; padding: 0px; color: #333333; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; font-size: small; font-family: verdana, geneva;\">Testing iptable_nat\/ipt_DNAT&#8230;FAILED [Error: iptables v1.3.5: can&#8217;t initialize iptables table `nat&#8217;: Table does not exist (do you need to insmod?)] &#8211; Required for csf.redirect feature<\/span><\/p><\/blockquote>\n<h1><\/h1>\n<h1><strong>SOLUTION:<\/strong><\/h1>\n<p style=\"text-align: justify;\">To resolve the issue &#8211; You&#8217;ll need to have access to your Hardware node (main server &#8211; not the VPS container). If you do not have access to the main server you may provide this guide to your VPS provider. Now you need to do the following steps:<\/p>\n<p style=\"text-align: justify;\"><strong>1.<\/strong> First, you need to define required iptables modules are available for VPS.<br \/>\nEdit <strong>\/etc\/sysconfig\/iptables-config<\/strong> file on the Hardware Node (Main server) and make sure you have the following:<\/p>\n<blockquote><p><code>IPTABLES_MODULES=\"ipt_REJECT ipt_tos ipt_TOS ipt_LOG ip_conntrack ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length ipt_state iptable_nat ip_nat_ftp\"<\/code><\/p><\/blockquote>\n<p>Edit <strong>\/etc\/sysconfig\/vz<\/strong> file:<\/p>\n<blockquote>\n<div class=\"commandline\"><code>IPTABLES=\"ipt_REJECT<br \/>\nipt_tos ipt_TOS ipt_LOG ip_conntrack ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length ipt_state iptable_nat ip_nat_ftp\"<\/code><\/div>\n<div class=\"commandline\"><\/div>\n<\/blockquote>\n<p><strong>2.<\/strong> Restart Virtuozzo\/OpenVZ:<\/p>\n<blockquote>\n<div class=\"commandline\"><code># service vz restart<\/code><\/div>\n<\/blockquote>\n<p><strong>3.<\/strong> execute the command (Assuming your VPS&#8217;s CTID is 1001):<\/p>\n<blockquote><p><code># vzctl set 1001 --netfilter full --save --setmode restart<\/code><\/p><\/blockquote>\n<p><strong>4.<\/strong> Now run the perl test command once again in the VPS container and you should see the result successful:<\/p>\n<blockquote><p><code>root@vps-xyz [~]# perl \/usr\/local\/csf\/bin\/csftest.pl<br \/>\nTesting ip_tables\/iptable_filter...OK<br \/>\nTesting ipt_LOG...OK<br \/>\nTesting ipt_multiport\/xt_multiport...OK<br \/>\nTesting ipt_REJECT...OK<br \/>\nTesting ipt_state\/xt_state...OK<br \/>\nTesting ipt_limit\/xt_limit...OK<br \/>\nTesting ipt_recent...OK<br \/>\nTesting xt_connlimit...OK<br \/>\nTesting ipt_owner\/xt_owner...OK<br \/>\nTesting iptable_nat\/ipt_REDIRECT...OK<br \/>\nTesting iptable_nat\/ipt_DNAT...OK<\/code><\/p>\n<p><code>RESULT: csf should function on this server<\/code><\/p><\/blockquote>\n<p><strong>5.<\/strong> Finally restart CSF:<\/p>\n<blockquote><p><code># Service csf restart<\/code><\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ConfigServer Firewall (AKA csf) is an essential security tool for Linux based server and VPS. The installation of CSF is pretty straight forward and is described here: http:\/\/configserver.com\/free\/csf\/install.txt However, some of the iptables modules required by the csf might not be present in the server and when the perl test command ( # perl \/usr\/local\/csf\/bin\/csftest.pl&hellip;<\/p>","protected":false},"author":1,"featured_media":327,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[13,18,6,12,1],"tags":[109,117,116,112,113,95,114,118,115],"how-to":[],"_links":{"self":[{"href":"https:\/\/hasibul.info\/blog\/wp-json\/wp\/v2\/posts\/326"}],"collection":[{"href":"https:\/\/hasibul.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hasibul.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hasibul.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hasibul.info\/blog\/wp-json\/wp\/v2\/comments?post=326"}],"version-history":[{"count":0,"href":"https:\/\/hasibul.info\/blog\/wp-json\/wp\/v2\/posts\/326\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hasibul.info\/blog\/wp-json\/wp\/v2\/media\/327"}],"wp:attachment":[{"href":"https:\/\/hasibul.info\/blog\/wp-json\/wp\/v2\/media?parent=326"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hasibul.info\/blog\/wp-json\/wp\/v2\/categories?post=326"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hasibul.info\/blog\/wp-json\/wp\/v2\/tags?post=326"},{"taxonomy":"how-to","embeddable":true,"href":"https:\/\/hasibul.info\/blog\/wp-json\/wp\/v2\/how-to?post=326"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}