[pkg-lighttpd] Bug#715205: lighttpd: parse lighttpd config file to run as the configured user

Nathael Pajani nathael.pajani at ed3l.fr
Sun Nov 23 16:00:41 UTC 2014


Package: lighttpd
Version: 1.4.35-4
Followup-For: Bug #715205

Dear Maintainer,

I also need to run lighttpd as different user, here is a fix for the init script, which
alows for
directory /var/run/lighttpd to be created as the configured user.

This script should be completed to changed ownership of the differnet other parts, like
/var/log/lighttpd
and /var/cache/lighttpd/
(I did it manually once, and it is kept accross restarts, only the /var/run part was
constently replaced
by the init script at each restart, but all parts should be automated for start, restart,
and reload
operations)

Thanks
(see patch below)

/----------------------------------------
--- /etc/init.d/lighttpd    2014-08-18 05:39:29.000000000 +0200
+++ lighttpd    2014-11-23 15:10:57.498054850 +0100
@@ -20,8 +20,9 @@
 DESC="web server"
 PIDFILE=/var/run/$NAME.pid
 SCRIPTNAME=/etc/init.d/$NAME
+CONFIG=/etc/lighttpd/lighttpd.conf

-DAEMON_OPTS="-f /etc/lighttpd/lighttpd.conf"
+DAEMON_OPTS="-f $CONFIG"

 test -x $DAEMON || exit 0

@@ -32,12 +33,19 @@
    $DAEMON -t $DAEMON_OPTS > /dev/null || exit $?
 }

+username=www-data
+groupname=www-data
+if [ -f $CONFIG ]; then
+   username=$(grep "^server.username" $CONFIG | sed -e 's/.*= "\(.*\)".*/\1/')
+   groupname=$(grep "^server.groupname" $CONFIG | sed -e 's/.*= "\(.*\)".*/\1/')
+fi
+
 if [ "$1" != status ]; then
    # be sure there is a /var/run/lighttpd, even with tmpfs
    # The directory is defined as volatile and may thus be non-existing
    # after a boot (DPM §9.3.2)
    if ! dpkg-statoverride --list /var/run/lighttpd >/dev/null 2>&1; then
-       install -d -o www-data -g www-data -m 0750 "/var/run/lighttpd"
+       install -d -o $username -g $groupname -m 0750 "/var/run/lighttpd"
    fi
 fi
/----------------------------------------

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.1.0-rc4-nath-64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages lighttpd depends on:
ii  init-system-helpers         1.21
ii  libattr1                    1:2.4.47-2
ii  libbz2-1.0                  1.0.6-7+b1
ii  libc6                       2.19-13
ii  libfam0                     2.7.0-17.1
ii  libldap-2.4-2               2.4.40-2
ii  libpcre3                    1:8.35-3.1
ii  libssl1.0.0                 1.0.1j-1
ii  libterm-readline-perl-perl  1.0303-1
ii  lsb-base                    4.1+Debian13+nmu1
ii  mime-support                3.57
ii  perl                        5.20.1-2
ii  zlib1g                      1:1.2.8.dfsg-2

Versions of packages lighttpd recommends:
pn  spawn-fcgi  <none>

Versions of packages lighttpd suggests:
ii  apache2-utils  2.4.10-7
ii  openssl        1.0.1j-1
ii  rrdtool        1.4.8-1.1+b1

-- no debconf information


-- 
Nathaël PAJANI - ED3L - Techno-Innov
Internet : http://www.ed3l.fr - http://www.techno-innov.fr



More information about the pkg-lighttpd-maintainers mailing list