Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Alexander W. Janssen" <yalla@ynfonatic.de>
To: Patrick Maartense <patrick@patrick.at>
Cc: Netfilter Mailinglist <netfilter@lists.netfilter.org>
Subject: Re: How to block all ports except port 21,22,80,8080 ???
Date: Tue, 18 Feb 2003 17:03:48 +0100	[thread overview]
Message-ID: <20030218160348.GA23914@ynfonatic.de> (raw)
In-Reply-To: <3E5207B9.7C2BEDFA@patrick.at>

[-- Attachment #1: Type: text/plain, Size: 1285 bytes --]

On Tue, Feb 18, 2003 at 11:15:21AM +0100, Patrick Maartense wrote:
> it would be MUCH better to
> 
> iptables -p INPUT DROP # default drop
> then allow only these ports
> iptables -A INPUT -p tcp -m multiport  --dport 21,22,80,8080 -j ACCEPT
> 
> safe thinking: Default : drop, allow only what needed.

And it's allways a good idea to allow traffic from loopback:

iptables -A INPUT -i lo -j ACCEPT

I heard people telling that ssh is using 22/udp as well. I'm not sure if
that's true, though i haven't found any sshd which ever bind()ed to 22/udp.
Anyone more information?

Allowing ICMP should be mandatory as well, otherwise you'll create another
PMTU blackhole and you'll miss almost all error messages. And sending real
errormessages like tcp-reset and ICMP port unreachable is a good thing, too.
You can limit them, if you like.

iptables -A INPUT -p icmp -m limit --limit 5/s -j ACCEPT
iptables -A INPUT -p tcp -j REJECT --reject-with tcp-reset # limit if you like
iptables -A INPUT -j REJECT     # and that one as well
# implicit DROP due to default policy should happen here

Alex.
 

-- 
"Mr Data, when I said 'Fire at Will', I didn't mean for you to be so literal."
Instructions for use of this post: Insert tounge in cheek. Read as normal.

[-- Attachment #2: Type: application/pgp-signature, Size: 248 bytes --]

  parent reply	other threads:[~2003-02-18 16:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-18  8:12 How to block all ports except port 21,22,80,8080 ??? jacob_chan
2003-02-18  8:57 ` Ralf Spenneberg
2003-02-18  9:30   ` Ralf Spenneberg
2003-02-18 10:15     ` Patrick Maartense
2003-02-18 12:45       ` Ralf Spenneberg
2003-02-18 13:40       ` How to Block MSN Miguel Amador L.
2003-02-18 15:49         ` Arnt Karlsen
2003-02-18 16:03       ` Alexander W. Janssen [this message]
2003-02-18 12:19         ` Re2: How to block all ports except port 21,22,80,8080 ??? Pablo Allietti
2003-02-18 19:40           ` Alexander W. Janssen
2003-02-18 19:51           ` Re2: " Alexander W. Janssen
2003-02-18  9:02 ` Joel Newkirk

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=20030218160348.GA23914@ynfonatic.de \
    --to=yalla@ynfonatic.de \
    --cc=netfilter@lists.netfilter.org \
    --cc=patrick@patrick.at \
    /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