Passive FTP sees remote's _internal_ IP!!??
Hello,
Quoted 2 lines · Maxime Ducharme
This happens when the remote server has a bad NAT configuration for FTP.
I fully agree, the problem seems to be on the server side.
Quoted 2 lines
Maybe SonicWALL is able to "fix" this itself, I dont know this product very well.
If it does so, I'd be happy to know how.
Quoted 8 lines
some suggestions :
1. Fix NAT for FTP on remote firewall
2. Configure remote server to explicitly send external IP for passive connections (most of FTP software allows to configure this)
Quoted 5 lines
3. Configure your FTP client to use active mode. If server is running on another port than 21, you must tell
ip_nat_ftpto "listen" for FTP traffic on this port. Someone on this list can tell us how ? (I dont remember how)
$ modprobe ip_conntrack_ftp ports=21,alternate_port $ modprobe ip_nat_ftp ports=21,alternate_port
Both commands are needed because AFAIK, ip_nat_ftp loads automatically ip_conntrack_ftp if not already loaded but does not pass the port list to it. Duh.
3b. Use extended passive mode (EPSV) if the client, the remote server and their firewall/NATs support it, because an EPSV reply does not contains the server address.
[Read on]
Quoted 8 lines
-----Message d'origine-----
De : [email protected] [mailto:[email protected]] De la part de gypsy Envoyé : 27 novembre, 2006 10:33
À : [email protected]
Objet : Passive FTP sees remote's _internal_ IP!!??We don't think this is a netfilter problem.
I agree, at least not on the client side.
Quoted 2 lines
The kernel should tell the
remote end that it can't use the "nonroutable" IP - shouldn't it?
No, the kernel is not supposed to do this. All the Netfilter FTP NAT helper module can do is translate "internal" addresses. However the wrong PASV reply comes from the outside.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
When the default GW is set to the linux box (192.168.223.254) and passive FTP to a remote server is initiated, the FTP fails after connection because the internal IP of the remote machine (192.168.1.11) is seen rather than its external IP. This problem occurs only when passive FTP is used.
Does this happen with any FTP server or only a specific one ?
Quoted 7 lines · Pascal Hambourg
Hello,
Quoted 2 lines · Maxime Ducharme
This happens when the remote server has a bad
NAT configuration for FTP.
Quoted 6 lines
I fully agree, the problem seems to be on the server side.
Quoted 2 lines
Maybe SonicWALL is able to "fix" this itself, I dont know this product very well.
If it does so, I'd be happy to know how.
SonicWALL does fix this, and we also would REALLY like to know how!! At the present time, our only "solution" is to reconfigure the clients to gateway to the SonicWALL because everyone's browser only does passive FTP.
Quoted 1 line
Does this happen with any FTP server or only a specific one ?
It happens with more than one server, but as far as I can tell, all Unix/Linux/*BSD FTP servers work; only MS Windows servers seem to fail. But because of the success with the SonicWALL, it does not seem likely that getting a remote site to change (or even look at) their setup will ever happen.
SPECULATION: In a google search for FTP servers, much comes up about configuring IIS FTP, so perhaps it is a difficult thing to do, and therefore it often is done wrongly.
Could it be worthwhile to run an FTP proxy such as
http://www.mcknight.de/jftpgw/jftpgw-0.13.4.tar.gz ? --
gypsy
Quoted 5 lines · gypsy
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
When the default GW is set to the linux box (192.168.223.254) and passive FTP to a remote server is initiated, the FTP fails after connection because the internal IP of the remote machine (192.168.1.11) is seen rather than its external IP. This problem occurs only when passive FTP is used.
We created a workaround for this by forcing all FTP to be active, not passive. We did this with jftpgw (
http://www.mcknight.de/jftpgw/jftpgw-0.13.5.tar.gz ) with a transparent proxy setup.
This is the configuration:
#!/bin/sh
./configure \
"--prefix=/usr" \
"--sysconfdir=/etc" \
"--localstatedir=/var" \
"--enable-crypt" \
"--enable-libwrap" \
"--with-logpath=/var/log" \
"$@"
make all install
And the jftpgw.conf:
<global>
serverport 21 defaultmode active debuglevel 8 changeroot never dropprivileges startsetup runasuser nobody loginstyle 0 logintime user commandtimeout 60 dnslookups no forwardlookups no hostcachetimeout 28800 initialsyst yes reverselookups no strictasciiconversion on syslogfacility daemon transfertimeout 120 transparent-proxy on welcomeline . </global> <servertype standalone> listen 192.168.223.254:2370 logstyle files logfile /var/log/jftpgw.log pidfile /var/run/jftpgw.pid
</servertype>
<servertype inetd>
logstyle syslog
</servertype>
<from 0.0.0.0/0>
access deny
</from>
<from 192.168.223.0/24>
access allow
</from>
And the iptables line:
iptables -t nat -A PREROUTING -p tcp -s 192.168.223.0/24 --dport 21 -j DNAT --to 192.168.223.254:2370
--
gypsy
Quoted 5 lines
SonicWALL does fix this, and we also would REALLY like to know how!! At the present time, our only "solution" is to reconfigure the clients to gateway to the SonicWALL because everyone's browser only does passive FTP.
I have an idea on how SonicWALL fix this, maybe it is programmed to detect badly configured FTP replies and correct them itself by replacing the PASV x.x.x.x command with the source IP found in the IP packet
something like :
if ip.sourceIP != ftp.reply.passiveIP then
ftp.reply.passiveIP = ip.sourceIP
I dont think iptables can do that, correct me if i'm wrong
I see you got a workaround, happy to hear this :)
Have a nice day
Maxime
Quoted 5 lines · gypsy
Quoted 2 lines
Does this happen with any FTP server or only a specific one ?
It happens with more than one server, but as far as I can tell, all Unix/Linux/*BSD FTP servers work; only MS Windows servers seem to fail.
And all the faulty servers send the same address 192.168.1.11 ?
If so, and if these servers are public, could you please indicate a couple of them so I can see myself ?