All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Protecting multiple webservers
@ 2005-01-19 22:35 gui
  0 siblings, 0 replies; 9+ messages in thread
From: gui @ 2005-01-19 22:35 UTC (permalink / raw)
  To: netfilter

>uh--where are the "allow incoming connections to my web servers" lines?

> -A FORWARD -i eth0 -o eth1 -p tcp --syn -d 192.168.0.2 --dport 80 \
>   -j ACCEPT
>
>-A FORWARD -i eth0 -o eth1 -p tcp --syn -d 192.168.0.3 --dport 80 \
>   -j ACCEPT
>
>make sure you also enabled IP forwarding:
>
> sysctl -w net.ipv4.ip_forward=1

The iptables start up script enables forwarding, but you were right I
was missing the  "allow incoming connections to my web servers" lines.
 Thanks James!

>are these webservers goingto be part of a cluster or do they need to
have there own resolved >hostnames?
>are they to be part of virtual hosting scenario ?

No, they are not in a cluster or anything fancy like that. These are
just stand alone web servers serving their own content that need to be
isolated from the rest of our network, but need to have their own
(current) hostnames resolved. I don't see what more information I can
provide.

The set up seems to be working fine after I added the lines suggested
by James. I'll report back if I encounter problems.

piranha,
Would you mind telling what are the other ways to do this?  Keep in
mind that I can't touch the DNS server.

Thanks again.

-gui


^ permalink raw reply	[flat|nested] 9+ messages in thread
* RE: Protecting multiple webservers
@ 2005-01-19 21:07 Hudson Delbert J Contr 61 CS/SCBN
  0 siblings, 0 replies; 9+ messages in thread
From: Hudson Delbert J Contr 61 CS/SCBN @ 2005-01-19 21:07 UTC (permalink / raw)
  To: gui, netfilter

are these webservers goingto be part of a cluster or do they need to have there own resolved hostnames?
we need more info as there are several different ways to do this.

are they to be part of virtual hosting scenario ?

more info, plz...

~piranha

-----Original Message-----
From: netfilter-bounces@lists.netfilter.org
[mailto:netfilter-bounces@lists.netfilter.org]On Behalf Of gui
Sent: Wednesday, January 19, 2005 12:37 PM
To: netfilter@lists.netfilter.org
Subject: Re: Protecting multiple webservers


Hi,

I did some work but I still can't get my new set up to work.

I'm going describe my problem again to avoid confusions.

Some background info:
Firewall: linux kernel 2.6.9-1.667 & iptables v1.2.11
Zinfandel and Cabernet (not the actual names) are web servers with
real domain names and public IP addresses.
Zinfandel's  public IP address x.x.174.104
Cabernet's   public IP address x.x.174.106		     
I don't have access to the DNS server and the IT dept doesn't want to
make any changes to the DNS server.

Problem: I need to put two web servers behind a firewall without
making changes to the DNS server.

