Source: icecc
Version: 1.2-1
Severity: normal
Tags: patch

Icecream is writing its log files directly to /var/log, even though it
is running as the icecc user which has no permission to write to
/var/log.  This problem has already been reported in Ubuntu here:

https://bugs.launchpad.net/ubuntu/+source/icecc/+bug/1671926

I've attached a patch to fix it.  As suggested in the Ubuntu bug, I have
added a HUP signal when the logs are rotated.  I have also added
/etc/default files to allow easily turning up the log level.

-- System Information:
Debian Release: buster/sid
  APT prefers bionic-updates
  APT policy: (500, 'bionic-updates'), (500, 'bionic-security'), (500, 
'bionic'), (100, 'bionic-backports')
Architecture: amd64 (x86_64)

Kernel: Linux 4.15.0-48-generic (SMP w/1 CPU core)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru icecc-1.2/debian/changelog icecc-1.2/debian/changelog
--- icecc-1.2/debian/changelog  2018-12-21 08:29:36.000000000 +0000
+++ icecc-1.2/debian/changelog  2019-05-14 12:12:44.000000000 +0000
@@ -1,3 +1,10 @@
+icecc (1.2-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Write log files to a location with appropriate permissions 
+
+ -- Matthew Exon <mat@exoniceserver1>  Tue, 14 May 2019 12:12:44 +0000
+
 icecc (1.2-1) unstable; urgency=medium
 
   [ Pino Toscano ]
diff -Nru icecc-1.2/debian/icecc.conf icecc-1.2/debian/icecc.conf
--- icecc-1.2/debian/icecc.conf 2018-12-21 07:52:33.000000000 +0000
+++ icecc-1.2/debian/icecc.conf 2019-05-14 12:12:44.000000000 +0000
@@ -8,7 +8,7 @@
 # icecc daemon log file
 #
 # ICECC_LOG_FILE="/var/log/iceccd.log"
-ICECC_LOG_FILE="/var/log/iceccd.log"
+ICECC_LOG_FILE="/var/log/icecc/iceccd.log"
 
 #
 # Identification for the network the scheduler and daemon run on.
@@ -47,7 +47,7 @@
 # icecc scheduler log file
 #
 # ICECC_SCHEDULER_LOG_FILE="/var/log/icecc_scheduler.log"
-ICECC_SCHEDULER_LOG_FILE="/var/log/icecc_scheduler.log"
+ICECC_SCHEDULER_LOG_FILE="/var/log/icecc/icecc_scheduler.log"
 
 #
 # If the daemon can't find the scheduler by broadcast (e.g. because
diff -Nru icecc-1.2/debian/icecc.iceccd.default 
icecc-1.2/debian/icecc.iceccd.default
--- icecc-1.2/debian/icecc.iceccd.default       1970-01-01 00:00:00.000000000 
+0000
+++ icecc-1.2/debian/icecc.iceccd.default       2019-05-14 12:12:44.000000000 
+0000
@@ -0,0 +1,7 @@
+# /etc/default/icecc
+
+# Defaults for icecc initscript.  This file is sourced by
+# /bin/sh from /etc/init.d/iceccd
+
+# Options to pass to iceccd
+#ICECCD_OPTS=
diff -Nru icecc-1.2/debian/icecc.iceccd.init icecc-1.2/debian/icecc.iceccd.init
--- icecc-1.2/debian/icecc.iceccd.init  2018-12-21 07:52:33.000000000 +0000
+++ icecc-1.2/debian/icecc.iceccd.init  2019-05-14 12:12:44.000000000 +0000
@@ -12,7 +12,7 @@
 
 DAEMON=/usr/sbin/iceccd
 CONFIGFILE=/etc/icecc/icecc.conf
-DEFAULTFILE=/etc/default/icecc
+DEFAULTFILE=/etc/default/iceccd
 
 # Read configuration files
 [ -r $CONFIGFILE ] && . $CONFIGFILE
@@ -59,7 +59,7 @@
        fi
 
        start-stop-daemon --start --quiet --exec $DAEMON -- \
-       -d $logfile $nice $scheduler $netname -u icecc $basedir $maxjobs 
$noremote
+       -d $logfile $nice $scheduler $netname -u icecc $ICECCD_OPTS $basedir 
$maxjobs $noremote
 }
 
 stop_icecc_daemon() {
diff -Nru icecc-1.2/debian/icecc.icecc-scheduler.default 
icecc-1.2/debian/icecc.icecc-scheduler.default
--- icecc-1.2/debian/icecc.icecc-scheduler.default      1970-01-01 
00:00:00.000000000 +0000
+++ icecc-1.2/debian/icecc.icecc-scheduler.default      2019-05-14 
12:12:44.000000000 +0000
@@ -0,0 +1,7 @@
+# /etc/default/icecc
+
+# Defaults for icecc initscript.  This file is sourced by
+# /bin/sh from /etc/init.d/icecc-scheduler
+
+# Options to pass to icecc-scheduler
+#ICECC_SCHEDULER_OPTS=
diff -Nru icecc-1.2/debian/icecc.icecc-scheduler.init 
icecc-1.2/debian/icecc.icecc-scheduler.init
--- icecc-1.2/debian/icecc.icecc-scheduler.init 2018-12-21 07:52:33.000000000 
+0000
+++ icecc-1.2/debian/icecc.icecc-scheduler.init 2019-05-14 12:12:44.000000000 
+0000
@@ -12,7 +12,7 @@
 
 SCHEDULER=/usr/sbin/icecc-scheduler
 CONFIGFILE=/etc/icecc/icecc.conf
-DEFAULTFILE=/etc/default/icecc
+DEFAULTFILE=/etc/default/icecc-scheduler
 
 # Read configuration files
 [ -r $CONFIGFILE ] && . $CONFIGFILE
@@ -36,7 +36,7 @@
        : > $ICECC_SCHEDULER_LOG_FILE
        chown icecc $ICECC_SCHEDULER_LOG_FILE
        start-stop-daemon --start --quiet --chuid icecc \
-       --exec $SCHEDULER -- -d $logfile $netname
+       --exec $SCHEDULER -- $ICECC_SCHEDULER_OPTS -d $logfile $netname
 }
 
 stop_icecc_scheduler() {
diff -Nru icecc-1.2/debian/icecc.logrotate icecc-1.2/debian/icecc.logrotate
--- icecc-1.2/debian/icecc.logrotate    2018-12-21 07:52:33.000000000 +0000
+++ icecc-1.2/debian/icecc.logrotate    2019-05-14 12:12:44.000000000 +0000
@@ -7,7 +7,9 @@
 
 /var/log/iceccd.log {
        missingok
-       copytruncate
+       postrotate
+           /usr/bin/killall -HUP iceccd
+       endscript
        notifempty
 }
 
diff -Nru icecc-1.2/debian/icecc.postinst icecc-1.2/debian/icecc.postinst
--- icecc-1.2/debian/icecc.postinst     2018-12-21 07:52:33.000000000 +0000
+++ icecc-1.2/debian/icecc.postinst     2019-05-14 12:12:44.000000000 +0000
@@ -12,6 +12,7 @@
 ICECC_GROUP=icecc
 ICECC_USER=icecc
 ICECC_HOME=/var/cache/icecc
+ICECC_LOG=/var/log/icecc
 
 # create group
 getent group $ICECC_GROUP > /dev/null || ( echo Creating $ICECC_GROUP group... 
; \
@@ -24,6 +25,9 @@
 
 chown $ICECC_USER:$ICECC_GROUP $ICECC_HOME
 
+mkdir -p $ICECC_LOG
+chown $ICECC_USER:$ICECC_GROUP $ICECC_LOG
+
 if [ -x "/etc/init.d/icecc-scheduler" ]; then
         update-rc.d icecc-scheduler defaults >/dev/null
         # disable icecc-scheduler either when upgrading from < 1.0.0, or when
diff -Nru icecc-1.2/debian/icecc.postrm icecc-1.2/debian/icecc.postrm
--- icecc-1.2/debian/icecc.postrm       2018-12-21 07:52:33.000000000 +0000
+++ icecc-1.2/debian/icecc.postrm       2019-05-14 12:12:44.000000000 +0000
@@ -24,6 +24,7 @@
                fi
 
                rm -rf /var/cache/icecc
+               rm -rf /var/log/icecc
                ;;
        remove)
                ;;

Reply via email to