conf/143085: ftp-proxy(8) rc(8) with multiple instances

Marcelo Rossi marcelorossi at
Fri Jan 22 16:00:10 UTC 2010

>Number:         143085
>Category:       conf
>Synopsis:       ftp-proxy(8) rc(8) with multiple instances
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jan 22 16:00:09 UTC 2010
>Originator:     Marcelo Rossi
>Release:        7.2
FreeBSD 7.2-STABLE FreeBSD 7.2-STABLE #0: Tue Jan 19 07:21:37 BRST 2010     prisma at  i386

We can do inbound or outbound proxy of ftp connections with ftp-proxy(8). But the /etc/rc.d/ftp-proxy just allow one instance of the proxy.

If we need to run an inbound **AND** outbound proxy, we need two instances of ftp-proxy. So I have modified the /etc/rc.d/ftpproxy and /etc/rc.conf to allow more than one instance.

We can add at /etc/rc.conf some variables:
ftpproxy_exec="exec1 exec2 execN"
ftpproxy_exec2=-p8010 -R ftpserverhost

The var 'ftpproxy_exec' is a list with the instance names, the script (/etc/rc.d/ftp-proxy) will search for the vars 'ftpproxy_{LIST_ITEM}'

The 'ftpproxy_{LIST_ITEM}' will contain the same thing that normally contains the 'ftpproxy_flags' var, or a empty string.


Patch attached with submission follows:

--- /etc/rc.d/ftp-proxy 2010-01-22 12:32:52.000000000 -0200
+++ /etc/rc.d/ftp-proxy 2010-01-22 13:16:01.000000000 -0200
@@ -14,4 +14,20 @@
 load_rc_config $name
+       if [ ${#ftpproxy_exec} = "0" ]
+       then
+               $command $ftpproxy_flags
+       else
+               for exec in $ftpproxy_exec ; do
+                       eval args_exec=\$ftpproxy_$exec
+                       $command $args_exec
+               done
+       fi
 run_rc_command "$1"
--- /etc/defaults/rc.conf 2010-01-22 12:34:49.000000000 -0200
+++ /etc/defaults/rc.conf 2010-01-22 13:12:03.000000000 -0200
@@ -174,6 +174,9 @@
 pflog_flags=""                 # additional flags for pflogd
 ftpproxy_enable="NO"           # Set to YES to enable ftp-proxy(8) for pf
 ftpproxy_flags=""              # additional flags for ftp-proxy(8)
+#ftpproxy_exec="exec1 exec2"    # multiple instances of ftp-proxy.
+#ftpproxy_exec1=""              # first instance
+#ftpproxy_exec2="-p8010 -R host"# second instance
 pfsync_enable="NO"             # Expose pf state to other hosts for syncing
 pfsync_syncdev=""              # Interface for pfsync to work through
 pfsync_syncpeer=""             # IP address of pfsync peer host


More information about the freebsd-bugs mailing list