[Pkg-clamav-devel] Bug#822444: Found the problem

Xavier Quost xquost2000 at yahoo.fr
Tue Apr 26 20:39:16 UTC 2016


Hello Sebastian, 

I found the problem, and we were both right (that's worth saying :-))

It seems that systemd doesn't start clamd daemon with the right user / group that's why the rigth on the socket are not consistent when clamav-daemon (clamd) is started by systemd.

lstat() failed on: /var/spool/clamsmtp/clamsmtpd.EfRJY5


The following modification solve the problem:  


/lib/systemd/system/clamav-daemon.service 
----------------------------------------------------------------------------------------------------------------------
[Unit]
Description=Clam AntiVirus userspace daemon
Documentation=man:clamd(8) man:clamd.conf(5) http://www.clamav.net/lang/en/doc/
Requires=clamav-daemon.socket
# Check for database existence
ConditionPathExistsGlob=/var/lib/clamav/main.{c[vl]d,inc}
ConditionPathExistsGlob=/var/lib/clamav/daily.{c[vl]d,inc}

[Service]
#ExecStart=/usr/sbin/clamd --foreground=true
##### XQ 26/04/2016  add config file
ExecStart=/usr/sbin/clamd -c /etc/clamav/clamd.conf --foreground=true 
ExecReload=/bin/kill -USR2 $MAINPID
StandardOutput=syslog
##### XQ 26/04/2016  add user and group
User=clamav
Group=clamav
----------------------------------------------------------------------------------------------------------------------

Specifying User / Group seems enough, however to be sure I added the config file in the  ExecStart  line.


I made also the same for  clamav-freshclam.service

----------------------------------------------------------------------------------------------------------------------------------
[Unit]
Description=ClamAV virus database updater
Documentation=man:freshclam(1) man:freshclam.conf(5) http://www.clamav.net/lang/en/doc/
# If user wants it run from cron, don't start the daemon.
ConditionPathExists=!/etc/cron.d/clamav-freshclam

[Service]
#ExecStart=/usr/bin/freshclam -d --foreground=true
## XQ 26/04/2016 adding conf files and others options not sure that's useful
ExecStart=/usr/bin/freshclam -d --quiet --config-file=/etc/clamav/freshclam.conf --foreground=true 
StandardOutput=syslog
## XQ 26/04/2016 adding a kill options not sure that's useful
ExecReload=/bin/kill -USR2 $MAINPID
##### XQ 26/04/2016  add user and group
User=clamav
Group=clamav

[Install]
WantedBy=multi-user.target
-------------------------------------------------------------------------------------------------------------------------------------------------------------



I'm not familiar with systemd, however I'm surprised that when /etc/init.d/clamav-daemon is somethink like 400 lines, systemd is something like 10 lines.
But still I'm not familiar with systemd.



Please would you tell me if those modifications make sense, or if those shall be made elsewhere in the system.


Best regards

XQ



More information about the Pkg-clamav-devel mailing list