From: "Stuart Lamble" <stu@gateway10.homeip.net>
To: netfilter@lists.netfilter.org
Subject: RE: Is this config OK, plus where should I be logging...
Date: Sun, 4 Apr 2004 20:41:45 +0200 [thread overview]
Message-ID: <000501c41a74$7b0c51f0$0464a8c0@stu> (raw)
In-Reply-To: <200404041856.26377.Antony@Soft-Solutions.co.uk>
Hi
Ok, here is an update...
I have added the results of iptables-save as is, without hacking
anything off. ;-)
I have the firewall box that is running the following...
mail server on port 25
ssh server on port 22
webmin running port 10000 over SSL 443
web server on port 80
DNAT to another lan server running oracle web services on port 7783 =
7783 (from the web)
DNAT to another lan server running ssh services on port 22 = 555 (from
the web)
My internal 192.168.100.0/255.255.255.0 is masqueraded for internet
browsing and prity much everything else.
The firewall itself needs to do DNS lookups, browse the net and send
SMTP traffic.
All that I require, stated above is working.
I want to know if the config is secure, where are the holes, what are
the best practices.
Also, I want to log suspicious behaviour, port scans, what gets dropped
etc.
I am stuck with that ;-(
This config is very much in TEST phase, I am on a quest to hone it,
hoping to make it as robust as possible.
Thanks in advance for any advice...
# Generated by iptables-save v1.2.7a on Sun Apr 4 22:25:58 2004
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth1 -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -p tcp -m tcp --sport 25 -j ACCEPT
-A INPUT -i ppp0 -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -i ppp0 -p tcp -m tcp --dport 25 -j ACCEPT
-A INPUT -i ppp0 -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -i ppp0 -p tcp -m tcp --dport 443 -j ACCEPT
-A INPUT -i ppp0 -p tcp -m tcp --dport 10000 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -s 192.168.100.0/255.255.255.0 -j ACCEPT
-A FORWARD -d 192.168.100.6 -p tcp -m tcp --dport 22 -j ACCEPT
-A FORWARD -d 192.168.100.6 -p tcp -m tcp --dport 7783 -j ACCEPT
-A OUTPUT -s 127.0.0.1 -j ACCEPT
-A OUTPUT -o eth1 -j ACCEPT
-A OUTPUT -p tcp -m tcp --sport 80 -j ACCEPT
-A OUTPUT -p tcp -m tcp --sport 25 -j ACCEPT
-A OUTPUT -p tcp -m tcp --sport 22 -j ACCEPT
-A OUTPUT -o ppp0 -p udp -m udp -m multiport --ports domain -j ACCEPT
-A OUTPUT -o ppp0 -p tcp -m tcp -m multiport --ports http -j ACCEPT
-A OUTPUT -o ppp0 -p tcp -m tcp -m multiport --ports smtp -j ACCEPT
-A OUTPUT -o ppp0 -p tcp -m tcp -m multiport --ports ndmp -j ACCEPT
COMMIT
# Completed on Sun Apr 4 22:25:58 2004
# Generated by iptables-save v1.2.7a on Sun Apr 4 22:25:58 2004
*mangle
:PREROUTING ACCEPT [1006:286916]
:INPUT ACCEPT [169:78179]
:FORWARD ACCEPT [834:208581]
:OUTPUT ACCEPT [171:64908]
:POSTROUTING ACCEPT [1005:273489]
COMMIT
# Completed on Sun Apr 4 22:25:58 2004
# Generated by iptables-save v1.2.7a on Sun Apr 4 22:25:58 2004
*nat
:PREROUTING ACCEPT [7:348]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A PREROUTING -i ppp0 -p tcp -m tcp --dport 555 -j DNAT --to-destination
192.168.100.6:22
-A PREROUTING -i ppp0 -p tcp -m tcp --dport 7783 -j DNAT
--to-destination 192.168.100.6:7783
-A POSTROUTING -s 192.168.100.0/255.255.255.0 -o ppp0 -j MASQUERADE
COMMIT
# Completed on Sun Apr 4 22:25:58 2004
-----Original Message-----
From: netfilter-admin@lists.netfilter.org
[mailto:netfilter-admin@lists.netfilter.org] On Behalf Of Antony Stone
Sent: Sunday, April 04, 2004 7:56 PM
To: netfilter@lists.netfilter.org
Subject: Re: Is this config OK, plus where should I be logging...
On Sunday 04 April 2004 6:26 pm, Stuart Lamble wrote:
> Is this config OK, plus where should I be logging...
We need a bit more information in order to answer either of those
questions.
Two things we need to know which you haven't said are:
1. What services are supposed to be allowed from/to where, so we can
comment
on whether this ruleset does what you want it to?
2. What would you like to have logged, so we can advise where to do the
logging?
Also a few more questions added at points through your ruleset:
> :INPUT DROP [0:0]
> :FORWARD DROP [0:0]
> :OUTPUT DROP [0:0]
>
> -A INPUT -i lo -j ACCEPT
> -A INPUT -i eth1 -j ACCEPT
What is interface eth1 used for? (We don't know if it's reasonable to
accept
all packets from there into the firewall - we can assume, but that
wouldn't
be an answer to your question. Do you have only a single trusted
machine
there? Do you have lots of machines with possibly trusted, possibly
untrusted users? Is it connected to the Internet? We need more
info....)
> -A INPUT -p icmp -j ACCEPT
> -A INPUT -p tcp -m tcp --sport 25 -j ACCEPT
Your firewall machine in running a mail client !?
> -A INPUT -i ppp0 -p tcp -m tcp --dport 22 -j ACCEPT
> -A INPUT -i ppp0 -p tcp -m tcp --dport 25 -j ACCEPT
Your firewall machine is running a mail server !!!???
> -A INPUT -i ppp0 -p tcp -m tcp --dport 80 -j ACCEPT
> -A INPUT -i ppp0 -p tcp -m tcp --dport 443 -j ACCEPT
> -A INPUT -i ppp0 -p tcp -m tcp --dport 10000 -j ACCEPT
What's that supposed to be for?
> -A INPUT -i ppp0 -p udp -m udp --sport 53 -j ACCEPT
> -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
> -A FORWARD -s 192.168.100.0/255.255.255.0 -j ACCEPT
That's a nice way to allow spoofed packets through your firewall....
> -A FORWARD -d 192.168.100.6 -p tcp -m tcp --dport 22 -j ACCEPT -A
> FORWARD -d 192.168.100.6 -p tcp -m tcp --dport 7783 -j ACCEPT
What's that for?
> -A OUTPUT -s 127.0.0.1 -j ACCEPT
> -A OUTPUT -o eth1 -j ACCEPT
> -A OUTPUT -p tcp -m tcp --sport 80 -j ACCEPT
You allowed in packets addressed to ports 80 and 443 - how come you only
allow
out reply packets from 80?
> -A OUTPUT -p tcp -m tcp --sport 25 -j ACCEPT
> -A OUTPUT -p tcp -m tcp --sport 22 -j ACCEPT
You allowed in packets to port 10000 - you don't allow the replies out
again?
> :PREROUTING ACCEPT [10:1191]
> :POSTROUTING ACCEPT [1:48]
> :OUTPUT ACCEPT [0:0]
So, you set up a nice default DROP policy, added some ACCEPT rules
allowing
the traffic you want, and then change the policy to ACCEPT so that
everything
is allowed (and you don't have any DROP rules). You may as well not
bother
with the OUTPUT ACCEPT rules - it's all going to get ACCEPTed anyway.
> -A PREROUTING -i ppp0 -p tcp -m tcp --dport 555 -j DNAT
> --to-destination 192.168.100.6:22 -A PREROUTING -i ppp0 -p tcp -m tcp
> --dport 7783 -j DNAT --to-destination 192.168.100.6:7783
> -A POSTROUTING -s 192.168.100.0/255.255.255.240 -o ppp0 -j MASQUERADE
You seem confused about your network size. Here you've used a 20 bit
netmask
- earlier you used a 24 bit (on the FORWARDing rule). Probably best to
be
consistent (what subnet mask are you using on the eth1 interface, and on
the
client machines?)
Also, by the way, what happened to interface eth0?
Regards,
Antony.
--
90% of networking problems are routing problems.
9 of the remaining 10% are routing problems in the other direction. The
remaining 1% might be something else, but check the routing anyway.
Please reply to the
list;
please don't
CC me.
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.648 / Virus Database: 415 - Release Date: 3/31/2004
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.648 / Virus Database: 415 - Release Date: 3/31/2004
next prev parent reply other threads:[~2004-04-04 18:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-04 17:26 Is this config OK, plus were should I be logging Stuart Lamble
2004-04-04 17:56 ` Is this config OK, plus where " Antony Stone
2004-04-04 18:41 ` Stuart Lamble [this message]
2004-04-04 19:07 ` Antony Stone
2004-04-05 5:46 ` Stuart Lamble
2004-04-05 9:11 ` Antony Stone
2004-04-05 13:14 ` Unknown, Alistair Tonner
[not found] ` <200404050914.19563.Alistair Tonner <>
2004-04-05 13:34 ` Antony Stone
2004-04-05 13:48 ` Antony Stone
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='000501c41a74$7b0c51f0$0464a8c0@stu' \
--to=stu@gateway10.homeip.net \
--cc=netfilter@lists.netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox