* Firewalling
-> My FTP server is behind a firewall. What ports should I open?
First, you have to open port 21 TO the FTP server. You also have to allow
connections FROM (not to) port 20 (of the FTP server) to everywhere. That's
enough to handle the "active" mode. But that's not enough to handle all
types of clients. Most clients will use another mode to transmit data called
'passive' mode. It's a bit more secure than 'active' mode, but you need to
open more ports on your firewall to have it work.
So, open some ports TO the FTP server. These ports should be > 1023. It's
recommended to use at least twice the max number of clients you are
expecting. So, if you accept 200 concurrent sessions, opening ports 50000 to
50400 is ok.
Then, run pure-ftpd with the '-p' switch followed by the range configured in
your firewall. Example : /usr/local/sbin/pure-ftpd -p 50000:50400 &
Unlike some popular belief, the MORE opened ports you have for passive FTP,
the MORE your FTP server will be secure, because the LESS you are vulnerable
to data hijacking.
If your firewall also does network translation (NAT), you have to enable
port forwarding for all passive ports.
On the client side, if a client if behind a firewall, that firewall must
understand the FTP protocol. On Linux firewalls (iptables), just load
the ip_conntrack_ftp and ip_nat_ftp modules. On OpenBSD firewalls (PF),
redirect all traffic to port 21, to ftp-proxy.
|