OpenVZ Forum


Home » General » Support » Iptables problem - when enabled, can't access VPSes
Iptables problem - when enabled, can't access VPSes [message #20235] Thu, 13 September 2007 16:52 Go to next message
tomfra is currently offline  tomfra
Messages: 28
Registered: September 2007
Junior Member
I know some people reported different problem related to iptables but none of the forum posts (and not just on this forum) helped me solve my particular problem...

The problem: When firewall is enabled, I can't ping or in any other way access the VPS, when it's disabled, it works just fine.

Here are the facts:

* Hardware node works OK, has iptables / CSF firewall installed.

* Kernel is 2.6.18 custom compiled, behaviour of the related problem is the same with standard OpenVZ kernel though.

* IP forwarding is enabled - cat /proc/sys/net/ipv4/ip_forward returns 1.

* OS: CentOS 5 x86_64, all standard packages updated via yum daily.

* VPS IP address is added to csf.allow list and is properly added as an allowed IP to iptables rules.

I have attached my iptables rules as set by CSF. There are currently 2 IPs on the csf.deny list (hackers) and 2 IPs on the csf.allow list. Those IPs are the MAIN_NODE_IP and TEST_VPS_IP. There are real IPs on the original list of course.

Any ideas what could be causing this problem are *very* welcome.

Thanks for your time!

Tomas




Do you really believe the Internet is a safe place?
IdentityCloaker.com - Take Back Your Privacy!

[Updated on: Thu, 13 September 2007 16:53]

Report message to a moderator

Re: Iptables problem - when enabled, can't access VPSes [message #20244 is a reply to message #20235] Thu, 13 September 2007 23:38 Go to previous messageGo to next message
tomfra is currently offline  tomfra
Messages: 28
Registered: September 2007
Junior Member
OK, I may have found the solution myself... Instead of writing it here since it's a bit longer, you can read it at http://forum.lxlabs.com/index.php?t=msg&goto=13353&# msg_13353 .

I will welcome any comments on the solution - mainly I would like to know where it would open some security holes etc. I am not an iptables expert so it's quite possible...

Tomas


Do you really believe the Internet is a safe place?
IdentityCloaker.com - Take Back Your Privacy!
Re: Iptables problem - when enabled, can't access VPSes [message #20245 is a reply to message #20244] Fri, 14 September 2007 02:40 Go to previous messageGo to next message
ugob is currently offline  ugob
Messages: 271
Registered: March 2007
Senior Member
Yes, OpenVZ needs to use the FORWARD table for iptables so that traffic from/to the VEs are routed through the HN.

I think the person in the Lxlabs forum did a great job to minimize any potential security risk associated with the use of the FORWARD table. However, you must use iptables to firewall your VE's afterward, either using FORWARD rules on the HN, or using iptables inside the VEs.

Ugo


Please read the manual before asking questions:
http://download.openvz.org/doc/OpenVZ-Users-Guide.pdf

Please have a look at the wiki before asking questions:
http://wiki.openvz.org/Main_Page
Re: Iptables problem - when enabled, can't access VPSes [message #20259 is a reply to message #20245] Fri, 14 September 2007 10:43 Go to previous messageGo to next message
tomfra is currently offline  tomfra
Messages: 28
Registered: September 2007
Junior Member
ugob wrote on Fri, 14 September 2007 04:40

However, you must use iptables to firewall your VE's afterward, either using FORWARD rules on the HN, or using iptables inside the VEs.


I realized that if I enable the venet0 forwarding, any VPS traffic will not be affected by the HN firewall. This is not that bad since I plan to install firewall on each of the VPSes (they will all be owned by myself, for different projects), but it would still be nice if the VPS traffic was, to a degree, affected by the HN firewall - so that for example a hacker's IP would get blocked for all of the VPSes on the HN, even if the attack was committed towards only one of them.

Then I would have a firewall on the VPS itself, filtering the traffic further. I don't know how to accomplish that though. As I mentioned on the LXLabs forum, I am no iptables expert. But I can see some disadvantages of such a system and it would probably be just a complication anyway.

Tomas



Do you really believe the Internet is a safe place?
IdentityCloaker.com - Take Back Your Privacy!
Re: Iptables problem - when enabled, can't access VPSes [message #20260 is a reply to message #20259] Fri, 14 September 2007 10:47 Go to previous message
ugob is currently offline  ugob
Messages: 271
Registered: March 2007
Senior Member
ugob wrote on Fri, 14 September 2007 04:40

However, you must use iptables to firewall your VE's afterward, either using FORWARD rules on the HN, or using iptables inside the VEs.


tomfra wrote on Fri, 14 September 2007 06:43

I realized that if I enable the venet0 forwarding, any VPS traffic will not be affected by the HN firewall. This is not that bad since I plan to install firewall on each of the VPSes (they will all be owned by myself, for different projects), but it would still be nice if the VPS traffic was, to a degree, affected by the HN firewall - so that for example a hacker's IP would get blocked for all of the VPSes on the HN, even if the attack was committed towards only one of them.



Using FORWARD rules on the HN, you could achieve this.


Please read the manual before asking questions:
http://download.openvz.org/doc/OpenVZ-Users-Guide.pdf

Please have a look at the wiki before asking questions:
http://wiki.openvz.org/Main_Page

[Updated on: Fri, 14 September 2007 10:47]

Report message to a moderator

Previous Topic: help me
Next Topic: Trouble compiling kernel
Goto Forum:
  


Current Time: Tue Nov 19 06:17:37 GMT 2024

Total time taken to generate the page: 0.04117 seconds