Page 1 of 1

broken freshclam cron script in clamav-db-0.96.5-1.el5.art

Posted: Thu Dec 23, 2010 10:25 pm
by zerojj
posted this to atomic-repo-discuss@ but no response, so thought it might get some traction here:

Hi Scott & team,
Just ran through a yum update, and found that clamav-db-0.96.5-1.el5.art breaks freshclam updates.
Not sure if this is a custom package or if this needs to be floated upstream to clamav maintainers - I can do this if necessary.

I get the following mail from the cronjob:
/etc/cron.hourly/freshclam:
chown: cannot access `qscand.clamav': No such file or directory
chown: cannot access `qscand': No such file or directory
ERROR: Can't create temporary directory /var/clamav/clamav-80ee3c96cbc0c70b9354def7c1d68e62

Found that what seemed to be choking it up was the fact that there is an additional old DatabaseOwner field in /etc/freshclam.conf that is commented out.

Did a slight modification to the regex on the awk script to get the user from the file, and also updated the chown cmd to modern syntax

Code: Select all

[jens@serv2 ~]$ diff -u /etc/cron.hourly/freshclam.old /etc/cron.hourly/freshclam
--- /etc/cron.hourly/freshclam.old      2010-12-22 10:43:14.000000000 -0600
+++ /etc/cron.hourly/freshclam  2010-12-22 10:44:33.000000000 -0600
@@ -5,15 +5,15 @@
 
 ### fix log file if needed
 LOG_FILE="/var/log/clamav/freshclam.log"
-USER=`awk '/DatabaseOwner/ {print $2}' /etc/freshclam.conf`
+USER=`awk '/^DatabaseOwner/ {print $2}' /etc/freshclam.conf`
 if [ ! -f "$LOG_FILE" ]; then
     touch "$LOG_FILE"
     chmod 644 "$LOG_FILE"
-    chown $USER.$USER "$LOG_FILE"
+    chown $USER:$USER "$LOG_FILE"
 fi
 
 # User check event
-chown -R $USER.$USER /var/clamav
+chown -R $USER:$USER /var/clamav
 
 /usr/bin/freshclam \
     --quiet \
-- Jens

Re: broken freshclam cron script in clamav-db-0.96.5-1.el5.a

Posted: Fri Dec 24, 2010 2:13 pm
by faris
Thanks for the headsup. I'll take a look at ours when I get a chance. We mostly have RH4 systems but there are a few RH5s.