1 .\" $OpenBSD: ftp-proxy.8,v 1.40 2004/03/16 08:50:07 jmc Exp $
2 .\" $DragonFly: src/libexec/ftp-proxy/ftp-proxy.8,v 1.1 2004/09/21 21:25:28 joerg 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
41 .Op Fl D Ar debuglevel
49 is a proxy for the Internet File Transfer Protocol.
52 and expects to have the FTP control connection as described in
54 redirected to it via a
58 An example of how to do that is further down in this document.
60 The options are as follows:
63 Permit only anonymous FTP connections.
64 The proxy will allow connections to log in to other sites as the user
69 Any attempt to log in as another user will be blocked by the proxy.
71 Specify the local IP address to use in
73 as the source for connections made by
75 when connecting to destination FTP servers.
76 This may be necessary if the interface address of
77 your default route is not reachable from the destinations
79 is attempting connections to, or this address is different from the one
80 connections are being NATed to.
81 In the usual case this means that
83 should be a publicly visible IP address assigned to one of
84 the interfaces on the machine running
86 and should be the same address to which you are translating traffic
90 .It Fl D Ar debuglevel
91 Specify a debug level, where the proxy emits verbose debug output
96 Meaningful values of debuglevel are 0-3, where 0 is no debug output and
97 3 is lots of debug output, the default being 0.
99 Specify the named group to drop group privileges to, after doing
101 lookups which require root.
104 uses the default group of the user it drops privilege to.
106 Specify the upper end of the port range the proxy will use for the
107 data connections it establishes.
109 .Dv IPPORT_HILASTAUTO
114 Specify the lower end of the port range the proxy will use for all
115 data connections it establishes.
117 .Dv IPPORT_HIFIRSTAUTO
122 Activate network address translation
125 In this mode, the proxy will not attempt to proxy passive mode
128 In order for this to work, the machine running the proxy will need to
129 be forwarding packets and doing network address translation to allow
130 the outbound passive connections from the client to reach the server.
133 for more details on NAT.
134 The proxy only ignores passive mode data connections when using this flag;
135 it will still proxy PORT and EPRT mode data connections.
138 does not require any IP forwarding or NAT beyond the
140 necessary to capture the FTP control connection.
144 lookups for logging and libwrap use.
146 the proxy does not look up hostnames for libwrap or logging purposes.
148 Specifies a timeout, in seconds.
149 The proxy will exit and close open connections if it sees no data
150 for the duration of the timeout.
151 The default is 0, which means the proxy will not time out.
153 Specify the named user to drop privilege to, after doing
155 lookups which require root privilege.
158 drops privilege to the user
161 Running as root means that the source of data connections the proxy makes
162 for PORT and EPRT will be the RFC mandated port 20.
163 When running as a non-root user, the source of the data connections from
165 will be chosen randomly from the range
172 With this option the proxy logs the control commands
173 sent by clients and the replies sent by the servers to
176 Use the tcp wrapper access control library
178 allowing connections to be allowed or denied based on the tcp wrapper's
183 The proxy does libwrap operations after determining the destination
184 of the captured control connection, so that tcp wrapper rules may
185 be written based on the destination as well as the source of FTP connections.
191 and requires that FTP connections are redirected to it using a
194 A typical way to do this would be to use a
197 .Bd -literal -offset 2n
199 rdr pass on $int_if proto tcp from any to any port 21 -> 127.0.0.1 port 8021
203 must then be configured to run
205 on the port from above using
206 .Bd -literal -offset 2n
207 127.0.0.1:8021 stream tcp nowait root /usr/libexec/ftp-proxy ftp-proxy
214 accepts the redirected control connections and forwards them
216 The proxy replaces the address and port number that the client
217 sends through the control connection to the server with its own
218 address and proxy port, where it listens for the data connection.
219 When the server opens the data connection back to this port, the
220 proxy forwards it to the client.
223 rules need to let pass connections to these proxy ports
228 above) in on the external interface.
229 The following example allows only ports 49152 to 65535 to pass in
231 .Bd -literal -offset indent
232 block in on $ext_if proto tcp all
233 pass in on $ext_if inet proto tcp from any to $ext_if \e
234 port > 49151 keep state
237 Alternatively, rules can make use of the fact that by default,
241 to allow the backchannel connections, as in the following example:
242 .Bd -literal -offset indent
243 block in on $ext_if proto tcp all
244 pass in on $ext_if inet proto tcp from any to $ext_if \e
245 user proxy keep state
248 These examples do not cover the connections from the proxy to the
250 If one does not pass outgoing connections by default additional rules
263 Extended Passive mode
265 is not supported by the proxy and will not work unless the proxy is run
266 in network address translation mode.
267 When not in network address translation mode, the proxy returns an error
268 to the client, hopefully forcing the client to revert to passive mode
271 EPSV will work in network address translation mode, assuming a
273 setup which allows the EPSV connections through to their destinations.
275 IPv6 is not yet supported.