[Pkg-clamav-devel] Bug#636877: /etc/default/clamav-milter no longer used

Sebastian Andrzej Siewior sebastian at breakpoint.cc
Thu Mar 13 21:56:19 UTC 2014


On 2011-08-06 19:20:32 [+0200], martin f krafft wrote:
> /etc/default/clamav-milter used to define the RWGROUP for the milter
> socket (for postfix). This seems to be handled in clamav-milter.conf
> now.

With #636881 fixed, the patch below could be used to get rid of
etc/default/clamav-milter.

There is no need for that SOCKET_RWGROUP hack including waiting until
clamav-milter is up so that we can alter the permissions of the socket.
This can be handled by clamav-milter itself if it is started as root.

Signed-off-by: Sebastian Andrzej Siewior <sebastian at breakpoint.cc>
---
 debian/clamav-milter.default | 13 -------------
 debian/clamav-milter.init.in | 30 +++++-------------------------
 2 files changed, 5 insertions(+), 38 deletions(-)
 delete mode 100644 debian/clamav-milter.default

diff --git a/debian/clamav-milter.default b/debian/clamav-milter.default
deleted file mode 100644
index 68b2d1e..0000000
--- a/debian/clamav-milter.default
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# clamav-milter init options
-#
-
-## SOCKET_RWGROUP
-# by default, the socket created by the milter has permissions
-# clamav:clamav:755. SOCKET_RWGROUP changes the group and changes the
-# permissions to 775 to give read-write access to that group.
-#
-# If you are using postfix to speak to the milter, you have to give permission
-# to the postfix group to write 
-#
-#SOCKET_RWGROUP=postfix
diff --git a/debian/clamav-milter.init.in b/debian/clamav-milter.init.in
index 6f29b02..5298ab7 100644
--- a/debian/clamav-milter.init.in
+++ b/debian/clamav-milter.init.in
@@ -27,8 +27,6 @@ CLAMAVDAEMONUPGRADE="/var/run/clamav-daemon-being-upgraded"
 
 . /lib/lsb/init-functions
 
-[ -r /etc/default/clamav-milter ] && . /etc/default/clamav-milter
-
 if [ ! -f "$CLAMAVCONF" ]; then
   log_failure_msg "There is no configuration file for clamav-milter."
   log_failure_msg "Please either dpkg-reconfigure $DESC, or copy the example from"
@@ -38,7 +36,10 @@ if [ ! -f "$CLAMAVCONF" ]; then
 fi
 
 slurp_config "$CLAMAVCONF"
-[ -n "$User" ] || User=clamav
+if [ -z "$User" ]; then
+      log_failure_msg "'User' not specified in $CLAMAVCONF"
+      exit 1
+fi
 
 if [ -n "$Example" ]; then
   log_failure_msg "$DESC is not configured."
@@ -71,23 +72,6 @@ wait_for_socket()
   test $retries -ne 0
 }
 
-change_socket_group()
-{
-  local socket; socket="$1"
-  local group; group="$2"
-  local retries; retries=${3:-15}
-  local sleeptime; sleeptime=${4:-1}
-
-  [ -n "$group" ] || return 0
-
-  if wait_for_socket "$socket" $retries $sleeptime; then
-    chmod g+w "$SOCKET_PATH"
-    chgrp "$SOCKET_RWGROUP" "$SOCKET_PATH"
-  else
-    log_warning_msg "Tried to change socket group, but socket did not appear."
-  fi
-}
-
 case "$SOCKET" in
   /*)
   SOCKET_PATH="$SOCKET"
@@ -124,7 +108,6 @@ else
 fi
 
 [ "$PID" = '1' ] && unset PID
-[ -n "$User" ] || User=clamav
 [ -n "$DataBaseDirectory" ] || DataBaseDirectory=/var/run/clamav
 
 make_dir "$DataBaseDirectory"
@@ -153,7 +136,7 @@ case "$1" in
   fi
   if [ -z "$RUN_SUPERVISED" ] ; then
     log_daemon_msg "Starting $DESC" "$NAME"
-    start-stop-daemon --start -o -c $User --exec $DAEMON
+    start-stop-daemon --start -o --exec $DAEMON
     ret=$?
   else
     log_daemon_msg "Starting $DESC" "$NAME (supervised)"
@@ -161,9 +144,6 @@ case "$1" in
     ret=$?
   fi
 
-  # try 15*1 seconds to change the socket group
-  change_socket_group "$SOCKET_PATH" "$SOCKET_RWGROUP" 15 1
-
   log_end_msg $ret
   ;;
   stop)
-- 
1.9.0

Any comments? I didn't manage to get /etc/default/clamav-milter removed
on update.

Sebastian



More information about the Pkg-clamav-devel mailing list