My new set up:

   Zinfandel              Cabernet    
  192.168.0.2	     192.168.0.3
	 |		             |
	 `---------- ------------'
	            |
	          switch        
	            |
	            |    eth1 192.168.01  
	       FIREWALL
		    |    eth0 x.x.174.103 (Primary address)
		    |    eth0:0 x.x.174.104
		    |    eth0:1 x.x.174.106
		    |
		Internet  

I added the two IP addresses to eth0 using iproute2 as previously
suggested and I can ping the new addresses without a problem. I can
even connect to the firewall with SSH using those addresses. This
tells me that anti-arp spoofing is not an issue on the network and
that I can have multiple IP addresses binded to one NIC. However, the
forward rules don't work. I will appreciate any help that you can
provide.

The following is my ruleset file:

# Firewall configuration written by system-config-securitylevel
# Manual customization of this file is not recommended.
*filter

:INPUT DROP
:FORWARD DROP
:OUTPUT ACCEPT

# allow local loopback connections
-A INPUT -i lo -j ACCEPT

# allow pings
-A INPUT -i eth0 -p icmp -j ACCEPT

# drop INVALID connections
-A INPUT   -m state --state INVALID -j DROP
-A OUTPUT  -m state --state INVALID -j DROP
-A FORWARD -m state --state INVALID -j DROP

# allow all established and related
-A INPUT        -m state --state ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT    -m state --state ESTABLISHED,RELATED -j ACCEPT
-A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT


# allow connections to DNS servers
-A OUTPUT  -d x.x.100.129 -m state --state NEW -p udp --dport 53 -o
eth0 -j ACCEPT

#allow computers behind the firewall to access the DNS servers.
-A FORWARD -d x.x.100.129 -m state --state NEW -p udp --dport 53 -i
eth1 -o eth0 -j ACCEPT

# allow incoming SSH connections
#Only my desktop can ssh to the firewall
-A INPUT -i eth0 -s x.x.174.12 -p tcp --dport ssh -j ACCEPT 

# allow outgoing connections from web servers.
# added these lines so I can browse the web from the web servers 
-A OUTPUT -d 0/0 -m state --state NEW -p tcp -m multiport --dport
http,https -o eth0 -j ACCEPT

-A FORWARD -s 192.168.0.3 -d 0/0 -m state --state NEW -p tcp -m
multiport --dport http,https -o eth0 -i eth1 -j ACCEPT
-A FORWARD -s 192.168.0.2 -d 0/0 -m state --state NEW -p tcp -m
multiport --dport http,https -o eth0 -i eth1 -j ACCEPT

COMMIT

*nat
#set up IP forwarding and nat
#This is the primary IP address for eth0
-A POSTROUTING -o eth0 -j SNAT --to x.x.174.103

# forward ports to the proper servers
-A PREROUTING -i eth0 -p tcp -d 130.17.174.104 --dport 80 -j DNAT --to
192.168.0.2:80
-A PREROUTING -i eth0 -p tcp -d 130.17.174.106 --dport 80 -j DNAT --to
192.168.0.3:80

COMMIT

Thanks.



^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: Protecting multiple webservers
@ 2005-01-19 20:37 gui
  2005-01-19 20:58 ` Jason Opperisano
  0 siblings, 1 reply; 9+ messages in thread
From: gui @ 2005-01-19 20:37 UTC (permalink / raw)
  To: netfilter

Hi,

I did some work but I still can't get my new set up to work.

I'm going describe my problem again to avoid confusions.

Some background info:
Firewall: linux kernel 2.6.9-1.667 & iptables v1.2.11
Zinfandel and Cabernet (not the actual names) are web servers with
real domain names and public IP addresses.
Zinfandel's  public IP address x.x.174.104
Cabernet's   public IP address x.x.174.106		     
I don't have access to the DNS server and the IT dept doesn't want to
make any changes to the DNS server.

Problem: I need to put two web servers behind a firewall without
making changes to the DNS server.

