Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Anders Fugmann <afu@fugmann.dhs.org>
To: system@eluminoustechnologies.com
Cc: iptables <netfilter@lists.netfilter.org>
Subject: Re: Firewalll script
Date: Mon, 23 Dec 2002 16:14:18 +0100	[thread overview]
Message-ID: <3E07284A.1030001@fugmann.dhs.org> (raw)
In-Reply-To: <00cc01c2aa7f$64e82860$1a01a8c0@vishal>

system@eluminoustechnologies.com wrote:
> Hi All,
> 
> Following is the policy that my firewall generation script gives, but my 
> system hangs when i execute this, I am using ssh to execute this script. 
> My aim is very simple to close all unused ports. My entire scripts goes 
> like this. Can you please help me in correcting the script.

Your ssh connection hangs because you close off communication to port 
22. The lines:
 > echo "Allow SSH(22/tcp)"
 > $IPTABLES -A INPUT -p tcp --sport 22 -j ACCEPT
 > $IPTABLES -A OUTPUT -p tcp --dport 22 -j ACCEPT
Are wrong, as you want to match the destination port on input and sport 
on output.

In general, it is not considered offensive to have and
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
which will also make the rules alot simpler. For starters, I would even 
recomment that you allow all outgoing packets.

The lines:
 > echo "Disabling IP Spoofing attacks"
 > echo 2 > /proc/sys/net/ipv4/conf/all/rp_filter
Are somewhat incorrect. It should be '1' and not '2'. I have seen many 
scripts and tutorials with this misconseption of what to set where, but 
in the kernel source says 0|1.

 > echo "Logging martians (packets with impossible addresses)"
 > echo 1 > /proc/sys/net/ipv4/conf/all/log_martians
This is incorrect. The setting determines if packets violating RFC1122 
should be logged or not. Setting this to '1', disables logging.

Hope it helps.

Regards
Anders Fugmann

--
Author of FIAIF.
FIAIF is an intelligent firewall
http://fiaif.fugmann.dhs.org




      parent reply	other threads:[~2002-12-23 15:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-23 12:32 Firewalll script system
2002-12-23 14:22 ` hare ram
2002-12-23 15:14 ` Anders Fugmann [this message]

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=3E07284A.1030001@fugmann.dhs.org \
    --to=afu@fugmann.dhs.org \
    --cc=netfilter@lists.netfilter.org \
    --cc=system@eluminoustechnologies.com \
    /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