Login Scripts for FTP Proxy Servers
The login script defines how the FTP client should communicate with the FTP proxy server to connect to the desired FTP server. The FTP proxy server acts as an FTP server. The FTP client connects to it and sends it all required parameters: user name and password for proxy server (optional), address and port of desired FTP server, and user name and password for this FTP server. The FTP proxy server connects to the desired FTP server and forwards all commands and replies between the FTP client and the FTP server.
Description of Login Script
The first line of the login script is always "Connect to:" followed by a server address and port delimited by ':' character. The server address and port define where should the FTP client connect to. The server address must be defined. If the server port is not defined, it is assumed to be 21.
All other lines contain commands which are sent to the server. Each line contains only one command. Lines can contain variables which are expanded before sending commands to the server.
We have two types of variables: optional and obligatory. They differ in action taken when the variable is used in a command (line) but it is not defined (specified by user). If an optional variable is not defined, the whole line (command) is skipped. If an obligatory variable is not defined, a dialog box is opened and user must specify a value for this variable (or cancel connection). Variables are prefixed by '$' character and enclosed in parenthesis (e.g. "$(Password)"). The escape sequence for '$' character is "$$".
Lines starting with "3xx:" are skipped if the command from the previous line was skipped or if the server reply to this command was not 3xx. The 3xx reply means that the first digit of the FTP reply is '3' (it means "partial success"). It is used in command sequences and it means: continue with next command in sequence (e.g. the user name is accepted, send me a password).
Restrictions for the first line of the login script: the server address can be defined only as text without variables or as text containing only the ProxyHost or Host variable; the server port can be defined only as decimal number or as the ProxyPort or Port variable.
The login sequence is considered to be successful (user is successfully connected to the FTP server) if no reply to sent commands is 4xx or 5xx (4xx is transient error, 5xx is permanent error) and the reply to the last sent command is 2xx (2xx is success).
Variables
We have the following variables:
Variable | Description |
---|---|
ProxyHost | obligatory; the name or IP address of the proxy server (firewall) |
ProxyPort | always defined; the port number where is the proxy server (firewall) listening; the default port is 21 (if it is not specified by user) |
ProxyUser | optional; the user name for the proxy server (firewall) |
ProxyPassword | obligatory; the password for the proxy server (firewall) |
Host | always defined; the name or IP address of the desired FTP server |
Port | always defined; the port number where is the desired FTP server listening; the default port is 21 (if it is not specified by user) |
User | obligatory; the user name for the desired FTP server |
Password | obligatory; the password for the desired FTP server |
Account | obligatory; the account for the desired FTP server |
Samples
Login script for direct connection (without proxy server):
Connect to: $(Host):$(Port) USER $(User) 3xx: PASS $(Password) 3xx: ACCT $(Account)
Login script for the FTP proxy server type "USER user@host:port":
Connect to: $(ProxyHost):$(ProxyPort) USER $(ProxyUser) 3xx: PASS $(ProxyPassword) USER $(User)@$(Host):$(Port) 3xx: PASS $(Password) 3xx: ACCT $(Account)