Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Jan 2010 15:54:39 GMT
From:      Marcelo Rossi <marcelorossi@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   conf/143085: ftp-proxy(8) rc(8) with multiple instances
Message-ID:  <201001221554.o0MFsdHJ014743@www.freebsd.org>
Resent-Message-ID: <201001221600.o0MG09Dt012527@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jan 22 16:00:09 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Marcelo Rossi
>Release:        7.2
>Organization:
>Environment:
FreeBSD mt.mii.com.br 7.2-STABLE FreeBSD 7.2-STABLE #0: Tue Jan 19 07:21:37 BRST 2010     prisma@mt.mii.com.br:/usr/obj/usr/src/sys/KERNEL.MT  i386

>Description:
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_exec1=""
ftpproxy_exec2=-p8010 -R ftpserverhost
ftpproxy_execN="-p8020"

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.
>How-To-Repeat:

>Fix:


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 @@
 command="/usr/sbin/ftp-proxy"
 
 load_rc_config $name
+
+start_cmd=start_func
+
+start_func()
+{
+       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

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001221554.o0MFsdHJ014743>