Linux Netfilter discussions
 help / color / mirror / Atom feed
* Broken ftp through iptables
@ 2003-08-26 15:21 Landon Chelf
  2003-08-26 15:59 ` Peter Marshall
  0 siblings, 1 reply; 8+ messages in thread
From: Landon Chelf @ 2003-08-26 15:21 UTC (permalink / raw)
  To: netfilter

Hello,

I've ran into a recent problem both on rh8 and rh9 using iptables.  I've
setup my firewall to drop everything incomming and forward and am only
allowing certain ports to be open.  I've opened ftp (port 21 tcp) and I
can connect via FTP from one machine and authenticate, but when I issue
my first command like "ls" for instance the connection locks up and
won't do anything.  Is there a way to fix this?

Landon



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

* RE: Broken ftp through iptables
       [not found] <3F4B7D1A.2010408@nucdc.org>
@ 2003-08-26 15:42 ` Landon Chelf
  2003-08-26 16:05   ` Julian Gomez
  2003-08-26 22:29   ` Alistair Tonner
  0 siblings, 2 replies; 8+ messages in thread
From: Landon Chelf @ 2003-08-26 15:42 UTC (permalink / raw)
  To: netfilter

Thanks but it is loaded from what I can tell.  Below is the iptables
stuff of an lsmod

Module                  Size  Used by    Not tainted
ip_conntrack_ftp        5296   0  (unused)
ip_conntrack           26976   1  [ip_conntrack_ftp]
iptable_filter          2412   1  (autoclean)
ip_tables              15096   1  [iptable_filter]

-----Original Message-----
From: Jamie Pratt [mailto:jamie@nucdc.org] 
Sent: Tuesday, August 26, 2003 11:31 AM
To: Landon Chelf
Subject: Re: Broken ftp through iptables


hi - do you have the ip_conntrack_ftp module loaded on the server? 
(lsmod command will show you all the modules that are currently 
loaded).. - if not, try putting 'insmod ip_conntrack_ftp' in your 
script.. (near the top obviously ;-)

jamie

Landon Chelf wrote:

> Hello,
> 
> I've ran into a recent problem both on rh8 and rh9 using iptables.  
> I've setup my firewall to drop everything incomming and forward and am

> only allowing certain ports to be open.  I've opened ftp (port 21 tcp)

> and I can connect via FTP from one machine and authenticate, but when 
> I issue my first command like "ls" for instance the connection locks 
> up and won't do anything.  Is there a way to fix this?
> 
> Landon
> 
> 
> 
> 




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

* Re: Broken ftp through iptables
  2003-08-26 15:21 Broken ftp through iptables Landon Chelf
@ 2003-08-26 15:59 ` Peter Marshall
  2003-08-26 16:14   ` Landon Chelf
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Marshall @ 2003-08-26 15:59 UTC (permalink / raw)
  To: Landon Chelf, netfilter

If you want to use passive ftp you have to allow stuff destined to port 21
and you also have to allow ( for the commands) traffic to come in on some
port that you don't get to pick.  The way to to this without actually
opening a whole bunch of ports is like this

From inside network going out and on forward chain
    -p tcp --dport  21 -j ACCEPT
    -p tcp -m state --state RELATED - j ACCEPT

FROM outside network back in on the Forward chain
   -p tcp -m state --state ESTABLISHED -j ACCEPT


If you want to do Active ftp .... well .... trust me, you dont want to do
this :)


----- Original Message -----
From: "Landon Chelf" <landonc@starrobbins.com>
To: <netfilter@lists.netfilter.org>
Sent: Tuesday, August 26, 2003 12:21 PM
Subject: Broken ftp through iptables


> Hello,
>
> I've ran into a recent problem both on rh8 and rh9 using iptables.  I've
> setup my firewall to drop everything incomming and forward and am only
> allowing certain ports to be open.  I've opened ftp (port 21 tcp) and I
> can connect via FTP from one machine and authenticate, but when I issue
> my first command like "ls" for instance the connection locks up and
> won't do anything.  Is there a way to fix this?
>
> Landon
>
>



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

