ports/143302: Update port www/lighttpd: start with clean environment

Philippe Pepiot phil at philpep.org
Wed Jan 27 23:30:02 UTC 2010


>Number:         143302
>Category:       ports
>Synopsis:       Update port www/lighttpd: start with clean environment
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jan 27 23:30:01 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Philippe Pepiot
>Release:        FreeBSD 8.0-RELEASE-p2 i386
>Organization:
>Environment:
System: FreeBSD shen.philpep.org 8.0-RELEASE-p2 FreeBSD 8.0-RELEASE-p2 #0 r202418: Fri Jan 15 22:29:53 CET 2010 root at shen.philpep.org:/usr/obj/usr/src/sys/SHEN i386


	
>Description:
	Lighttpd start with environment from parent process. With this patch
	lighttpd can start with clean (or controlled) environment. For example
	if your cgi script need $PATH, just set lighttpd_allowed_env="PATH" on your
	/etc/rc.conf file.
	For security reason, It's not a good idea to put root user environment into
	lighttpd process.
>How-To-Repeat:
	
>Fix:

	

--- www_lighttpd.patch begins here ---
diff -ru lighttpd.orig/files/lighttpd.sh.in lighttpd/files/lighttpd.sh.in
--- lighttpd.orig/files/lighttpd.sh.in	2010-01-27 23:55:24.000000000 +0100
+++ lighttpd/files/lighttpd.sh.in	2010-01-27 23:56:09.000000000 +0100
@@ -26,6 +26,7 @@
 : ${lighttpd_enable="NO"}
 : ${lighttpd_conf="%%PREFIX%%/etc/lighttpd.conf"}
 : ${lighttpd_pidfile="/var/run/${name}.pid"}
+: ${lighttpd_allowed_env=""}
 
 command=%%PREFIX%%/sbin/lighttpd
 command_args="-f ${lighttpd_conf}"
@@ -39,6 +40,21 @@
 check_cmd="checkconfig"
 extra_commands="reload check"
 
+start_precmd="${name}_start_precmd"
+
+lighttpd_start_precmd()
+{
+    E=
+    for i in ${lighttpd_allowed_env}; do
+        eval _val="\$$i"
+        if [ "${_val}_x" != "_x" ]; then
+            eval _add="$i=$_val"
+            E="${E} ${_add}"
+        fi
+    done
+    command="env - ${E} ${command}"
+}
+
 checkconfig()
 {
 	echo "Performing sanity check on ${name} configuration:"
--- www_lighttpd.patch ends here ---


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



More information about the freebsd-ports-bugs mailing list