Skip to contentSkip to conversation

passive ftp

DISCUSSION IT Clown 4 participants 7 messages Apr 17, 2004 – Apr 18, 2004

lore
Share & tools
lore

IT Clown

author
#0 lore raw

Hi

I am having some trouble to access passive mode ftp sites.I have a firewall with ip forwarding enabled.When a pc on the network want to access passive ftp servers i need to do the following in my rules ( on the server ):

-A OUTPUT -p tcp -m multiport --dport 21,20 -j ACCEPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A FORWARD -i eth0 -j ACCEPT
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT

But i do not want every query to be forwarded i only want say ftp access to be forwarded. Why does the following not work ( on the server ):

-A FORWARD -p tcp -i eth0 -o ppp0 --dport 20 -j ACCEPT -A FORWARD -p tcp -i eth0 -o ppp0 --dport 21 -j ACCEPT -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT Regards
______________________________________________________________
Herbalife Independent Distributor http://www.healthiest.co.za

#1 lore raw

Is there a more active mailing list for security?

This list seems a little slow...maybe one or two questions a day. Haven't seen a reply yet. Would anyone know what a more active mailing list would be where I could receive help?

James

#2 lore raw

RE: Is there a more active mailing list for security?

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Krunk
Sent: Saturday, April 17, 2004 11:04 AM
To: [email protected]
Subject: Is there a more active mailing list for security?

This list seems a little slow...maybe one or two questions a day. Haven't seen a reply yet. Would anyone know what a more active mailing list would be where I could receive help?

James

Just have patience my friend. You won't find any help better or quicker for iptables/netfilter anywhere else. Why not try posting your question again. Anthony Stone must have gone somewhere for the weekend but perhaps someone else can help you.

#3 lore raw
In reply to IT Clown

This did it for me:
IPT=/usr/sbin/iptables
EXTIF=ppp0 # interface facing outward
EXTIP=xxx.xxx.xxx.xxx
INTIF=eth1
INTNET=<ip assigned to eth1>
TCP="ftp ftp-data"
for i in $TCP
do
$IPT -A OUTPUT -o $EXTIF -p tcp -s $EXTIP --dport $i --syn -m state --state NEW -j ACCEPT $IPT -A FORWARD -i $INTIF -p tcp -s $INTNET --dport $i --syn -m state --state NEW -j ACCEPT done

You can put any number of services defined in /etc/services in the TCP list and free them up with the loop.

Quoted 22 lines · IT Clown

Hi

I am having some trouble to access passive mode ftp sites.I have a firewall with ip forwarding enabled.When a pc on the network want to access passive ftp servers i need to do the following in my rules ( on the server ):

(quoted diff) +0 -4
-A OUTPUT -p tcp -m multiport --dport 21,20 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i eth0 -j ACCEPT
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT

But i do not want every query to be forwarded i only want say ftp access to be forwarded. Why does the following not work ( on the server ):

(quoted diff) +0 -3
-A FORWARD -p tcp -i eth0 -o ppp0 --dport 20 -j ACCEPT
-A FORWARD -p tcp -i eth0 -o ppp0 --dport 21 -j ACCEPT
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT

Regards
______________________________________________________________
Herbalife Independent Distributor http://www.healthiest.co.za

author
#4 lore raw
In reply to IT Clown

Sorry i left out something about the following rule:

Review

Quoted 3 lines
(quoted diff) +0 -3
-A FORWARD -p tcp -i eth0 -o ppp0 --dport 20 -j ACCEPT
-A FORWARD -p tcp -i eth0 -o ppp0 --dport 21 -j ACCEPT
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT

When i set the rule i can connect to passive mode ftp servers but when it needs to list the contents of the ftp server it will list nothing or i will get disc from the ftp server.

Quoted 23 lines · On Sat, 17 Apr 2004 19:50:35 +0200 "IT Clown" <[email protected]> wrote:

Hi

I am having some trouble to access passive mode ftp sites.I
have a firewall with ip forwarding enabled.When a pc on the
network want to access passive ftp servers i need to do the
following in my rules ( on the server ):

