* Ftp (pass mode ) and Iptables
@ 2006-01-05 3:51 ludi
2006-01-05 9:14 ` Boryan Yotov
0 siblings, 1 reply; 6+ messages in thread
From: ludi @ 2006-01-05 3:51 UTC (permalink / raw)
To: netfilter
I have a ftp server and run a script of iptables on the server (not a
nat-gateway). The follow is the script:
iptables -F OUTPUT
iptables -F INPUT
iptables -F FORWARD
iptables -A INPUT -p udp -i eth0 -s 0/0 -d $HOME_ADDR --dport 53 -j ACCEPT
iptables -A INPUT -p tcp -i eth0 -s 0/0 -d $HOME_ADDR --dport 22 -j ACCEPT
iptables -A INPUT -p udp -i eth0 -s 0/0 -d $HOME_ADDR --sport 53 -j ACCEPT
iptables -A INPUT -p tcp -i eth0 -s 0/0 -d $HOME_ADDR --dport 80 -j ACCEPT
iptables -A INPUT -p icmp -i eth0 -s 0/0 -d $HOME_ADDR -m limit
--limit 6/m --limit-burst 6 -j ACCEPT
iptables -A INPUT -i lo -s 0/0 -d 127.0.0.1/32 -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -P INPUT DROP
iptables -A OUTPUT -o lo -s 127.0.0.1 -j ACCEPT
iptables -A OUTPUT -o eth0 -s $HOME_ADDR -j ACCEPT
iptables -P OUTPUT DROP
Now, my question is that I can not connect the ftp server with pass
mode until I stop the iptables. I had tried the ip_conntrack_ftp.o
module, but it didnt effect.
Could anyone give me some idea?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Ftp (pass mode ) and Iptables
2006-01-05 3:51 Ftp (pass mode ) and Iptables ludi
@ 2006-01-05 9:14 ` Boryan Yotov
2006-01-05 10:18 ` Boryan Yotov
2006-01-05 17:15 ` Eric Marty
0 siblings, 2 replies; 6+ messages in thread
From: Boryan Yotov @ 2006-01-05 9:14 UTC (permalink / raw)
To: netfilter
ludi wrote:
> I have a ftp server and run a script of iptables on the server (not a
> nat-gateway). The follow is the script:
>
> iptables -F OUTPUT
> iptables -F INPUT
> iptables -F FORWARD
>
>
>
> iptables -A INPUT -p udp -i eth0 -s 0/0 -d $HOME_ADDR --dport 53 -j ACCEPT
> iptables -A INPUT -p tcp -i eth0 -s 0/0 -d $HOME_ADDR --dport 22 -j ACCEPT
> iptables -A INPUT -p udp -i eth0 -s 0/0 -d $HOME_ADDR --sport 53 -j ACCEPT
> iptables -A INPUT -p tcp -i eth0 -s 0/0 -d $HOME_ADDR --dport 80 -j ACCEPT
> iptables -A INPUT -p icmp -i eth0 -s 0/0 -d $HOME_ADDR -m limit
> --limit 6/m --limit-burst 6 -j ACCEPT
> iptables -A INPUT -i lo -s 0/0 -d 127.0.0.1/32 -j ACCEPT
> iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
> iptables -P INPUT DROP
>
>
> iptables -A OUTPUT -o lo -s 127.0.0.1 -j ACCEPT
> iptables -A OUTPUT -o eth0 -s $HOME_ADDR -j ACCEPT
> iptables -P OUTPUT DROP
> Now, my question is that I can not connect the ftp server with pass
> mode until I stop the iptables. I had tried the ip_conntrack_ftp.o
> module, but it didnt effect.
> Could anyone give me some idea?
Do you have TLS or SSL encryption over the FTP's server command channel?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Ftp (pass mode ) and Iptables
2006-01-05 9:14 ` Boryan Yotov
@ 2006-01-05 10:18 ` Boryan Yotov
2006-01-05 17:15 ` Eric Marty
1 sibling, 0 replies; 6+ messages in thread
From: Boryan Yotov @ 2006-01-05 10:18 UTC (permalink / raw)
To: netfilter
Boryan Yotov wrote:
> ludi wrote:
>
>> I have a ftp server and run a script of iptables on the server (not a
>> nat-gateway). The follow is the script:
>>
>> iptables -F OUTPUT
>> iptables -F INPUT
>> iptables -F FORWARD
>>
>>
>>
>> iptables -A INPUT -p udp -i eth0 -s 0/0 -d $HOME_ADDR --dport 53 -j
>> ACCEPT
>> iptables -A INPUT -p tcp -i eth0 -s 0/0 -d $HOME_ADDR --dport 22 -j
>> ACCEPT
>> iptables -A INPUT -p udp -i eth0 -s 0/0 -d $HOME_ADDR --sport 53 -j
>> ACCEPT
>> iptables -A INPUT -p tcp -i eth0 -s 0/0 -d $HOME_ADDR --dport 80 -j
>> ACCEPT
>> iptables -A INPUT -p icmp -i eth0 -s 0/0 -d $HOME_ADDR -m limit
>> --limit 6/m --limit-burst 6 -j ACCEPT
>> iptables -A INPUT -i lo -s 0/0 -d 127.0.0.1/32 -j ACCEPT
>> iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
>> iptables -P INPUT DROP
>>
>>
>> iptables -A OUTPUT -o lo -s 127.0.0.1 -j ACCEPT
>> iptables -A OUTPUT -o eth0 -s $HOME_ADDR -j ACCEPT
>> iptables -P OUTPUT DROP
>> Now, my question is that I can not connect the ftp server with pass
>> mode until I stop the iptables. I had tried the ip_conntrack_ftp.o
>> module, but it didnt effect.
>> Could anyone give me some idea?
>
>
> Do you have TLS or SSL encryption over the FTP's server command channel?
>
>
>
Ok, since you are sure there is no TLS or SSL encryption on the command
channel, then it is probably the firewall setup script, which you use.
I suppose the script above is the complete one and it is ran on the FTP
server itself. If this is the case, then I see no definition for TCP/UDP
port 21 (where the FTP server's command channel is listening on). If
port 21 is closed (and your proftpd is not configured to listen on other
command port), then you won't be able to connect to the FTP server at all.
Othersides, since you mention that PASV mode is not working, then I
guess you already have command channel connection open between both
client and server? Or not?
And, please reply to the list (it makes it easier to track).
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: Ftp (pass mode ) and Iptables
2006-01-05 9:14 ` Boryan Yotov
2006-01-05 10:18 ` Boryan Yotov
@ 2006-01-05 17:15 ` Eric Marty
2006-01-06 6:30 ` ludi
1 sibling, 1 reply; 6+ messages in thread
From: Eric Marty @ 2006-01-05 17:15 UTC (permalink / raw)
To: Boryan Yotov, netfilter
hello all,
May be, you need accept the port 20 and 21 -j ACCEPT for the standard ftp.
Eric
-----Original Message-----
From: netfilter-bounces@lists.netfilter.org
[mailto:netfilter-bounces@lists.netfilter.org]On Behalf Of Boryan Yotov
Sent: Thursday, January 05, 2006 10:15 AM
To: netfilter@lists.netfilter.org
Subject: Re: Ftp (pass mode ) and Iptables
ludi wrote:
> I have a ftp server and run a script of iptables on the server (not a
> nat-gateway). The follow is the script:
>
> iptables -F OUTPUT
> iptables -F INPUT
> iptables -F FORWARD
>
>
>
> iptables -A INPUT -p udp -i eth0 -s 0/0 -d $HOME_ADDR --dport 53 -j ACCEPT
> iptables -A INPUT -p tcp -i eth0 -s 0/0 -d $HOME_ADDR --dport 22 -j ACCEPT
> iptables -A INPUT -p udp -i eth0 -s 0/0 -d $HOME_ADDR --sport 53 -j ACCEPT
> iptables -A INPUT -p tcp -i eth0 -s 0/0 -d $HOME_ADDR --dport 80 -j ACCEPT
> iptables -A INPUT -p icmp -i eth0 -s 0/0 -d $HOME_ADDR -m limit
> --limit 6/m --limit-burst 6 -j ACCEPT
> iptables -A INPUT -i lo -s 0/0 -d 127.0.0.1/32 -j ACCEPT
> iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
> iptables -P INPUT DROP
>
>
> iptables -A OUTPUT -o lo -s 127.0.0.1 -j ACCEPT
> iptables -A OUTPUT -o eth0 -s $HOME_ADDR -j ACCEPT
> iptables -P OUTPUT DROP
> Now, my question is that I can not connect the ftp server with pass
> mode until I stop the iptables. I had tried the ip_conntrack_ftp.o
> module, but it didnt effect.
> Could anyone give me some idea?
Do you have TLS or SSL encryption over the FTP's server command channel?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Ftp (pass mode ) and Iptables
2006-01-05 17:15 ` Eric Marty
@ 2006-01-06 6:30 ` ludi
2006-01-06 9:37 ` Boryan Yotov
0 siblings, 1 reply; 6+ messages in thread
From: ludi @ 2006-01-06 6:30 UTC (permalink / raw)
To: netfilter
I'm sorry. I lost the rules of ftp I insert when I setup the proftp.
iptables -A INPUT 1 -p tcp -s 0/0 -d $HOME_ADDR --dport 8888 -j ACCEPT
;)
I can connect the ftp if I disabled the iptables. Otherwise, it would
timeout when cuteftp made a list.
I enforced to use the PORT command , and it worked well.
I think the command channel established, however, the require was
filtered when the cuteftp make a data connection .So I want to know
whether the iptables can resolve the promblem?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Ftp (pass mode ) and Iptables
2006-01-06 6:30 ` ludi
@ 2006-01-06 9:37 ` Boryan Yotov
0 siblings, 0 replies; 6+ messages in thread
From: Boryan Yotov @ 2006-01-06 9:37 UTC (permalink / raw)
To: netfilter
ludi wrote:
> I'm sorry. I lost the rules of ftp I insert when I setup the proftp.
> iptables -A INPUT 1 -p tcp -s 0/0 -d $HOME_ADDR --dport 8888 -j ACCEPT
> ;)
>
> I can connect the ftp if I disabled the iptables. Otherwise, it would
> timeout when cuteftp made a list.
> I enforced to use the PORT command , and it worked well.
> I think the command channel established, however, the require was
> filtered when the cuteftp make a data connection .So I want to know
> whether the iptables can resolve the promblem?
What has tcp port 8888 to do with FTP? Or you changed the FTP server
settings to bind itself on port 8888? Correct?
The ipt_conntrack_ftp module is listenning for PORT and PASV on the
command channel running on port 21. If you bind your FTP server to
another port then you need to correct the include file of the module
as well:
From include/linux/netfilter_ipv4/ip_conntrack_ftp.h:
#define FTP_PORT 21
change to
#define FTP_PORT 8888
And then recompile the module.
I'm not sure and had no time to look if the module itself accept
parameters. If its true then you don't have to compile anything,
simply find out the ipt_conntrack_ftp insmod options.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-01-06 9:37 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-05 3:51 Ftp (pass mode ) and Iptables ludi
2006-01-05 9:14 ` Boryan Yotov
2006-01-05 10:18 ` Boryan Yotov
2006-01-05 17:15 ` Eric Marty
2006-01-06 6:30 ` ludi
2006-01-06 9:37 ` Boryan Yotov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox