Re: iptables and virtual hosts problem



On Tue, Oct 30, 2007 at 05:09:50PM +0100, Erik Persson wrote:
Hello!

I have a server which is running 2 different virtual hosts (vserver), let's
call them S for the server, A and B for the virtual hosts A and B.
S, A and B have different ip-addresses (say s.s.s.s, a.a.a.a and b.b.b.b).

Since the server isn't really forwarding anything I haven't used the
FORWARD chain for anything, and I use INPUT and OUTPUT to regulate the flow
to the different servers, for example:

iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
iptables -I INPUT -d a.a.a.a -p tcp --dport 80 -j ACCEPT
on the server
seems to do what I want. In the example above letting A and only A answer
requests on port 80.

However, when I try to regulate the flow of traffic between the different
"machines" (S, A, and B) strange things happen.

For example:
iptables -I OUTPUT -d a.a.a.a -p tcp --dport 25 -j ACCEPT
doesn't only allow any of the "machines" to try to contact port 25 on A,
but it *also allows A to answer* !!!

if by answer, you mean respond to the same request, then that is
appropriate, IIUC. The rules relate to *new* requests, not responses
to existing ones. That's why when you block port 80 inbound, you can
still recieve packets -- they match up to outbound requests your
browser has made.

I think that's right.

A

Attachment: signature.asc
Description: Digital signature



Relevant Pages

  • RE: Completely Lost
    ... Each port you ... server - most people wouldn't need that. ... So using Name-based Virtual Hosts can be done with a single IP address, ... they're on the router and nameserver. ...
    (Ubuntu)
  • Re: Apache & VirtualHosts
    ... I understand that https listens on port 443.... ... >> Your browser sent a request that this server could not understand. ... To summarise, I think, WITHOUT name based virtual hosts running I can visit ...
    (comp.os.linux.networking)
  • Re: Apache & VirtualHosts
    ... I understand that https listens on port 443.... ... >> Your browser sent a request that this server could not understand. ... To summarise, I think, WITHOUT name based virtual hosts running I can visit ...
    (comp.os.linux)
  • Re: Apache & VirtualHosts
    ... I understand that https listens on port 443.... ... >> Your browser sent a request that this server could not understand. ... To summarise, I think, WITHOUT name based virtual hosts running I can visit ...
    (alt.linux)
  • Re: Apache & VirtualHosts
    ... I understand that https listens on port 443.... ... >> Your browser sent a request that this server could not understand. ... To summarise, I think, WITHOUT name based virtual hosts running I can visit ...
    (alt.os.linux.redhat)