* Re: Broken ftp through iptables
  2003-08-26 15:42 ` Landon Chelf
@ 2003-08-26 16:05   ` Julian Gomez
  2003-08-26 16:18     ` Peter Marshall
  2003-08-26 22:29   ` Alistair Tonner
  1 sibling, 1 reply; 8+ messages in thread
From: Julian Gomez @ 2003-08-26 16:05 UTC (permalink / raw)
  To: netfilter

On Tue, Aug 26, 2003 at 11:42:02AM -0400, Landon Chelf spoke thusly:
>Thanks but it is loaded from what I can tell.  Below is the iptables
>stuff of an lsmod
>
>Module                  Size  Used by    Not tainted
>ip_conntrack_ftp        5296   0  (unused)
>ip_conntrack           26976   1  [ip_conntrack_ftp]
>iptable_filter          2412   1  (autoclean)
>ip_tables              15096   1  [iptable_filter]

You have a corresponding --state RELATED rule ?

(snip remaining)


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

* RE: Broken ftp through iptables
  2003-08-26 15:59 ` Peter Marshall
@ 2003-08-26 16:14   ` Landon Chelf
  0 siblings, 0 replies; 8+ messages in thread
From: Landon Chelf @ 2003-08-26 16:14 UTC (permalink / raw)
  To: netfilter

Thanx,

I was missing the following line.  All seems to be good now.  Thanx for
the help.

-p tcp -m state --state ESTABLISHED,RELATED -j ACCEPT

Landon

-----Original Message-----
From: Peter Marshall [mailto:peter.marshall@caris.com] 
Sent: Tuesday, August 26, 2003 12:00 PM
To: Landon Chelf; netfilter@lists.netfilter.org
Subject: Re: Broken ftp through iptables


If you want to use passive ftp you have to allow stuff destined to port
21 and you also have to allow ( for the commands) traffic to come in on
some port that you don't get to pick.  The way to to this without
actually opening a whole bunch of ports is like this

From inside network going out and on forward chain
    -p tcp --dport  21 -j ACCEPT
    -p tcp -m state --state RELATED - j ACCEPT

FROM outside network back in on the Forward chain
   -p tcp -m state --state ESTABLISHED -j ACCEPT


If you want to do Active ftp .... well .... trust me, you dont want to
do this :)


----- Original Message -----
From: "Landon Chelf" <landonc@starrobbins.com>
To: <netfilter@lists.netfilter.org>
Sent: Tuesday, August 26, 2003 12:21 PM
Subject: Broken ftp through iptables


> Hello,
>
> I've ran into a recent problem both on rh8 and rh9 using iptables.  
> I've setup my firewall to drop everything incomming and forward and am

> only allowing certain ports to be open.  I've opened ftp (port 21 tcp)

> and I can connect via FTP from one machine and authenticate, but when 
> I issue my first command like "ls" for instance the connection locks 
> up and won't do anything.  Is there a way to fix this?
>
> Landon
>
>



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

* Re: Broken ftp through iptables
  2003-08-26 16:05   ` Julian Gomez
@ 2003-08-26 16:18     ` Peter Marshall
  0 siblings, 0 replies; 8+ messages in thread
From: Peter Marshall @ 2003-08-26 16:18 UTC (permalink / raw)
  To: kluivert, netfilter

Read this page.  It will explaine why I have what I do.  ( well actually it
just explaines how the connections in ftp work ...  but from that you should
be able to determine what the problem is :)

http://slacksite.com/other/ftp.html


----- Original Message -----
From: "Julian Gomez" <kluivert@tm.net.my>
To: <netfilter@lists.netfilter.org>
Sent: Tuesday, August 26, 2003 1:05 PM
Subject: Re: Broken ftp through iptables


> On Tue, Aug 26, 2003 at 11:42:02AM -0400, Landon Chelf spoke thusly:
> >Thanks but it is loaded from what I can tell.  Below is the iptables
> >stuff of an lsmod
> >
> >Module                  Size  Used by    Not tainted
> >ip_conntrack_ftp        5296   0  (unused)
> >ip_conntrack           26976   1  [ip_conntrack_ftp]
> >iptable_filter          2412   1  (autoclean)
> >ip_tables              15096   1  [iptable_filter]
>
> You have a corresponding --state RELATED rule ?
>
> (snip remaining)
>



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

