From: Jason Opperisano <opie@817west.com>
To: netfilter@lists.netfilter.org
Subject: Re: Ip_conntrack_ftp with PASSIVE FTP does not work
Date: Wed, 13 Jul 2005 10:40:43 -0400 [thread overview]
Message-ID: <20050713144042.GA23898@bender.817west.com> (raw)
In-Reply-To: <04EE7AD0450F7B498BA216312943A1A102937F40@blrse201.ap.infineon.com>
On Wed, Jul 13, 2005 at 03:30:37PM +0530, Chandra.Vempali@infineon.com wrote:
> Hi
> Thanks for your reply.
>
> 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.
that's not what it means at all, but your rules as written make no sense
whatsoever, so something's going to have to change.
> 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
the only src port tcp 21 traffic are the replies from the server to the
client on the control channel connection. these packets will never
be NEW. so let's go with:
iptables -A INPUT -p tcp --sport 21 \
-m state --state ESTABLISHED -j ACCEPT
> iptables -A OUTPUT -p tcp --dport 21 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
>
> So, control messages goes thru firwall successfully.
dst port 21 traffic will never be related to anything, they will only be
NEW or ESTABLISHED:
iptables -A OUTPUT -p tcp --dport 21 \
-m state --state NEW,ESTABLISHED -j ACCEPT
> But for the data, now both server and client work on random ports.
> ip_conntrack_ftp module should read this PASSIVE port from FTP message and then it should create an expectation.
it does, and it marks those packets as RELATED, which you have not
allowed in your rules, because you do not trust the conntrack mechanism
because you are smarter than it.
> In my case, it is creating an expectation too. But when data starts flowing, firewall does not allow
> even through it is expectation.
the "proper" solution to this is just to use the conntrack functionality
as it was intended:
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
but for what ever reason; this is not acceptable to you, so let's HIPPA
them up a bit:
# allow packets related to FTP connections in
iptables -A INPUT -p tcp --dport 1024: -m helper --helper ftp \
-m state --state RELATED -j ACCEPT
# allow packets related to FTP connections out
iptables -A OUTPUT -p tcp --dport 1024: -m helper --helper ftp \
-m state --state RELATED -j ACCEPT
iptables -A OUTPUT -p tcp --dport 20 -m helper --helper ftp \
-m state --state RELATED -j ACCEPT
those rules give the appearance of more security. if you think that the
conntrack mechanism in netfilter actually works--they offer no security
and simply create administrative and computational overhead.
HTH...
-j
--
"Stewie: Baby needs to suck ash. Baby needs to suck ash. Not ass,
you pervert. Save it for the interns."
--Family Guy
next prev parent reply other threads:[~2005-07-13 14:40 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
2005-07-13 14:40 ` Jason Opperisano [this message]
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=20050713144042.GA23898@bender.817west.com \
--to=opie@817west.com \
--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