1 .\" $OpenBSD: ftp-proxy.8,v 1.41 2004/07/06 19:49:11 dhartmei Exp $
2 .\" $DragonFly: src/libexec/ftp-proxy/ftp-proxy.8,v 1.5 2007/07/29 17:27:45 swildner Exp $
4 .\" Copyright (c) 1996-2001
5 .\" Obtuse Systems Corporation, All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
15 .\" 3. Neither the name of the University nor the names of its contributors
16 .\" may be used to endorse or promote products derived from this software
17 .\" without specific prior written permission.
19 .\" THIS SOFTWARE IS PROVIDED BY OBTUSE SYSTEMS AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED. IN NO EVENT SHALL OBTUSE OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 .Nd Internet File Transfer Protocol proxy server
42 .Op Fl D Ar debuglevel
46 .Op Fl R Ar address[:port]
53 is a proxy for the Internet File Transfer Protocol.
56 and expects to have the FTP control connection as described in
58 redirected to it via a
62 An example of how to do that is further down in this document.
64 The options are as follows:
67 Permit only anonymous FTP connections.
68 The proxy will allow connections to log in to other sites as the user
73 Any attempt to log in as another user will be blocked by the proxy.
75 Specify the local IP address to use in
77 as the source for connections made by
79 when connecting to destination FTP servers.
80 This may be necessary if the interface address of
81 your default route is not reachable from the destinations
83 is attempting connections to, or this address is different from the one
84 connections are being NATed to.
85 In the usual case this means that
87 should be a publicly visible IP address assigned to one of
88 the interfaces on the machine running
90 and should be the same address to which you are translating traffic
94 .It Fl D Ar debuglevel
95 Specify a debug level, where the proxy emits verbose debug output
100 Meaningful values of debuglevel are 0-3, where 0 is no debug output and
101 3 is lots of debug output, the default being 0.
103 Specify the named group to drop group privileges to, after doing
105 lookups which require root.
108 uses the default group of the user it drops privilege to.
110 Specify the upper end of the port range the proxy will use for the
111 data connections it establishes.
113 .Dv IPPORT_HILASTAUTO
118 Specify the lower end of the port range the proxy will use for all
119 data connections it establishes.
121 .Dv IPPORT_HIFIRSTAUTO
126 Activate network address translation
129 In this mode, the proxy will not attempt to proxy passive mode
132 In order for this to work, the machine running the proxy will need to
133 be forwarding packets and doing network address translation to allow
134 the outbound passive connections from the client to reach the server.
137 for more details on NAT.
138 The proxy only ignores passive mode data connections when using this flag;
139 it will still proxy PORT and EPRT mode data connections.
142 does not require any IP forwarding or NAT beyond the
144 necessary to capture the FTP control connection.
145 .It Fl R Ar address:[port]
146 Reverse proxy mode for FTP servers running behind a NAT gateway.
147 In this mode, no redirection is needed.
148 The proxy is run from
150 on the port that external clients connect to (usually 21).
151 Control connections and passive data connections are forwarded
156 lookups for logging and libwrap use.
158 the proxy does not look up hostnames for libwrap or logging purposes.
160 Source address to use for data connections made by the proxy.
161 Useful when there are multiple addresses (aliases) available
163 Clients may expect data connections to have the same source
164 address as the control connections, and reject or drop other
167 Specifies a timeout, in seconds.
168 The proxy will exit and close open connections if it sees no data
169 for the duration of the timeout.
170 The default is 0, which means the proxy will not time out.
172 Specify the named user to drop privilege to, after doing
174 lookups which require root privilege.
177 drops privilege to the user
180 Running as root means that the source of data connections the proxy makes
181 for PORT and EPRT will be the RFC mandated port 20.
182 When running as a non-root user, the source of the data connections from
184 will be chosen randomly from the range
191 With this option the proxy logs the control commands
192 sent by clients and the replies sent by the servers to
195 Use the tcp wrapper access control library
197 allowing connections to be allowed or denied based on the tcp wrapper's
202 The proxy does libwrap operations after determining the destination
203 of the captured control connection, so that tcp wrapper rules may
204 be written based on the destination as well as the source of FTP connections.
210 and requires that FTP connections are redirected to it using a
213 A typical way to do this would be to use a
216 .Bd -literal -offset 2n
218 rdr pass on $int_if proto tcp from any to any port 21 -> 127.0.0.1 port 8021
222 must then be configured to run
224 on the port from above using
225 .Bd -literal -offset 2n
226 127.0.0.1:8021 stream tcp nowait root /usr/libexec/ftp-proxy ftp-proxy
233 accepts the redirected control connections and forwards them
235 The proxy replaces the address and port number that the client
236 sends through the control connection to the server with its own
237 address and proxy port, where it listens for the data connection.
238 When the server opens the data connection back to this port, the
239 proxy forwards it to the client.
242 rules need to let pass connections to these proxy ports
247 above) in on the external interface.
248 The following example allows only ports 49152 to 65535 to pass in
250 .Bd -literal -offset indent
251 block in on $ext_if proto tcp all
252 pass in on $ext_if inet proto tcp from any to $ext_if \e
253 port > 49151 keep state
256 Alternatively, rules can make use of the fact that by default,
260 to allow the backchannel connections, as in the following example:
261 .Bd -literal -offset indent
262 block in on $ext_if proto tcp all
263 pass in on $ext_if inet proto tcp from any to $ext_if \e
264 user proxy keep state
267 These examples do not cover the connections from the proxy to the
269 If one does not pass outgoing connections by default additional rules
281 Extended Passive mode
283 is not supported by the proxy and will not work unless the proxy is run
284 in network address translation mode.
285 When not in network address translation mode, the proxy returns an error
286 to the client, hopefully forcing the client to revert to passive mode
289 EPSV will work in network address translation mode, assuming a
291 setup which allows the EPSV connections through to their destinations.
293 IPv6 is not yet supported.