(quoted diff) +0 -4
-A OUTPUT -p tcp -m multiport --dport 21,20 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i eth0 -j ACCEPT
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT

But i do not want every query to be forwarded i only want say ftp access to be forwarded. Why does the following not
work ( on the server ):

(quoted diff) +0 -3
-A FORWARD -p tcp -i eth0 -o ppp0 --dport 20 -j ACCEPT
-A FORWARD -p tcp -i eth0 -o ppp0 --dport 21 -j ACCEPT
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
Quoted 2 lines

Regards

______________________________________________________________

Quoted 3 lines

Herbalife Independent Distributor
http://www.healthiest.co.za

______________________________________________________________
Herbalife Independent Distributor http://www.healthiest.co.za

#5 lore raw
In reply to IT Clown

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of IT Clown
Sent: Saturday, April 17, 2004 10:51 AM
To: [email protected]
Subject: passive ftp

Hi

I am having some trouble to access passive mode ftp sites.I have a firewall with ip forwarding enabled.When a pc on the network want to access passive ftp servers i need to do the following in my rules ( on the server ):

-A OUTPUT -p tcp -m multiport --dport 21,20 -j ACCEPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A FORWARD -i eth0 -j ACCEPT -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT

But i do not want every query to be forwarded i only want say ftp access to be forwarded. Why does the following not work ( on the server ):

-A FORWARD -p tcp -i eth0 -o ppp0 --dport 20 -j ACCEPT -A FORWARD -p tcp -i eth0 -o ppp0 --dport 21 -j ACCEPT -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT Regards
______________________________________________________________
Herbalife Independent Distributor http://www.healthiest.co.za

Be sure you have the two support modules you need loaded:

$MODPROBE ip_nat_ftp
$MODPROBE ip_conntrack_ftp

Passive FTP data transfers take place on a "high port" that the server recommends to the client, and the client then establishes the new connection on that high port that the server uses as well. Neither Port 20 or 21 are used during this part of the process. Therefore, the ftp connection tracking modules are necessary for all this to happen.

#6 lore raw

NAT FTP module problem

I have a problem inserting the ipt_nat_module

insmod ip_nat_ftp
Using /lib/modules/2.4.20/kernel/net/ipv4/netfilter/ip_nat_ftp.o /lib/modules/2.4.20/kernel/net/ipv4/netfilter/ip_nat_ftp.o: init_module:
Device or resource busy
Hint: insmod errors can be caused by incorrect module parameters, including invalid IO or IRQ parameters.
You may find more information in syslog or the output from dmesg

Any ideas?

-----Mensaje original-----
De: [email protected] [mailto:[email protected]] En nombre de Mark E. Donaldson Enviado el: sábado, 17 de abril de 2004 21:06
Para: 'IT Clown'; [email protected]
Asunto: RE: passive ftp

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of IT Clown
Sent: Saturday, April 17, 2004 10:51 AM
To: [email protected]
Subject: passive ftp

Hi

I am having some trouble to access passive mode ftp sites.I have a firewall with ip forwarding enabled.When a pc on the network want to access passive ftp servers i need to do the following in my rules ( on the server ):

-A OUTPUT -p tcp -m multiport --dport 21,20 -j ACCEPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A FORWARD -i eth0 -j ACCEPT -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT

But i do not want every query to be forwarded i only want say ftp access to be forwarded. Why does the following not work ( on the server ):

-A FORWARD -p tcp -i eth0 -o ppp0 --dport 20 -j ACCEPT -A FORWARD -p tcp -i eth0 -o ppp0 --dport 21 -j ACCEPT -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT Regards
______________________________________________________________
Herbalife Independent Distributor http://www.healthiest.co.za

Be sure you have the two support modules you need loaded:

$MODPROBE ip_nat_ftp
$MODPROBE ip_conntrack_ftp

Passive FTP data transfers take place on a "high port" that the server recommends to the client, and the client then establishes the new connection on that high port that the server uses as well. Neither Port 20 or 21 are used during this part of the process. Therefore, the ftp connection tracking modules are necessary for all this to happen.