413 / 303 / 80 

DeleGate as a FTP server/proxy/cache/router/gateway

Yuaka Sato, Dec. 2014

Usage Examples

the simplest proxy server
configuration
-P8021
SERVER=ftp
client examples
% ftp localhost 8021
ftp> user ftp@ftpServer
% ftp localhost 8021
ftp> cd //ftpServer
% wget "ftp://ftp%ftpServer@localhost:8021/source/README"

the simplest origin server
-P21
SERVER=ftp
MOUNT="/* /*"

the simplest origin server with authentication
-P21
SERVER=ftp
MOUNT="/* /*"
AUTHORIZER="-list{User:Pass}"

the simplest FTPS origin server
-P990
SERVER=ftp
MOUNT="/* /*"
STLS=fcl

the simplest origin server with START-TLS
-P21
SERVER=ftp
MOUNT="/* /*"
STLS=-fcl

a littile complex origin server
-P21
SERVER=ftp
MOUNT="/a/* /x/*"
MOUNT="/b/* /y/*"

the simplest reverse proxy server
-P21
SERVER=ftp://ftpServer

the next simplest reverse proxy server
-P21
SERVER=ftp
MOUNT="/* ftp://ftpServer/*"

a little complex reverse proxy server
-P21
SERVER=ftp
MOUNT="/c/* ftp://ftpServer1/*"
MOUNT="/d/* ftp://ftpServer2/*"

the simplest FTP to FTPS gateway
-P21
SERVER=ftp
MOUNT="/* ftps://ftpServer/*"
STLS=fsv

IPv4/v6 gateway
-P21,__21
SERVER=ftp
MOUNT="/* ftp://ftpServer/*"

MITM proxy
-P990
SERVER=ftp
MOUNT="/* ftps://ftpServer/*"
STLS=fcl,fsv

the simplest FTP to sftp gateway
-P21
SERVER=ftp
MOUNT="/* sftp://sftpServer/*"

transparent proxy server
-P21
SERVER=ftp://odst.-

routing via another DeleGate
-P8021
SERVER=ftp
PROXY=delegateFtpProxy:8021

routing via SOCKS proxy
-P8021
SERVER=ftp
SOCKS=socksServer:1080

routing via SSL tunnel
-P8021
SERVER=ftp
SSLTUNNEL=httpProxy:8080

the simplest FTP to LPR gateway
-P21
SERVER=ftp
MOUNT="/printer1/* lpr://lprServer1/*"

the simplest HTTP to ftp gateway
-P80
SERVER=http
MOUNT="/* ftp://ftpServer/*"

tunneling over HTTP (using GET and POST method)
client side
-P8021
SERVER=ftp
MOUNT="/* ftpxhttp://hostY:80/*"
server side (hostY)
-P80
SERVER=ftpxhttp
MOUNT="/* ftp://ftpServer/*"



A real example
The following is a real example of a configuration of DeleGate on ftp://ftp2.delegate.org running as a caching-FTP-reverse-proxy. It expires the cache by 1 seconds because it is just for a backup server of ftp://ftp.delegate.org, that is, it returns cached data only when the target server is down.
[the content of ftpd.sh for DeleGate as a FTP server]
#/bin/sh
exec /path/of/delegated \
 -r \
 -P21 \
 SERVER=ftp \
 RELIABLE="*" \
 RELAY=no \
 CACHE=do \
 EXPIRE=1s \
 MOUNT="/* ftp://ftp.delegate.org/*" \
 +=common.cnf

[the content of common.cnf file shared among DeleGates]
 DGROOT=/my-home/delegate \
 ADMIN=ysato@delegate.org \
 LOGDIR="log[date+/y%y/m%m/%d]" \
 RESOLV=cache,file,dns \
 RES_NS=192.168.1.1 \