{"id":2380,"date":"2018-05-07T15:24:28","date_gmt":"2018-05-07T09:54:28","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=2380"},"modified":"2018-05-07T15:24:28","modified_gmt":"2018-05-07T09:54:28","slug":"csf-iptables-issue-on-openvz-vps","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/csf-iptables-issue-on-openvz-vps\/","title":{"rendered":"CSF iptables issue on OpenVZ VPS"},"content":{"rendered":"<p><strong>CSF iptables issue on OpenVZ VPS<\/strong><!--more--><\/p>\n<p><strong>Date Posted: 07-05-2018<\/strong><\/p>\n<p>ConfigServer Firewall (CSF) is a software firewall which adds security for your servers. There are cases when CSF wont work on VPS servers due to Iptables modules missing.<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$ \/etc\/csf\/csftest.pl \u00a0\r\nTesting ipt_state\/xt_state...FAILED [FATAL Error: iptables: No chain\/target\/match by that name.] - Required for csf to function\r\nTesting ipt_limit\/xt_limit...OK\r\nTesting ipt_recent...OK\r\nTesting xt_connlimit...FAILED [Error: iptables: No chain\/target\/match by that name.] - Required for CONNLIMIT feature\r\nTesting ipt_owner\/xt_owner...OK\r\nTesting iptable_nat\/ipt_REDIRECT...FAILED [Error: iptables v1.6.0: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)] - Required for MESSENGER feature\r\nTesting iptable_nat\/ipt_DNAT...FAILED [Error: iptables v1.6.0: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)] - Required for csf.redirect feature\r\n\r\nRESULT: csf will not function on this server due to FATAL errors from missing modules [1]<\/pre>\n<p><strong>Solution:-<\/strong><\/p>\n<p>At OpenVZ host node, add necessary modules on iptables config file\u00a0\u00a0\/etc\/sysconfig\/iptables-config as below.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">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\"\r\n<\/pre>\n<p>Then update\u00a0\/etc\/sysconfig\/vz file also<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">IPTABLES=\"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\"<\/pre>\n<p>Restart VZ service<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">service vz restart<\/code><\/p>\n<p>Apply netfilter and restart VPS<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">vzctl set 101 --netfilter full --save --setmode restart\r\n\r\n<\/pre>\n<p>Run CSF perl test<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\"># \/etc\/csf\/csftest.pl \r\nTesting ip_tables\/iptable_filter...OK\r\nTesting ipt_LOG...OK\r\nTesting ipt_multiport\/xt_multiport...OK\r\nTesting ipt_REJECT...OK\r\nTesting ipt_state\/xt_state...OK\r\nTesting ipt_limit\/xt_limit...OK\r\nTesting ipt_recent...OK\r\nTesting xt_connlimit...OK\r\nTesting ipt_owner\/xt_owner...OK\r\nTesting iptable_nat\/ipt_REDIRECT...OK\r\nTesting iptable_nat\/ipt_DNAT...OK\r\n\r\nRESULT: csf should function on this server\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Restart csf<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">service csf restart<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CSF iptables issue on OpenVZ VPS<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1019],"tags":[],"class_list":["post-2380","post","type-post","status-publish","format-standard","hentry","category-cloud-aws","psol-cat-cloud-aws"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-Co","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2380","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=2380"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2380\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=2380"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=2380"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=2380"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}