📄 ftp.proxy.1
字号:
.de ES.sp.in +0.5i...de EE.in -0.5i.sp...de EX.sp.in +0.5i\\$1.in -0.5i.sp...TH FTP.PROXY 1 "23 JANUARY 2003".SH NAMEftp.proxy \- FTP proxy server.SH SYNOPSIS\fBftp.proxy\fR [\fIoptions\fR] [\fIserver\fR].SH DESCRIPTION.I ftp.proxyis a proxy server for a subset of the file tranfer protocol described inRFC 959.It forwards traffic between a client and a \fIserver\fR without looking too muchif both hosts do real FTP.The FTP server can be either given on the command line or supplied by theclient..PP.I ftp.proxycan be started from a TCP superserver like.IR inetd (1)or.IR tcpproxy (1).but can also bind to a TCP/IP port on it's own and run in standalone (ordaemon) mode..SS "Protocol Support".I ftp.proxysupports the following FTP commands:.PP.RSABOR, ACCT, APPE, CDUP, CWD, DELE, FEAT, LIST,.brMDTM, MKD, MODE, NLIST, NOOP, PASS, PASV, PORT,.brPWD, QUIT, RETR, REST, RNFR, RNTO, RMD, SITE,.brSIZE, SMNT, STAT, STOR, SYST, TYPE, USER, XCUP,.brXCWD, XMKD, XPWD, XRMD.br.PP.RETransfer of structured data is notsupported..SS "Command Parameters"By default \fIftp.proxy\fR does not accept blanks in command parameters.This is to protect your UNIX server against users who work on computers wherethese things are usual..PPTo allow blanks the option \fB-b\fR must be given on the command line.Notice that blanks at the beginning or end of the parameter are stillnot supported..PPThe `SITE' is in neither case affected by this limitation, \fIftp.proxy\fRaccepts always blanks in `SITE' parameters..PPThe option -y enables \fIftp.proxy\fR to accept data connections from differentremote interfaces.Try to avoid using this option, because it can causesecurity problems (see HISTORY for details)..SS "Server Selection"If client-side server selection it turned on with the \fB-e\fR optionthe user must select the FTP server he wants to use withthe `@' notation.Instead of specifying the real ftp server on the command line the userhas to connect tothe gateway machine where \fIftp.proxy\fR is running and to enter the usernamein the form.EX \fIremote-user\fR@\fIremote-ftp.server\fRThe password that is send to the proxy server is the password requiredfor logging into \fIremote-ftp-server\fR with the account \fIremote-user\fR..PPIn situations where the FTP client doesn't support usernames containingan `@' the percent sign `%' might be used for that..SS "Access Control"If an access control program is given with the \fB-a\fR option on the commandline the connection data is passed to the acp before the server is contacted.The acp should return 0 as exit code to grant access and another value todeny..PPThe access controller receives the following variables:.TP\fBPROXY_INTERFACE\fR, \fBPROXY_PORT\fRinterface and port where the client is connected to the proxy..TP\fBPROXY_CLIENT\fR, \fBPROXY_CLIENTNAME\fRIP number an name of the connected client..TP\fBPROXY_SERVER\fR, \fBPROXY_SERVERPORT\fR, \fBPROXY_SERVERNAME\fRIP number, port and name of the FTP server the client wants to contact..TP\fBPROXY_SERVERLOGIN\fRthe supplied username for the FTP server..TP\fBPROXY_USERNAME\fR, \fBPROXY_PASSWD\fRsupplied username and password for usage of the proxy server..PPThe values for \fBPROXY_USERNAME\fR and \fBPROXY_PASSWD\fR are taken fromthe supplied remote username and password if they contain a colon `:'.In this case the local authentication data is taken from the left side ofthe colon and the remaining right side is passed on to the server..PPFurthermore the acp's stdout is connected to the FTP client andit's stderr is read by \fIftp.proxy\fR which writes the acp's stderr outputto syslog..PPNotice also that a non-zero acp exit code signals \fIftp.proxy\fR thatsomething's wrong and that \fIftp.proxy\fR should terminate..SS "Connection Translation"Beginning with version 1.1.6 \fIftp.proxy\fR supports connectiontranslation programs (ctp's).A ctp can completly overwrite the user's server selection and login.If configured the ctp is called before the acp.It receives the same environment variables like the acp andreturns server and login information that should \fIftp.proxy\fRfor the server connection on it's stdout.The format of the ctp output lines is.EX "\fIvariable\fR [\fB<whitespace>\fR]\fB=\fR [\fB<whitespace>\fR] \fIvalue\fR"where \fIvariable\fR is one of.PP.RSSERVERNAME, SERVERLOGIN, SERVERPASSWD, SERVERPORT .PP.REand \fIvalue\fR the corresponding value.Alternativly to these four variables you can use the shorter forms.PP.RSSERVER, LOGIN, PASSWD, PORT .PP.REas variable names.Furthermore the case of the variable names doesn't matter and any whitespacearound \fIvalue\fR is ignored..PPThe ctp can deny the proxy request by exiting with an non-zero exit code,In which case \fIftp.proxy\fR drops the connection immediately.Alternativly the ctp can also print a line starting with \fB-ERR\fR,which is written to syslog before the connection is closed..SS "Command Control"If a command control program (ccp) is given with the \fB-c\fR option thisprogram is called for the FTP commands.PP.RSAPPE, CDUP, CWD, DELE, LIST, MDTM, MKD,.brNLST, RETR, RNFR, RNTO, RMD, SIZE, STAT,.brSTOR, STOU, XCUP, XCWD, XMKD, XRMD.br.PP.REThe ccp returns an exit code of 0 to grant and any other to deny access (theexit code to the `QUIT' command is ignored).For the ccp the same variables as for acp's are set with the additionof.TP\fBPROXY_COMMAND\fR, \fBPROXY_PARAMETER\fRFTP command and parameter (if set)..TP\fBPROXY_SESSION\fRa unique identifier for the proxy session..TP\fBPROXY_CCPCOLL\fR,the client's number of collisions with the ccp's permission rules (numberof `permission denied' responses)..PPThe ccp's stdout and stderr are connected to \fIftp.proxy\fR.A one line message written to stdout by the ccp goes to syslog, whilea message one stderr is sent to the client.If this message does not contain a status \fIftp.proxy\fR substitutes a`553' code.If the message is empty the client gets a simle `553 permission denied'.Notice that the stderr message is only used if the ccp returns an exit codeother the zero..PPOn normal program termination (`QUIT' command or timeout) the ccp is calledwith the command `+EXIT' to do some final clean up.It is not reliable that the ccp receives the `+EXIT' event.There are lots of possiblities that the proxy terminates without generatingit, e.g. client timeout, server error or signal reciption by the proxy..SS "Monitor Mode"The \fB-m\fR option puts \fIftp.proxy\fR into the monitor mode.\fIftp.proxy\fR will then try to keep track of the client's current directoryon the server side.With this information the file parameter for the commands.PP.RSAPPE, CDUP, CWD, DELE, LIST, MDTM, MKD.brNLST, RETR, RNFR, RNTO, RMD, SIZE, STOR,.brXCUP, XCWD, XMKD, XRMD.br.PP.REis converted into an absolute path.This value is then used in syslog messages and given to a ccp in the\fBPROXY_FTPPATH\fR variable.Furthermore the variable \fBPROXY_FTPHOME\fR contains the user's initialdirectory which is assumed to be his home directory..PPThe `LIST' and `NLIST' command may have a parameter or not.If it is absent \fiftp.proxy\fR sets the parameter to `*' but thisaffects only the \fBPROXY_FTPPATH\fR variable, not the command that is sentto the server..PPFor the `CDUP' command \fBPROXY_FTPPATH\fR contains the full path of thetarget directory..PPMonitoring may not work with all server systems since the output of the`PWD' command which is used by \fIftp.proxy\fR to get the current directoryin not completely defined.If the directory can not be clearly determined \fIftp.proxy\fR willterminate..SH "CONFIGURATION FILE"\fIftp.proxy\fR can take most of its command line options also froma configuration file which can be set with the \fB-f\fR option..PPThe following options can be set:.TP\fBacp\fR \fI/path/to/acp\fRsets the path to the access control program (\fB-a\fR option)..TP\fBallow-anyremote\fR yes|noif enabled \fIftp.proxy\fR does not check the remote's end in dataconnection, required for some bad multi-homed servers and FXP (\fB-y\fRoption)..TP\fBallow-blanks\fR yes|noallows blanks in FTP command parameters (\fB-b\fR option)..TP\fBallow-passwdblanks\fR yes|noallows blanks in the FTP login password (\fB-B\fR option)..TP\fBbind\fR \fIportnum\fRsets the port number to which \fIftp.proxy\fR should bind to,activates daemon mode (\fB-D\fR option)..TP\fBccp\fR \fI/path/to/ccp\fRsets the path to the command control command (\fB-c\fR option)..TP\fBctp\fR \fI/path/to/ctp\fRsets the path to the connection translation program (\fB-x\fR option)..TP\fBdebug\fR yes|noturns debugging mode on or off (\fB-d\fR option)..TP\fImonitormode\fR yes|noenables monitor mode (\fB-m\fR option)..TP\fIproxy-routing\fR yes|noif enabled \fIftp.proxy\fR uses the last `@' in the username to determineto which server it should connect.This make proxy hopping (or routing) possible (\fB-u\fR option)..TP\fIselectserver\fR yes|noenables client side server selection, disables the \fBserver\fR option(\fB-e\fR option)..TP\fIserver\fR \fIftpserver\fRsets the connection's FTP server, disables \fBselectserver\fR..TP\fIserverlist\fR \fIlist-of-allowed-server\fRspecifies a command separated list of servers to which the clients areallowed to connect (\fB-s\fR option)..TP\fIsourceip\fR \fIip-number\fRdefines the IP address for the outgoing control connection to the remoteserver, which also determines the local IP address for data transmissions..TP\fItimeout\fR \fItimeout\fRset the timeout in seconds..TP\fIxferlog\fR \fIfilename\fRsets the location of the xferlog file and enables xferlog logging..PPNotice that the file can contain comments and blank lines (usual UN*X-style)but \fIftp.proxy\fR terminates immediately with an error code if anunknown or invalid configuration option is found..SS "Interface specific configurations"\fIftp.proxy\fR's configuration file supports interface specific configurationsections.Such section begin with a line that starts with.TP[\fIinterface-ip\fR].PPfollowed by the configuration options for connections on this specificinterface.\fIftp.proxy\fR checks for such sections immidiately after the clientconnection is accepted.If it finds at least one interface specific section in the configurationfile but none for the current interface it considers itself to be notconfigured for it and drops the connection sending a `421 not available'message to the client..PP\fIftp.proxy\fR accepts all global configuration options fromabove (allthough not all make sense, e.g. \fBbind\fR) in interface specificsection.That is, \fIftp.proxy\fR can have completely different configurations ondifferent interfaces.But to deactivate a non-boolean option, e.g. \fBctp\fR you can not simplygive the option without a value, this would be considered as `badconfiguration option'.Instead you must supply a single dash `\fB-\fR' to clear an option..SS "Configuration checking"\fIftp.proxy\fR prints an error message and terminates immediately if it findsan unknown or bad configuration option.More worse, these error messages are printed to \fIftp.proxy\fR's stderrand not to syslog which makes it a little bit difficult to observe.\fIftp.proxy\fR addresses this issue by supporting the \fB-F\fR option..PPThe \fB-F\fR option sets the configuration file and the `check-and-print'option, that is \fIftp.proxy\fR will only read, check and print it'sconfiguration options as they are set after reading the configuration.An interface IP-number may be given as optional command line parameterto make \fIftp.proxy\fR print the configuration for this particularinterface..SH OPTIONSThe following options are available:.TP\fB-a\fR \fIacp\fRspecify an access control program that grants or denies access via\fIftp.proxy\fR..TP\fB-b\fRallows blanks in filenames..TP\fB-B\fRallows blanks and other special charackters in passwords. .TP\fB-c\fR \fIccp\fRsets a command control program that grants or denies the usage of FTPcommands through \fIftp.proxy\fR..TP\fB-d\fRenter debug mode, the communication between server and client is writtento stderr..TP\fB-f\fR \fIconfigfile\fRsets \fIftp.proxy\fR's configuration file..TP\fB-F\fR \fIconfigfile\fR [\fIinterface\fR]read and print the proxy configuration for \fIinterface\fR from\fIconfigfile\fR.If \fIinterface\fR is missing the global configuration is printed.This is a check-only option, after the configuration has been printed\fIftp.proxy\fR terminates, no connection handling is done..TP\fB-e\fRenable client-side server selection.With this option the \fIserver\fR argument isn't accepted..TP\fB-l\fRsets logging of most of the FTP commands..TP\fB-m\fRsets the monitor mode..TP\fB-p\fR \fIport\fRtell \fIftp.proxy\fR to use \fIport\fR as source port for datatransfers (using port number 20 is FTP standard).Keep in mind that port numbers below 1024 require root permissions..TP\fB-q\fR \fIsourceip\fRsets the IP number for the outgoing control connection..TP\fB-s\fR \fIlist\fRthe FTP server selected by the client must match one of the patternfrom the comma separated \fIlist\fR.The wildcards `*' and `?' can be used..TP\fB-t\fR \fItimeout\fRspecify a different FTP timeout in seconds than the default of 900 (15 minutes)..TP\fB-u\fRsearch for the last appearance of an '@' in the username. This allows theuse of usernames with a '@' in it. Be careful with this option, this can beabused to do 'proxy hopping'!.TP\fB-v\fR \fIprefix\fRset \fIprefix\fR as variable prefix for the variable passwd to the accessand command control program..TP\fB-x\fR \fIctp\fRset a connection translation program to overwrite the server and logininformation supplied by the user..TP\fB-X\fR \fIfile\fRwrite xferlog loggin to \fIfile\fR..TP\fB-V\fRshow version number.TP\fB-y\fRallow any data ports on any remote interfaces (dangerous!)..TP\fb-z\fR \fIsize\fRsets the amount of data in bytes ftp.proxy tries to read with one system callfrom either the client or the server.The default is 1024 bytes, valid values range from 1 to 4096.Playing around with larger values than the default may increase theproxy's data troughput..PP.SH "SYSLOG"\fIftp.proxy\fR reports to FTP log facility on linux and BSD systems andDaemon log facility on other..SH "AUTHOR"Andreas Schoenberg <asg@ftpproxy.org>.SH "SEE ALSO".IR inetd (1),.IR tcpproxy (1),.IR syslogd (8),.IR syslog.conf (5).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -