ftpgw.tcl: A simple FTP tunnelling gateway

# NAME

ftpgw.tcl — an FTP gateway script to allow tunnelling

# SYNOPSIS

ftpgw.tcl [-p <port-range>] [-v] [listen-port [ftpd-host [ftpd-port]]]

# DESCRIPTION

This program is a simple FTP gateway that intercepts PORT commands and passive-mode responses so that it can set up handlers for the data streams associated with them. It then rewites these control lines so that traffic to an FTP server apparently comes from the gateway process. Similarly a client sees a remote port that it can access for passive mode transfers. This allows the FTP control (but not data) channel to be tunnelled and encrypted.

By default the program listens on port 2121 and will redirect traffic to a local FTP server on port 21. These values can be overridden on the command line. The -v option turns on verbose logging to stderr.

If the -p option is specified then the argument is a range of port numbers in the form xxx-yyy. All passive-mode data ports will be in the range xxx to yyy and the response lines will be re-written to redirect a client to the corresponding port on 127.0.0.1 (localhost). This means that passive-mode data connections can be tunnelled in addition to the control connection.

For examples of how to use this program see the documentation for Zebedee.

# COPYRIGHT

Copyright (c) 2000 by Neil Winton. All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.