We are getting into virtualization with a Proxmox VE (OpenVZ + KVM) server. Our plan for firewall is to have CSF (http://configserver.com/cp/csf.html) running on the host machine as we've had a reasonable good experience with it in the past.
Apart from that we plan simple firewall rules on the VM machines (mostly OpenVZ containers with same kernel) and maybe fail2ban simple specific rules.
I would appreciate comments with anyone with similar experiences?
I understand all traffic comes via the host machine so a combined firewall there with specific firewalling on the VM should work, alltough some iptables rules are hard to get to work on OpenVZ containers.
My advice is to perform the following on the hardware node:
Create a file called csfpost.sh in /etc/csf/ that simply allows forwarding:
Now your HN is protected on all interfaces, but will transparently pass traffic to and from your containers.
Notes
Make sure the modules needed for CSF are available to your VE's by placing the following in your /etc/vz/vz.conf:
Also make sure that your value for "numiptent" value is around 256 or higher, the default or 128 will cause CSF to half-load on your VE's (see /proc/user_bean_counters to see if you're hitting the numiptent limit)
I've also added the above netfilter modules to my /etc/modules (1 per line). I'm not entirely sure if this is necessary. Hope this helps!
You don't need fail2ban if you are using CSF. CSF comes with LFD, which does everything that fail2ban does (and more!). I don't see any problems that would occur from the setup that you are proposing, though I would suggest minimal firewall rules on the host to prevent any sort of overhead there.