=head1 NAME

ftpgw.tcl --- an FTP gateway script to allow tunnelling

=head1 SYNOPSIS

=over 4

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

=back

=head1 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 B<-v> option turns on verbose logging to stderr.

If the B<-p> option is specified then the argument is a range of port
numbers in the form I<xxx>-I<yyy>. All passive-mode data ports will be in
the range I<xxx> to I<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 B<Zebedee>.

=head1 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.
