(E-Mail Removed) wrote in message news:<(E-Mail Removed). com>...
> Hi all
>
> I'm hoping someone can help me with the firewall settings on my
> server. I'm running Redhat 9. FTP is the standard vsftpd. I'm
> struggling to get the firewall settings right to allow an incoming
> passive FTP connection. I'm setting things with lokkit which shows a
> character based 'graphical' UI. I assume this is just a friendly way
> of editing /etc/sysconfig/iptables. I haven't directly edited iptables
> yet but perhaps I need to.
>
> In lokkit, I leave the security level 'high' and then go to
> 'Customize' and check the main protocols I want and add several more
> to the 'Other ports line'. I add pop3:tcp imap:tcp and a few others.
> The RH docs suggest that checking 'FTP' is enough to allow passive FTP
> but not Active. It seems to achieve the opposite for me. Active works
> fine. Passive works if I have 'No Firewall'.
>
> I don't know much about it but I wonder if its something to do with
> port 20. I have now added ftp-data:tcp to the 'Other Ports' but that
> hasn't helped. ...
Not sure how Lokkit appends (?) this rule, but believe it's this one:
-A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 20 --syn -j ACCEPT
>... The client hangs when doing an ls after 'Entering
> Passive Mode' and then 'Connecting to' a five digit port number.
This sequence not clear to me.
a) client sees 'Entering Passive Mode'
b) client sends ls (to port 21 on server) to get the list of files
c) client sees 'Connecting to' port XXXXX -- then hangs
Your client is trying to connect to the high #'rd port your server
told it to use for a data channel.
Your firewall is not letting in SYN packets to random high #'rd ports,
I believe.
>
> The lines which I think are relevant in iptables are:
>
> -A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 20 --syn -j ACCEPT
in passive mode, your server will be listening on a _random_ high #'rd
(>1023) port, so this "normal" channel will not be used to tranfer
data
> -A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 21 --syn -j ACCEPT
this is the control (command) channel which must be established at the
start of a session
>
> If you're wondering why I'm even bothering with FTP rather than the
> more secure SFTP via SSH its because I have a few friends / customers
> who just need to upload html files and vsftpd allows me to easily
> define a fake root to keep them in their own area. I don't think I can
> do that effectively with ssh.
>
> Thanks
> Ross
Haven't checked the RH docs (which one are you referring to?) but
three things:
-- I'm hardly familiar with Lokkit, much more comfortable with editing
config files and ACL's
-- RH admits that Lokkit is a weeney and not particularly useful for
anything that deviates from the pre-canned rules it uses.
-- The above 2'nd line is, in fact, what you would use to set up an
ftp session, but the first is only useful in active (ie., normal) mode
to support setting up data tranfer, not incoming connection
establishment (syn) where no one is listening, which is what it seems
to suggest.
I'm running RH8 and my iptables -L output is a little different from
yours, but just some minor differences in output format, I think.
Unless you're really comfortable using the iptables command to set up
what you want, you may want to try something like Firewall Builder:
http://www.fwbuilder.org/
For some quick/to the point background try:
http://www.unixcities.com/ftp-and-firewall/
http://www.cisco.com/warp/public/759..._2-3_oneb.html
Have you thought of running Squid in front of your FTP server? It
would allow you to set up ACL's and/or authentication logins, I
believe (been awhile since I've looked at it).
Since no one else responded, I did.
Hoping the more informed post,
prg
email above disabled