Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 272039 - new app-antivirus/clamav-0.95.1 with USE="milter" doesn't support current clamd files in /etc/init.d/ & /etc/conf.d/
Summary: new app-antivirus/clamav-0.95.1 with USE="milter" doesn't support current cla...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Antivirus Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-01 06:00 UTC by tyoma53
Modified: 2009-06-21 09:46 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
/etc/init.d/clamd file (clamd-initd,3.92 KB, text/plain)
2009-06-01 06:01 UTC, tyoma53
Details
/etc/conf.d/clamd file (clamd-conf,310 bytes, text/plain)
2009-06-01 06:02 UTC, tyoma53
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tyoma53 2009-06-01 06:00:16 UTC
because of new clamav-milter-0.95.1 startup process the current /etc/init.d/clamd and /etc/conf.d/clamd files don't pass for it execute. so i have made a few changes in this files and now clamav-milter is starting normally.

milter section in /etc/init.d/clamd:
	
	if [ "${START_MILTER}" = "yes" ]; then
                if [ -z "${MILTER_CONF_FILE}" ]; then
                MILTER_CONF_FILE="/etc/clamav-milter.conf"
                fi

                ebegin "Starting clamav-milter"
                start-stop-daemon --start --quiet \
                        --nicelevel ${MILTER_NICELEVEL:-0} \
                        --exec /usr/sbin/clamav-milter -- -c ${MILTER_CONF_FILE}
                eend $? "Failed to start clamav-milter"
        fi


/etc/conf.d/clamd:
# Config file for /etc/init.d/clamd

# NOTICE: Since clamav-0.85-r1, only START_CLAMD and START_FRESHCLAM settings
#         are used, other are silently ignored

START_CLAMD=yes
START_FRESHCLAM=yes
START_MILTER=yes
#MILTER_CONF_FILE="/etc/clamav-milter.conf"
CLAMD_NICELEVEL=3
FRESHCLAM_NICELEVEL=19
Comment 1 tyoma53 2009-06-01 06:01:49 UTC
Created attachment 193105 [details]
/etc/init.d/clamd file
Comment 2 tyoma53 2009-06-01 06:02:09 UTC
Created attachment 193107 [details]
/etc/conf.d/clamd file
Comment 3 Mike Auty (RETIRED) gentoo-dev 2009-06-06 15:58:40 UTC
Could you please include the output from emerge --info.

Also, please could you clarify what you mean by "don't pass for it execute"?  Is clamd-milter executing?  Could this be a configuration issue, and be related to bug 264952?