* Re: Broken ftp through iptables
  2003-08-26 15:42 ` Landon Chelf
  2003-08-26 16:05   ` Julian Gomez
@ 2003-08-26 22:29   ` Alistair Tonner
  1 sibling, 0 replies; 8+ messages in thread
From: Alistair Tonner @ 2003-08-26 22:29 UTC (permalink / raw)
  To: Landon Chelf, netfilter


	And recall that this will only work if the FTP port is the standard FTP port.

	If you are using a NON-standard ftp port, you need to pass the ports=21,xx
	option to both modules.

On August 26, 2003 11:42 am, Landon Chelf wrote:
> Thanks but it is loaded from what I can tell.  Below is the iptables
> stuff of an lsmod
>
> Module                  Size  Used by    Not tainted
> ip_conntrack_ftp        5296   0  (unused)
> ip_conntrack           26976   1  [ip_conntrack_ftp]
> iptable_filter          2412   1  (autoclean)
> ip_tables              15096   1  [iptable_filter]
>
> -----Original Message-----
> From: Jamie Pratt [mailto:jamie@nucdc.org]
> Sent: Tuesday, August 26, 2003 11:31 AM
> To: Landon Chelf
> Subject: Re: Broken ftp through iptables
>
>
> hi - do you have the ip_conntrack_ftp module loaded on the server?
> (lsmod command will show you all the modules that are currently
> loaded).. - if not, try putting 'insmod ip_conntrack_ftp' in your
> script.. (near the top obviously ;-)
>
> jamie
>
> Landon Chelf wrote:
> > Hello,
> >
> > I've ran into a recent problem both on rh8 and rh9 using iptables.
> > I've setup my firewall to drop everything incomming and forward and am
> >
> > only allowing certain ports to be open.  I've opened ftp (port 21 tcp)
> >
> > and I can connect via FTP from one machine and authenticate, but when
> > I issue my first command like "ls" for instance the connection locks
> > up and won't do anything.  Is there a way to fix this?
> >
> > Landon

-- 

	Alistair Tonner
	nerdnet.ca
	Senior Systems Analyst - RSS
	
     Any sufficiently advanced technology will have the appearance of magic.
	Lets get magical!


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

* RE: Broken ftp through iptables
@ 2003-08-27  2:43 Josh.Berry
  0 siblings, 0 replies; 8+ messages in thread
From: Josh.Berry @ 2003-08-27  2:43 UTC (permalink / raw)
  To: landonc; +Cc: netfilter

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

The ls command is usually the data portion of the FTP connection.  Have you tried changing the mode to passive (or to active if you are already using passive)?

	-----Original Message----- 
	From: Landon Chelf [mailto:landonc@starrobbins.com] 
	Sent: Tue 8/26/2003 10:21 AM 
	To: netfilter@lists.netfilter.org 
	Cc: 
	Subject: Broken ftp through iptables
	
	

	Hello,
	
	I've ran into a recent problem both on rh8 and rh9 using iptables.  I've
	setup my firewall to drop everything incomming and forward and am only
	allowing certain ports to be open.  I've opened ftp (port 21 tcp) and I
	can connect via FTP from one machine and authenticate, but when I issue
	my first command like "ls" for instance the connection locks up and
	won't do anything.  Is there a way to fix this?
	
	Landon
	
	
	


[-- Attachment #2: Type: text/html, Size: 1334 bytes --]

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

end of thread, other threads:[~2003-08-27  2:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-26 15:21 Broken ftp through iptables Landon Chelf
2003-08-26 15:59 ` Peter Marshall
2003-08-26 16:14   ` Landon Chelf
     [not found] <3F4B7D1A.2010408@nucdc.org>
2003-08-26 15:42 ` Landon Chelf
2003-08-26 16:05   ` Julian Gomez
2003-08-26 16:18     ` Peter Marshall
2003-08-26 22:29   ` Alistair Tonner
  -- strict thread matches above, loose matches on Subject: below --
2003-08-27  2:43 Josh.Berry

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