Re: FTP port usage control

From: Alun Jones (alun@texis.com)
Date: 10/04/02


From: alun@texis.com (Alun Jones)
Date: Fri, 04 Oct 2002 14:11:21 GMT


In article <4be701c26b66$8f1db440$2ae2c90a@phx.gbl>, "Theodore Hahn"
<starfish@hahnalei.net> wrote:
>I would like to restrict the variable ports used by FTP to
>one or a few specific ports above 1024. I cannot find
>where to lock down the variable data port usage as opposed
>to the control port. I only need to service one person
>accessing the FTP server at one time. I do not want to
>open up my firewall to a vast range of port
>possibilities.

Actually, if you don't open up a few ports, then you'll have trouble. Every
TCP socket that gets closed gracefully (and that's how FTP indicates the
successful end of a data transfer or file listing) remains in the "TIME_WAIT"
state for a period equal to 2*MSL (Maximum Segment Lifetime) - four minutes.
A compliant FTP client will use, as its local port, the same port number as
its control connection is bound to, and will then connect to the port (and
address) that is supplied in response to the PASV command. Obviously, if you
only allow one port through your firewall, then you will have to wait four
minutes after the end of the first transfer before you can safely initiate the
second transfer. If you allow only two ports, then you will have to wait
until four minutes after the end of the first transfer before you can start
the third transfer.

So, if your clients are using the PASV command correctly, you will have to
open up a relatively wide range of ports.

It may be better, if you're looking to avoid port hijacking, to set the range
allocated to ephemeral ports to be something other than the default. There is
a registry setting to do this. Other third party FTP servers, our own
included, are able to be configured to choose their own range of ports for
PASV responses, separate from the system's usual range of ephemeral ports.

Alun.
~~~~

[Please don't email posters, if a Usenet response is appropriate.]

-- 
Texas Imperial Software   | Try WFTPD, the Windows FTP Server. Find us at
1602 Harvest Moon Place   | http://www.wftpd.com or email alun@texis.com
Cedar Park TX 78613-1419  | VISA/MC accepted.  NT-based sites, be sure to
Fax/Voice +1(512)258-9858 | read details of WFTPD Pro for XP/2000/NT.


Relevant Pages

  • Re: Newbie question about ports.
    ... Can you do a CVSup to update your ports via http? ... Cvsup does not support http, but neither does it use ftp (see man cvsup, ... openable through your firewall. ...
    (freebsd-questions)
  • RE: FTP Server on SBS 2003
    ... When I access the ftp site ... In the properties the ftp is set to "all assigned ports" should this ... > You connect the SBS to a third party Router and forward port 21 to the SBS ... The network administrator of the server network can consult the ...
    (microsoft.public.windows.server.sbs)
  • RE: Passive FTP
    ... Some FTP servers are able to set the passive ports he can use, ... Onderwerp: Passive FTP ... Dit E-mail bericht is slechts bestemd voor de persoon aan wie het is ...
    (Security-Basics)
  • Re: FTP server behind a PF firewall (including NAT)
    ... Philip> have exactly the same problem. ... Philip> huge range of high ports, and I can't find any information ... IPFW is a real pain compared to most modern firewall software. ... address-translate) the FTP data transfers. ...
    (comp.unix.bsd.freebsd.misc)
  • Re: cant connect to ftp server
    ... Most of the other FTP server ports are intended to run standalone -- ... that is the ftpd process runs continually and manages all of the ... standalone FTP daemon -- only one process at a time can take control ...
    (freebsd-questions)

Quantcast