My new set up:

   Zinfandel              Cabernet    
  192.168.0.2	     192.168.0.3
	 |		             |
	 `---------- ------------'
	            |
	          switch        
	            |
	            |    eth1 192.168.01  
	       FIREWALL
		    |    eth0 x.x.174.103 (Primary address)
		    |    eth0:0 x.x.174.104
		    |    eth0:1 x.x.174.106
		    |
		Internet  

I added the two IP addresses to eth0 using iproute2 as previously
suggested and I can ping the new addresses without a problem. I can
even connect to the firewall with SSH using those addresses. This
tells me that anti-arp spoofing is not an issue on the network and
that I can have multiple IP addresses binded to one NIC. However, the
forward rules don't work. I will appreciate any help that you can
provide.

The following is my ruleset file:

# Firewall configuration written by system-config-securitylevel
# Manual customization of this file is not recommended.
*filter

:INPUT DROP
:FORWARD DROP
:OUTPUT ACCEPT

# allow local loopback connections
-A INPUT -i lo -j ACCEPT

# allow pings
-A INPUT -i eth0 -p icmp -j ACCEPT

# drop INVALID connections
-A INPUT   -m state --state INVALID -j DROP
-A OUTPUT  -m state --state INVALID -j DROP
-A FORWARD -m state --state INVALID -j DROP

# allow all established and related
-A INPUT        -m state --state ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT    -m state --state ESTABLISHED,RELATED -j ACCEPT
-A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT


# allow connections to DNS servers
-A OUTPUT  -d x.x.100.129 -m state --state NEW -p udp --dport 53 -o
eth0 -j ACCEPT

#allow computers behind the firewall to access the DNS servers.
-A FORWARD -d x.x.100.129 -m state --state NEW -p udp --dport 53 -i
eth1 -o eth0 -j ACCEPT

# allow incoming SSH connections
#Only my desktop can ssh to the firewall
-A INPUT -i eth0 -s x.x.174.12 -p tcp --dport ssh -j ACCEPT 

# allow outgoing connections from web servers.
# added these lines so I can browse the web from the web servers 
-A OUTPUT -d 0/0 -m state --state NEW -p tcp -m multiport --dport
http,https -o eth0 -j ACCEPT

-A FORWARD -s 192.168.0.3 -d 0/0 -m state --state NEW -p tcp -m
multiport --dport http,https -o eth0 -i eth1 -j ACCEPT
-A FORWARD -s 192.168.0.2 -d 0/0 -m state --state NEW -p tcp -m
multiport --dport http,https -o eth0 -i eth1 -j ACCEPT

COMMIT

*nat
#set up IP forwarding and nat
#This is the primary IP address for eth0
-A POSTROUTING -o eth0 -j SNAT --to x.x.174.103

# forward ports to the proper servers
-A PREROUTING -i eth0 -p tcp -d 130.17.174.104 --dport 80 -j DNAT --to
192.168.0.2:80
-A PREROUTING -i eth0 -p tcp -d 130.17.174.106 --dport 80 -j DNAT --to
192.168.0.3:80

COMMIT

Thanks.


^ permalink raw reply	[flat|nested] 9+ messages in thread
* Protecting multiple webservers
@ 2005-01-12  1:01 gui
  0 siblings, 0 replies; 9+ messages in thread
From: gui @ 2005-01-12  1:01 UTC (permalink / raw)
  To: netfilter

Hello,

I work as a computer programmer for a small university and I was asked
to set up a firewall to protect three Apache web servers.  Each server
runs on its own machine, each server has its own name, public IP
address and they all listen on port 80.

After reading a few howto's, I came up with the following iptables
rules (I won't list all of them):

#www.server1.edu
-A PREROUTING -i eth0 -p tcp -d X.X.X.103 --dport 80 -j DNAT --to 192.168.0.2:80

#www.server2.edu
-A PREROUTING -i eth0 -p tcp -d X.X.X.103 --dport 8080 -j DNAT --to
192.168.0.3:80

Those rules work fine in the little network I created in my office.

Now I want to try the set up with the real servers. Due to the fact
that I know little about networking, can someone tell me whether I can
keep the public IP addresses and names of the servers and somehow make
requests to www.server2.edu go through the firewall?

I want to do this so that our users won't notice the change and if
something goes wrong I can easily undo the changes without having to
contact our IT department to make changes to the school's DNS server.

I would also appreciate if someone tells me whether I can add two more
web servers to this set up without having to open another "dport". Is
it possible to create a one-to-many mapping with iptables? That way I
only have to open port 80 on the firewall and still allow incoming
connections to different nated machines.

Any pointers, suggestions will be greatly appreciated.

Thanks.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-01-19 22:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <15069645.1105491740310.JavaMail.rct@kale>
2005-01-12  4:01 ` Protecting multiple webservers Bob Tellefson
2005-01-12 15:14   ` Maxime Ducharme
2005-01-12 15:37     ` Samuel Jean
2005-01-12 19:57   ` John A. Sullivan III
2005-01-19 22:35 gui
  -- strict thread matches above, loose matches on Subject: below --
2005-01-19 21:07 Hudson Delbert J Contr 61 CS/SCBN
2005-01-19 20:37 gui
2005-01-19 20:58 ` Jason Opperisano
2005-01-12  1:01 gui

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.