Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Antony Stone <Antony@Soft-Solutions.co.uk>
To: netfilter@lists.netfilter.org
Subject: Re: Is my script good and secure?
Date: Mon, 15 Mar 2004 13:50:03 +0000	[thread overview]
Message-ID: <200403151350.03709.Antony@Soft-Solutions.co.uk> (raw)
In-Reply-To: <DIIE.000000E500002A8E@sbgit.com>

On Monday 15 March 2004 1:28 pm, netfilter@sbgit.com wrote:

> Is this a good and secure Firewall Script?

> echo "1" > /proc/sys/net/ipv4/ip_forward # Initialising of Forwarding

Suggest you do this at the end, after setting up all the rules, instead of at 
the beginning, when some packets might get forwarded before you're ready.

> iptables -F sperre
> iptables -X sperre
> iptables -N sperre

I notice you are calling this user-defined chain from both INPUT and FORWARD - 
this means that all the protocols you allow *through* the firewall are also 
accepted *to* it - is this what you want?

> iptables -A sperre -i eth1 --dport 22,19,21,22,25,3389,1723,23000:23001 -j
> ACCEPT # Allow outbound only for specific ports

For example, the above rule is going to get called by both FORWARD and INPUT - 
think about whether that's what you meant to set up.

> iptables -A sperre -p tcp --dport 23001:23001 -j ACCEPT    # Battlefield

Did you mean "--dport 23000:23001"?

> iptables -A sperre -m state --state ESTABLISHED,RELATED -j ACCEPT

Put this rule at the top of the chain, so it gets matched first - nearly all 
of your traffic will match here, so make it efficient to process.

> iptables -A PREROUTING -t nat -i eth0 -p 37  -j DNAT --to 192.168.1.220

You have a VPN which uses protocol 37 (DDP: Datagram Delivery Protocol) ???

I think you mean 47: GRE.

> # Special Rules
> iptables -A INPUT -i eth0 -s 0/0 -p tcp --destination-port 25 -j ACCEPT
> iptables -A OUTPUT -o eth1 -s 0/0 -p tcp --destination-port 25 -j ACCEPT
> iptables -A INPUT -i eth0 -s 192.168.1.0/24 -p tcp --destination-port 25 -j
> ACCEPT

No need for this rule as packets will match on the INPUT rule above (unless 
you meant eth1?)

> iptables -A INPUT lo -p tcp --destination-port 10024 -j ACCEPT

Missing a "-i" there :)

> echo "Firewall started"

Good luck.

Antony.

-- 
Most people have more than the average number of legs.

                                                     Please reply to the list;
                                                           please don't CC me.



  reply	other threads:[~2004-03-15 13:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-15 13:28 Is my script good and secure? netfilter
2004-03-15 13:50 ` Antony Stone [this message]
2004-03-15 14:06 ` Cedric Blancher

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=200403151350.03709.Antony@Soft-Solutions.co.uk \
    --to=antony@soft-solutions.co.uk \
    --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