| Making FTP Secure While Keeping it Fun | |
|---|---|
| Description: Here's a way to make FTP connections secure while keeping hassles for your users down to a minimum | |
|
|
| Making FTP secure while keeping it fun | |
Making FTP secure while keeping it funIn the following we discuss the measures we took to implement transparently secure FTP for our users The trouble with FTPEverybody loves FTP. It's easy and FTP clients come bundled with lots of software, such a DreamWeaver. The problem is that anyone who happens to be between you and the machine your connecting to can listen in on the clear-text transmission of your username and password. FTP is insecure because it dates to elder days when the 'net was a tight-knit community. Newer and better protocols exist that allow your If you can't use SSH/SFTP, or others on your LAN don't have the ability/desire to do so, all is not lost--just read on Possible solutionsIt is possible to use FTP securely in a couple of ways, all of which involve encrypting the traffic between your computer or LAN and the remote system. To allow FTP clients on various types of systems (Linux, Mac and Windows) to work we examined:
IPSecUsing a VPN allows you to connect to the remote system or network as if it was on your local LAN, so FTP or any other connection will function normally while being transparently transported to the remote host over an encrypted channel. I've always found setting up IPsec to be a nightmare (kernel recompile? ugh, gimme a break) so pretty much skipped it. The fact is that we need access to a number of different hosts and can't setup IPSec on a number of these... PPP over SSH VPNUsing PPP over an SSH tunnel is actually pretty easy and the last distribution of the PPP package FTPSFTPS is an extension to FTP that allows connections between clients and server to be encrypted using SSL. The mod_tls module adds FTPS support to the ProFTPD FTP server. FTPS is supported by others as well (like WU FTPD) but we use ProFTPD. A number of FTP clients support FTP-SSL/FTP-TLS but of course, the whole point of this excercise was to find a means of transparently providing FTP security without getting on our web designers' nerves... So asking them to use another client is out of the question. A complete solutionFTPS made most sense to us but in order to make it work for everyone transparently we needed an extra ingredient: Tomas Svensson's excellent TLSWrap. TLSWrap is: a TLS/SSL FTP wrapper/proxy for UNIX and Windows, allowing you to use your favourite FTP client with any TLS/SSL-enabled FTP server By installing TLSWrap on one of our LAN systems, we can fully encrypt all the FTP traffic that travels on the 'net for any of our FTP clients. As an example, an old FTP client configuration might have been: username: ftpuser password: secret host: remotehost.example.com port:21 When TLSWrap is setup and running on our "ftpproxy" system (safely within our LAN), the FTP client's config changes to: username: ftpuser@remotehost.example.com:21 password: secret host: ftpproxy port:21 So, to the FTP client software, the connection is with the ftpproxy system on the local LAN. Behind the scenes, TLSWrap decomposes the new username (ftpuser@remotehost.example.com:21) and determines that it must make a secure connection to remotehost.example.com on port 21. It validates the username/password with the remotehost and proceeds to proxy FTP requests from the client through the SSL tunnel. The only restrition is that the client support the passive FTP (PASV) or Extended Passive (EPSV) connections (this is the case for most FTP clients). InstallationThe installation is comprised of two components:
TLSWrap installationTLSWrap runs on a number of system types, including Linux, *BSD and even Windows 2k (see the TLSWrap
In order to make starting and stoping the system easy, I setup this TLSWrap start/stop script by saving it to /etc/rc.d/init.d/tlswrap (RedHat system). You can then do any of the usual:
and on RedHat systems, use chkconfig to easily enable/disable TLSWrap on boot or when changing runlevels with:
Finally, edit /etc/rc.d/init.d/tlswrap and set LISTENON and PORT according to the IP address and port you want ProFTPD with FTPS support installationIf you've elected to use the ProFTPD FTP server, download the latest current source and ensure you have the SSL libraries (do a locate libssl.so to find out) installed before proceeding (use the openssl devel RPMs or get them from OpenSSL.org). Then untar the ProFTPD source and do:
The first line may not be required but, if you use it, make sure the LDFLAGS points to the location of your libssl.so installation directory. Follow the mod_tls insturctions and setup the /usr/local/etc/proftpd.conf file with a mod_tls section, like:
Notice that we are re-using the SSL certificate issued for our website (TLSRSACertificateFile). You can generate a self-signed certificate using OpenSSL if you don't have one (discussed elsewhere, just make sure the ProFTPD config points to the right place. If your site doesn't have too much traffic, you can use xinetd to start the FTP server. Just set "ServerType inetd"
into a file called /etc/xinetd.d/proftp. The FTPS server will be available (by default on port 21) as soon as you restart xinetd. Testing your installationStart by testing the remote server by connecting to the appropriate port (21 by default) using telnet:
and you should see something like:
See that banner? Good, type quit and hit enter. Now make certain tlswrap is started on the ftpproxy system and telnet over to the appropriate port (7000 if you used our /etc/rc.d/init.d/tlswrap default):
If everything is working all right, you should see:
Now enter valid user and pass (password) lines and you should be able to connect to the remote server through SSL
Securing the systemA few tips to ensure a safe journey. If you can, make sure you set "TLSRequired on" in the ProFTPD config as in the example above--this forces SSL connections only to the server. Also use the remote server's /etc/hosts.allow and /etc/hosts.deny files to your advantage. Add
to /etc/hosts.deny and put a specific line, such as:
in /etc/hosts.allow to allow connections only from valid clients. Also ensure that only LAN users can connect to the TLSWrap port on the ftpproxy, either by having the server listen on an internal IP/machine or by using an appropriate firewall config. |
|
| Level: | Article |
| Additional Article Data | |
| Level: | Article |
| Comments |
|---|
|
|
|
The comments are owned by the poster. We aren't responsible for their content.
|
| Jump to section |
|---|