Can you please include the output of running "/etc/init.d/clamd start" using the original initd and confd files?  Also then please include the output of "ps aux"...
Comment 4 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2009-06-06 16:27:36 UTC
Furthermore please attach unified diffs (diff -u) when you did changes to any files from the portage-tree. That would be much more handy for our devs.
Comment 5 tyoma53 2009-06-06 16:55:43 UTC
(In reply to comment #3)
> Could you please include the output from emerge --info.
it ~ # emerge --info
Portage 2.1.6.11 (default/linux/amd64/2008.0/server, gcc-4.1.2, glibc-2.8_p20080602-r1, 2.6.28-gentoo-r5 x86_64)
=================================================================
System uname: Linux-2.6.28-gentoo-r5-x86_64-Intel-R-_Xeon-R-_CPU_5140_@_2.33GHz-with-glibc2.2.5
Timestamp of tree: Sat, 06 Jun 2009 15:45:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p39
dev-lang/python:     2.5.4-r2
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.63
sys-devel/automake:  1.4_p6, 1.7.9-r1, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=nocona -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-march=nocona -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache collision-protect distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://trumpetti.atm.tut.fi/gentoo/ http://mirror.yandex.ru/gentoo-distfiles/ ftp://mirror.yandex.ru/gentoo-distfiles/ "
LANG="POSIX"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="acl amd64 apache2 berkdb bzip2 cdr cgi cli cracklib crypt cups dri dvd fortran gd gdbm gpm iconv isdnlog jpeg libxml logrotate mailwrapper midi mmx mudflap multilib mysql ncurses nls nptl nptlonly openmp pam pcre perl png pppd python qt readline reflection session snmp spl sse sse2 ssl sysfs tcpd truetype unicode xml xmlreader xmlrpc xmlwriter xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="fbdev glint i810 intel mach64 mga neomagic nv r128 radeon savage sis tdfx trident vesa vga via vmware voodoo"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
 
> Also, please could you clarify what you mean by "don't pass for it execute"? 
> Is clamd-milter executing?
have you try to exexute clamd with "START_MILTER=yes" in /etc/conf.d/clamd? all others options there are left as they are. milter won't start because since version 0.95 it understands only three options: -h, -V, -C. and it takes all others settings from config file, defaults /etc/clamav-milter.conf.

diff -u for /etc/conf.d/clamd:
it ~ # diff -u /etc/conf.d/clamd /etc/conf.d/clamd~
--- /etc/conf.d/clamd   2009-06-06 20:44:05.000000000 +0400
+++ /etc/conf.d/clamd~  2009-06-06 20:43:54.000000000 +0400
@@ -8,7 +8,7 @@
 CLAMD_NICELEVEL=3
 FRESHCLAM_NICELEVEL=19

-START_MILTER=yes
+START_MILTER=no
 MILTER_NICELEVEL=19
 MILTER_SOCKET="/var/run/clamav/clmilter.sock"
 MILTER_OPTS="-m 10 --timeout=0"

> Could this be a configuration issue, and be related to bug 264952?
no, they're  unrelated.

> Can you please include the output of running "/etc/init.d/clamd start" using
> the original initd and confd files?  Also then please include the output of
> "ps aux"...
it ~ # ps aux | grep clam
clamav    2227  0.0 10.1 140224 104164 ?       SNsl 20:51   0:00 /usr/sbin/clamd
clamav    2237  0.0  0.0  25728   884 ?        SNs  20:51   0:00 /usr/bin/freshclam -d
root      2307  0.0  0.0   6620   708 pts/0    R+   20:51   0:00 grep --colour=auto clam

and now i can't stop it, because gentoo thinks that clamd wasn't execute:
it ~ # /etc/init.d/clamd stop
 * WARNING:  clamd has not yet been started.
Comment 6 tyoma53 2009-06-06 16:57:15 UTC
sorry, i've forgotten this output:
it ~ # /etc/init.d/clamd start
 * Starting clamd ...                                                                                                                                   [ ok ]
 * Starting freshclam ...                                                                                                                               [ ok ]
 * Starting clamav-milter ...
/usr/sbin/clamav-milter: illegal option -- m
ERROR: Unknown option passed
ERROR: Can't parse command line options
 * Failed to start clamav-milter
Comment 7 tyoma53 2009-06-06 17:07:29 UTC
and let's try to execute it with my clamd files in /etc/conf.d and /etc/init.d:
it ~ # diff -u /etc/conf.d/clamd /etc/conf.d/clamd~
--- /etc/conf.d/clamd   2009-06-06 20:59:54.000000000 +0400
+++ /etc/conf.d/clamd~  2009-06-06 20:43:54.000000000 +0400
@@ -8,6 +8,7 @@
 CLAMD_NICELEVEL=3
 FRESHCLAM_NICELEVEL=19

-START_MILTER=yes
+START_MILTER=no
 MILTER_NICELEVEL=19
-#MILTER_CONF_FILE="/etc/clamav-milter.conf"
+MILTER_SOCKET="/var/run/clamav/clmilter.sock"
+MILTER_OPTS="-m 10 --timeout=0"

it ~ # diff -u /etc/init.d/clamd /etc/init.d/clamd~
--- /etc/init.d/clamd   2009-06-06 21:02:51.000000000 +0400
+++ /etc/init.d/clamd~  2009-06-06 20:57:53.000000000 +0400
@@ -39,18 +39,58 @@
                        eend ${retcode} "Failed to start freshclam"
                fi
        fi
+       if [ "${START_MILTER}" = "yes" ]; then
+               if [ -S "${MILTER_SOCKET}" ]; then
+                       rm -f ${MILTER_SOCKET}
+               fi
+
+
+               local milter_ext=no
+               local milter_svr=no
+               args=`getopt -q --options "es" --longoptions "external,server" --  $MILTER_OPTS`
+               for arg in $args; do
+
+                       case "$arg" in

-        if [ "${START_MILTER}" = "yes" ]; then
-                if [ -z "${MILTER_CONF_FILE}" ]; then
-                MILTER_CONF_FILE="/etc/clamav-milter.conf"
-                fi
-
-                ebegin "Starting clamav-milter"
-                start-stop-daemon --start --quiet \
-                        --nicelevel ${MILTER_NICELEVEL:-0} \
-                        --exec /usr/sbin/clamav-milter -- -c ${MILTER_CONF_FILE}
-                eend $? "Failed to start clamav-milter"
-        fi
+                       -e | --external)
+                               milter_ext=yes;
+                               shift;;
+
+                       -s | --server)
+                               milter_svr=yes;
+                               shift;;
+
+                       --)
+                               shift;
+                               break;;
+                       esac
+               done
+
+               if [[ $milter_ext == yes && $milter_svr == no ]]; then
+                       local clamd_socket_wait_count=0
+                       local clamd_socket_wait_max=10
+                       local clamd_socket_wait_result=-1
+                       ebegin "Waiting for clamd to create ${clamd_socket}"
+                       while (( clamd_socket_wait < clamd_socket_wait_max )); do
+                               if [ -S "${clamd_socket:-/tmp/clamd}" ]; then
+                                       clamd_socket_wait_result=0
+                                       break
+                               else
+                                       echo -n " ."
+                                       let clamd_socket_wait++
+                                       sleep 1
+                               fi
+                       done
+                       echo
+                       eend $clamd_socket_wait_result "Timeout waiting for ${clamd_socket}"
+               fi
+
+               ebegin "Starting clamav-milter"
+               start-stop-daemon --start --quiet \
+                       --nicelevel ${MILTER_NICELEVEL:-0} \
+                       --exec /usr/sbin/clamav-milter -- ${MILTER_OPTS} ${MILTER_SOCKET}
+               eend $? "Failed to start clamav-milter"
+       fi
 }

 stop() {

so, check it now:
it ~ # /etc/init.d/clamd start
 * Starting clamd ...                                                                                                                                   [ ok ]
 * Starting freshclam ...                                                                                                                               [ ok ]
 * Starting clamav-milter ...                                                                                                                           [ ok ]

it ~ # ps aux | grep clam
clamav    3649  0.0 10.1 140224 104176 ?       SNsl 21:05   0:00 /usr/sbin/clamd
clamav    3669  0.0  0.0  25728   884 ?        SNs  21:05   0:00 /usr/bin/freshclam -d
clamav    3688  0.0  0.0  35028   620 ?        SNsl 21:05   0:00 /usr/sbin/clamav-milter -c /etc/clamav-milter.conf
root      3801  0.0  0.0   6620   712 pts/0    R+   21:06   0:00 grep --colour=auto clam

it ~ # /etc/init.d/clamd stop
 * Stopping clamd ...                                                                                                                                   [ ok ]
 * Stopping freshclam ...                                                                                                                               [ ok ]
 * Stopping clamav-milter ...                                                                                                                           [ ok ]

as you see everything works fine now.
Comment 8 Mike Auty (RETIRED) gentoo-dev 2009-06-06 17:21:15 UTC
Ok thanks, the output from running /etc/init.d/clamd in comment 6 was really what we needed, it clearly shows exactly what the problem is and gives the devlopers an area to focus on.  Reassigning appropriately...
Comment 9 martin holzer 2009-06-10 18:31:48 UTC
same here

#  * Starting clamd ...
 * Failed to start clamd                                                                                          [ !! ]
 * Starting freshclam ...                                                                                         [ ok ]
 * Virus databases are already up to date.
 * Starting clamav-milter ...
/usr/sbin/clamav-milter: illegal option -- m
ERROR: Unknown option passed
ERROR: Can't parse command line options
 * Failed to start clamav-milter                                                                                  [ !! ]

[1]+  Exit 1                  /etc/init.d/clamd restart
Comment 10 martin holzer 2009-06-10 18:40:39 UTC
i had to change /etc/clamav-milter.conf 

adding unix: to the socket options
MilterSocket unix:/var/run/clamav/clamav-milter.sock
ClamdSocket unix:/var/run/clamav/clamd.sock


and change /etc/conf.d/clamd
removing everything in 
MILTER_OPTS=""

Comment 11 Tobias Scherbaum (RETIRED) gentoo-dev 2009-06-21 09:46:05 UTC
This is fixed in 0.95.2.