35

I need to access an FTPS server (vsftpd) on a vendor's site. The vendor has a firewall in front of the ftps server. I have a firewall in front of my FTPS client.

I understand that ports 990, 991 and maybe 989 need to be opened up for control traffic.

I have some questions:

  1. When looking at it from the vendor's firewall perspective, should these ports be opened up for both inbound and outbound traffic?
  2. What about ports for the DATA channel?
  3. Do I have to open all ports above 1000?
  4. Should I do it for both inbound and outbound traffic ?

7 Answers 7

20

My understanding of FTP over SSL (ftps) is that it doesn't work well with firewalls and NAT. In an ordinary FTP session, the information about data connections is read, and for NAT modified, by the firewall in order for the firewall to dynamically open the needed ports. If that information is secured by SSL, the firewall can't read it or change it.

Using SFTP, or scp, makes the network administrator's job a lot easier - everything happens on the server's port 22, and the transaction follows the normal client/server model.

One thing not mentioned is whether or not your firewall is performing NAT and whether or not it is static NAT or dynamic NAT. If your client machine has a static address or is being statically NATed, you may not need to make any firewall changes, assuming you allow all outbound traffic and the server operates only in Passive mode (PASV).

To know exactly what ports you will need to open, you will need to either:

a) talk to the vendor to get specifics about how their system has been configured.

b) Use a protocol analyzer, such as tcpdump or wireshark, to look at the traffic, both from outside your firewall and inside your firewall

You need to find out which port is the Control Connection. You list 3, which seems odd to me. Assuming the server only works in PASV (passive) mode, you need to figure out how the server is configured to allocated DATA ports. Have they locked down the DATA channel to a single inbound port? Have they locked down the DATA channel to a small range or ports?

With these answers, you can start configuring your firewall.

1
  • 3
    passive mode FTPS would use a control port over port# 1024 and so it would work better with a firewall than non-passive. the client tells port 21 what upper-bound port to open and so you can configure the client to say "control is on port 2000 or 2001" and then the server will open outbound port 2000 or 2001. most FTP clients support defining a specific range of ports for "control" to be on and that makes firewall definitions easy.
    – djangofan
    Aug 24, 2009 at 16:12
31

I believe the ports around 990 were for implicit SSL, which was an old non-standard way of doing FTP/SSL. The "right" way these days is explicit SSL, which means you still connect on port 21 and then negotiate SSL before sending your goodies. To support connections through a firewall, you need to use PASV mode and hard set the data ports to be used.

I believe you need at least one port per data connection you want to support. If it's just you, you're probably fine only opening a few extra ports. Specifically for me, I use 21000-21010.

In vsftpd.conf, I have these two lines (along with all the other stuff to support SSL):

pasv_min_port=21000

pasv_max_port=21010

On my firewall, I have a public static IP with one-to-one/static NAT to the internal IP and only tcp ports 21, 21000-21010 open.

12

I know this is an extremely old thread, however..

Please note that SFTP is completely different from FTPS. ( SSH vs SSL )

FTPS worsk in 2 way. Explicit and Implicit. Explicit is less secure because after the initial handshake skips encryption during data transfers [if data encryption is maintained is configurable on server side with PROT P], while the Implicit keeps the encryption of the data after handshake too. The default Explicit FTPS port is 21. The default Implicit port is 990 ( after handshake it will switch automatically to 989 for data transmission, if not configured differently). While port 21 is generally accepted as EXPLICIT FTPS and 990 as IMPLICIT FTPS, in reality whichever port you will configure, except 990/989, will lead to EXPLICIT FTPS while ONLY 990/989 will be accepted as IMPLICIT FTPS.

So, to answer your question: - depending on the FTPS Server configuration, you'll need to open port 21 or 990/989. However, just to be sure, you should contact the FTPS Server admin and ask for directions. Also, keep in mind that for passive mode, as with every other FTP software, you'll have to open additional ports (TCP/UDP) usually something from the range 64000-65000.

3

Basically ftps is almost useless, because you must make embarrassing requests to firewall admins. The advice to restrict ports to 10 is good. Much more, it gets pathetic.

sftp is a lot better in theory. But you need a viable sftp server, e.g. one that restricts clients to their own home directory.

Depending on the application, consider HTTPS. A file upload is really simple, and a download obviously is as well. If you're scripting the FTP anyway, it's probably going to be easier altogether to script an HTTPS file upload.

Automated FTP is a sign of a design problem. I noticed this when dealing with a total of about a dozen vendors that 'required' a place I worked to do automated FTP (for VERY important things), and when making dozens of customers do it with that same shop (a design failure for about 20 distinct uses I witnessed). It was easy to convince most app guys to use HTTPS (usually at the mention, they said "wait, there's no reason we're not just having them get it with HTTPS from the web server we're already serving them data on?"), except a few that gave responses like "well, we already have these scripts that seem to work, and no one on our team is really good with scripting so we cant really make any changes" (a team of 5-10 programmers, pretending to not understand that they can write it in a language of their choice, because they don't know how to write a trivial program from scratch.).

1

The vendor may be able to configure a narrow port range for the DATA connection ports, if they haven't already. Then you can open the same range on your end, for the hosts that need such access. PASV mode should be used.

-4

Port 22 is standard since the SSH daemon on UNIX has a SFTP module that you can enable to basically make a explicit SFTP server. If you want to run a implicit FTP server with Filezilla then you can run it on any port you want but there is a catch: if you use FileZilla client you need to specify the ftp site URL as ftps://mysite.com:8086 rather than putting the port in the separate port field that the FileZilla client provides.

For the explicit option you only need ONE port: 22. For the implicit option you only need to have the firewall open for the control port: 8086 (which forwards internally to port 21 on your filezilla server).

1
  • 7
    The question asked about FTPS, not SFTP. Jan 12, 2015 at 19:39
-10

if ftps is the same as sftp, then you only need to be able to access port 22 on the vendor's site.

On your end you should configure your firewall to allow port 22 outgoing, and related incoming traffic. This will allow communication on any incoming port that is related to the initial outgoing connection on port 22.

3
  • 13
    SFTP is not the same as ftps (codeguru.com/csharp/.net/net_general/internet/article.php/…). SFTP is the file transfer protocol used with SSH. FTPS is FTP with SSL, FTPS starts a new DATA connection on a new random port, which makes it tough to deploy behind firewalls, but I can't remove the firewall in this situation.
    – user3293
    May 21, 2009 at 15:33
  • 2
    Sorry then. I will leave this post though, in case others have the same confusion.
    – Brent
    May 21, 2009 at 15:54
  • It's a hugely common confusion. From the firewall side, sftp is way easier to allow, except that it's built on a protocol that is intended for login access. Negligent for independent security groups to allow without significant independent validation. Difficult for sysadmins to find/configure a reasonable sftp server for untrusted clients. Any discussion of sftp or ftps must mention the other protocol becauuse confusion is SO common.
    – carlito
    Jun 29, 2009 at 5:16

You must log in to answer this question.