Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to access an ftps server (vsftpd) on a vendor's site. The vendor has a firewall in front of the ftps server and 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. When looking at it from the vendor's firewall perspective, should these ports be opened up for both inbound and outbound traffic?

What about ports for the DATA channel? Do I have to open all ports above 1000? And should I do it for both inbound and outbound traffic?

TIA for your help.

share|improve this question

6 Answers 6

up vote 4 down vote accepted

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.

share|improve this answer
2  
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 '09 at 16:12

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.

share|improve this answer

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.).

share|improve this answer

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.

share|improve this answer

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).

share|improve this answer

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.

share|improve this answer
6  
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 '09 at 15:33
    
Sorry then. I will leave this post though, in case others have the same confusion. –  Brent May 21 '09 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 '09 at 5:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.