Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Jörg Harmuth" <harmuth@mnemon.de>
To: netfilter@lists.netfilter.org
Subject: Re: Ip_conntrack_ftp with PASSIVE FTP does not work
Date: Wed, 13 Jul 2005 13:38:48 +0200	[thread overview]
Message-ID: <42D4FD48.5050100@mnemon.de> (raw)
In-Reply-To: <04EE7AD0450F7B498BA216312943A1A102937F40@blrse201.ap.infineon.com>

Chandra.Vempali@infineon.com schrieb:
> My ip_conntrack_ftp module gets loaded properly.
> 
> If I keep a rule like "iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT"
> It means that traffic is allowed to pass through for all ports which should not be done for security reasons.

No, it means that any packet on any port with any protocol that is in
state ESTABLISHED or RELATED is allowed to pass. Not *all* packets.
Especially SYN packets (in state NEW) don't hit this rule. So, if you
set policy to DROP and allow no NEW packets, no communication can be
established at all. On the other hand, if you allow NEW packets to a
certain port, ofcourse you also want the ESTABLISHED packets and
sometimes the RELATED packets (in case of FTP). So, I don't think this
is a security risc.

If I'm wrong, somebody correct me, please.

> As for passive FTP, I added two rules to allow traffic thru only 21 port.
> iptables -A INPUT -p tcp --sport 21 -m state --state  ESTABLISHED,NEW -j ACCEPT 
> iptables -A OUTPUT -p tcp --dport 21 -m  state --state NEW,ESTABLISHED,RELATED -j ACCEPT

As Jan pointed out, when using passive FTP the source port is not
necessarily 21 - commonly both sides use high ports. I think, the reason
is that your rules are "bound" to port 21, where no RELATED connection
can be established. Thus the rule doesn't match and you hit the DROP
policy. Give

iptables -I [IN | OUT]PUT [-p tcp] -m state \
         --state RELATED,ESTABLISHED -j ACCEPT

a chance for testing. I would bet, it works.

Have a nice time,

Joerg



  reply	other threads:[~2005-07-13 11:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-13 10:00 Ip_conntrack_ftp with PASSIVE FTP does not work Chandra.Vempali
2005-07-13 11:38 ` Jörg Harmuth [this message]
2005-07-13 14:40 ` Jason Opperisano
2005-07-13 21:15 ` R. DuFresne
  -- strict thread matches above, loose matches on Subject: below --
2005-07-13  9:05 Chandra.Vempali
2005-07-13  9:38 ` Jörg Harmuth
2005-07-13 10:14   ` Jan Engelhardt

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=42D4FD48.5050100@mnemon.de \
    --to=harmuth@mnemon.de \
    --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