Linux Netfilter discussions
 help / color / mirror / Atom feed
* RE: Ip_conntrack_ftp with PASSIVE FTP does not work
@ 2005-07-13 10:00 Chandra.Vempali
  2005-07-13 11:38 ` Jörg Harmuth
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Chandra.Vempali @ 2005-07-13 10:00 UTC (permalink / raw)
  To: harmuth, netfilter

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.

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

So, control messages goes thru firwall successfully.


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.

In my case, it is creating an expectation too. But when data starts flowing, firewall does not allow
even through it is expectation.

Any help will be highly appreciated ...

Chandra
P.S : I guess there is some patch for this problem.
Can anybody please point me to such patch and how to get it


-----Original Message-----
From: netfilter-bounces@lists.netfilter.org [mailto:netfilter-bounces@lists.netfilter.org] On Behalf Of Jörg Harmuth
Sent: Wednesday, July 13, 2005 3:09 PM
To: netfilter@lists.netfilter.org
Subject: Re: Ip_conntrack_ftp with PASSIVE FTP does not work


Chandra.Vempali@infineon.com schrieb:
> Hi all,
> 
> For me, ip_conntrack_ftp does not work for PASSIVE ftp.
> 
> In the firewall rules, I blocked everything and put the following 
> rules, 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
> And when I try to ftp, the control channel goes through firwall, but
> data channel fails to pass through.
So, your firewall connects to the FTP server, why not. First of all make sure that ip_conntrack_ftp is compiled into the kernel or as a module. If compiled as a module, make sure it is loaded.

As your firewall connects to the FTP server and your OUTPUT policy seems to be DROP or REJECT, you need rules like these:

iptables -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -A OUTPUT -p tcp --dport 21 --syn -j ACCEPT iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

Hmm, many people, including myself, think, that filtering in OUTPUT is pointless. More troublesome than usefull. If you decide to set OUTPUT policy to ACCEPT, you don't need the first two rules. Up to you.

Have a nice time,

Joerg


^ permalink raw reply	[flat|nested] 7+ messages in thread
* Ip_conntrack_ftp with PASSIVE FTP does not work
@ 2005-07-13  9:05 Chandra.Vempali
  2005-07-13  9:38 ` Jörg Harmuth
  0 siblings, 1 reply; 7+ messages in thread
From: Chandra.Vempali @ 2005-07-13  9:05 UTC (permalink / raw)
  To: netfilter

Hi all,

For me, ip_conntrack_ftp does not work for PASSIVE ftp.

In the firewall rules, I blocked everything and put the following rules,
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 
And when I try to ftp, the control channel goes through firwall, but
data channel fails to pass through.
Is there any thing else I should add to the firewall rules to allow ftp
data through firwall.
Any help will be highly appreciated.
Regards,
Chandra

*Disclaimer*
"This e-mail and any attachments are confidential and may contain trade
secrets or privileged or undisclosed information. They may also be
subject to copyright protection. Please do not copy, distribute or
forward this email to anyone unless authorised. If you are not a named
addressee, you must not use, disclose, retain or reproduce all or any
part of the information contained in this e-mail or any attachments. If
you have received this email by mistake please notify the sender
immediately by return email and destroy/delete all copies of the email."



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-07-13 21:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox