ConfigServer installation IPtables problem in OpenVZ or Virtuozzo (solved!)

OpenVZ logo

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 ) is run in the VPS container while installing csf – the following fatal error may be encountered:

[root@vps-xyz ~]# perl /etc/csf/csftest.pl
Testing ip_tables/iptable_filter…OK
Testing ipt_LOG…FAILED [ 4294967295] – Required for csf to function
Testing ipt_multiport/xt_multiport…FAILED [FATAL Error: iptables: Unknown error 4294967295] – Required for csf to function
Testing ipt_REJECT…OK
Testing ipt_state/xt_state…FAILED [FATAL Error: iptables: Unknown error 4294967295] – Required for csf to function
Testing ipt_limit/xt_limit…FAILED [FATAL Error: iptables: Unknown error 4294967295] – Required for csf to function
Testing ipt_recent…FAILED [Error: iptables: Unknown error 4294967295] – Required for PORTFLOOD and PORTKNOCKING features
Testing xt_connlimit…FAILED [Error: iptables: Unknown error 4294967295] – Required for CONNLIMIT feature
Testing ipt_owner/xt_owner…FAILED [Error: iptables: Unknown error 4294967295] – Required for SMTP_BLOCK and UID/GID blocking features
Testing iptable_nat/ipt_REDIRECT…FAILED [Error: iptables v1.3.5: can’t initialize iptables table `nat’: Table does not exist (do you need to insmod?)] – Required for MESSENGER feature
Testing iptable_nat/ipt_DNAT…FAILED [Error: iptables v1.3.5: can’t initialize iptables table `nat’: Table does not exist (do you need to insmod?)] – Required for csf.redirect feature

SOLUTION:

To resolve the issue – You’ll need to have access to your Hardware node (main server – 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:

1. First, you need to define required iptables modules are available for VPS.
Edit /etc/sysconfig/iptables-config file on the Hardware Node (Main server) and make sure you have the following:

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"

Edit /etc/sysconfig/vz file:

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"

2. Restart Virtuozzo/OpenVZ:

# service vz restart

3. execute the command (Assuming your VPS’s CTID is 1001):

# vzctl set 1001 --netfilter full --save --setmode restart

4. Now run the perl test command once again in the VPS container and you should see the result successful:

root@vps-xyz [~]# perl /usr/local/csf/bin/csftest.pl
Testing ip_tables/iptable_filter...OK
Testing ipt_LOG...OK
Testing ipt_multiport/xt_multiport...OK
Testing ipt_REJECT...OK
Testing ipt_state/xt_state...OK
Testing ipt_limit/xt_limit...OK
Testing ipt_recent...OK
Testing xt_connlimit...OK
Testing ipt_owner/xt_owner...OK
Testing iptable_nat/ipt_REDIRECT...OK
Testing iptable_nat/ipt_DNAT...OK

RESULT: csf should function on this server

5. Finally restart CSF:

# Service csf restart

 

 

3 thoughts on “ConfigServer installation IPtables problem in OpenVZ or Virtuozzo (solved!)

  1. Hey there,

    I wish I found this post of yours earlier. I couln’nt install ConfigServer for a long time till I see this post. Thanks a lot man.

  2. Is this information still valid? I thought I seen a post on some forum where netfilter should be being used instead of iptables now for this. I’d like to point my provider to this site but want to make sure it’s correct before doing so. They’re running Virtuozzo I believe. Thanks!

Leave a Reply to Robert Cancel reply

Your email address will not be published. Required fields are marked *