rpms/clamav/FC-4 clamav-update.cron, NONE, 1.1 freshclam-sleep, NONE, 1.1 freshclam.sysconfig, NONE, 1.1 clamav.spec, 1.22, 1.23 sources, 1.10, 1.11

Enrico Scholz (ensc) fedora-extras-commits at redhat.com
Mon Jul 25 17:47:56 UTC 2005


Author: ensc

Update of /cvs/extras/rpms/clamav/FC-4
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv22267/FC-4

Modified Files:
	clamav.spec sources 
Added Files:
	clamav-update.cron freshclam-sleep freshclam.sysconfig 
Log Message:
synced with devel/



--- NEW FILE clamav-update.cron ---
## Adjust this line...
MAILTO=root,postmaster,webmaster,clamav

## It is ok to execute it as root; freshclam drops privileges and becomes
## user 'clamav' as soon as possible
0  */3 * * * root /usr/share/clamav/freshclam-sleep


--- NEW FILE freshclam-sleep ---
#! /bin/bash
# Copyright (C) 2005 Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>
#  
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#  
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#  
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


FRESHCLAM_MOD=$[ 3*60 ]		# 3 hours

f=/etc/sysconfig/freshclam
test ! -e "$f" || . "$f"


case x"$1" in
    (xnow)		FRESHCLAM_DELAY=0;;
    (x|xrandom)		: ${FRESHCLAM_DELAY:=$[ 0x`hostid` ]};;
    (*)			FRESHCLAM_DELAY=$1;;
esac

set -e

case $FRESHCLAM_DELAY in
    (disabled-warn)
	echo $"\
WARNING: update of clamav database is disabled; please see
  '$f'  
  for information how to enable the periodic update resp. how to turn
  off this message." >&2
	exit 1
	;;

    (disabled)
	exit 0
	;;

    (*)
	sleep $[ FRESHCLAM_DELAY % (FRESHCLAM_MOD*60) ]
	;;
esac


/usr/bin/freshclam --quiet && {
    test -x /usr/sbin/clamav-notify-servers &&  \
	exec /usr/sbin/clamav-notify-servers || \
	:
}


--- NEW FILE freshclam.sysconfig ---
## When changing the periodicity of freshclam runs in the crontab,
## this value must be adjusted also. Its value is the timespan between
## two subsequent freshclam runs in minutes. E.g. for the default
##
## | 0 */3 * * *  ...
##
## crontab line, the value is 180 (minutes).
# FRESHCLAM_MOD=

## A predefined value for the delay in seconds. By default, the value is
## calculated by the 'hostid' program. This predefined value guarantees
## constant timespans of 3 hours between two subsequent freshclam runs.
##
## This options accepts two special values:
## 'disabled-warn'  ...  disables the automatic freshclam update and
##                         gives out a warning
## 'disabled'       ...  disables the automatic freshclam silently
# FRESHCLAM_DELAY=


### !!!!! REMOVE ME !!!!!!
### REMOVE ME: By default, the freshclam update is disabled to avoid
### REMOVE ME: network access without prior activation
FRESHCLAM_DELAY=disabled-warn	# REMOVE ME


Index: clamav.spec
===================================================================
RCS file: /cvs/extras/rpms/clamav/FC-4/clamav.spec,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- clamav.spec	25 Jun 2005 18:01:46 -0000	1.22
+++ clamav.spec	25 Jul 2005 17:47:54 -0000	1.23
@@ -21,8 +21,8 @@
 
 Summary:	End-user tools for the Clam Antivirus scanner
 Name:		clamav
-Version:	0.86.1
-Release:	%release_func 2
+Version:	0.86.2
+Release:	%release_func 1
 
 License:	GPL
 Group:		Applications/File
@@ -67,10 +67,13 @@
 %package update
 Summary:	Auto-updater for the Clam Antivirus scanner data-files
 Group:		Applications/File
+Source200:	freshclam-sleep
+Source201:	freshclam.sysconfig
+Source202:	clamav-update.cron
 Requires:	clamav-data = %{version}-%{release}
 Requires(pre):		/etc/cron.d
 Requires(postun):	/etc/cron.d
-Requires(post):		%__chown %__chmod %__sed diffutils
+Requires(post):		%__chown %__chmod
 
 %package server
 Summary:	Clam Antivirus scanner server
@@ -204,6 +207,20 @@
 rm -rf "$RPM_BUILD_ROOT" _doc*
 %{__make} DESTDIR="$RPM_BUILD_ROOT" install
 
+function smartsubst() {
+	local tmp
+	local regexp=$1
+	shift
+
+	tmp=$(mktemp /tmp/%name-subst.XXXXXX)
+	for i; do
+		sed -e "$regexp" "$i" >$tmp
+		cmp -s $tmp "$i" || cat $tmp >"$i"
+		rm -f $tmp
+	done
+}
+
+
 %{__install} -d -m755 \
 	${RPM_BUILD_ROOT}%{_sysconfdir}/{clamd.d,cron.d,logrotate.d,sysconfig} \
 	${RPM_BUILD_ROOT}%{_var}/log \
@@ -230,10 +247,7 @@
 cp -pa _doc_server/*                    $RPM_BUILD_ROOT%pkgdatadir/template
 ln -s %pkgdatadir/clamd-wrapper         $RPM_BUILD_ROOT%_initrddir/clamd-wrapper
 
-f=$RPM_BUILD_ROOT%pkgdatadir/clamd-wrapper
-sed -e 's!/usr/share/clamav!%pkgdatadir!g' "$f" >"$f".tmp
-cmp -s "$f" "$f".tmp || cat "$f".tmp >"$f"
-rm -f "$f".tmp
+smartsubst 's!/usr/share/clamav!%pkgdatadir!g' $RPM_BUILD_ROOT%pkgdatadir/clamd-wrapper
 
 
 ## prepare the update-files
@@ -241,17 +255,17 @@
 %{__install} -m755 -p %{SOURCE8}	${RPM_BUILD_ROOT}%{_sbindir}/clamav-notify-servers
 touch ${RPM_BUILD_ROOT}%{freshclamlog}
 
-cat >${RPM_BUILD_ROOT}%{_sysconfdir}/cron.d/clamav-update <<"EOF"
-## Adjust this line...
-MAILTO=root,postmaster,webmaster,%username
-
-## It is ok to execute it as root; freshclam drops privileges and becomes
-## user 'clamav' as soon as possible
-# @MIN@  @HOUR@/3 * * * root %{_bindir}/freshclam --quiet && { test -x %{_sbindir}/clamav-notify-servers && exec %{_sbindir}/clamav-notify-servers || :; }
+%__install -p -m0755 %SOURCE200		$RPM_BUILD_ROOT%pkgdatadir/freshclam-sleep
+%__install -p -m0644 %SOURCE201		$RPM_BUILD_ROOT%_sysconfdir/sysconfig/freshclam
+%__install -p -m0600 %SOURCE202		$RPM_BUILD_ROOT%_sysconfdir/cron.d/clamav-update
+
+smartsubst 's!webmaster,clamav!webmaster,%username!g;
+	    s!/usr/share/clamav!%pkgdatadir!g;
+	    s!/usr/bin!%_bindir!g;
+            s!/usr/sbin!%_sbindir!g;' \
+   $RPM_BUILD_ROOT%_sysconfdir/cron.d/clamav-update \
+   $RPM_BUILD_ROOT%pkgdatadir/freshclam-sleep
 
-## Comment out or remove this line...
-1 8 * * * %username /bin/sh -c 'echo "Please activate the clamav update in %_sysconfdir/cron.d/clamav-update" >&2'
-EOF
 
 %if 0%{!?_without_milter:1}
 #### The milter stuff
@@ -260,6 +274,7 @@
 	sed -e 's!<SERVICE>!milter!g;s!<USER>!%milteruser!g;'"$3" "$1" >"$RPM_BUILD_ROOT$2"
 }
 
+
 subst etc/clamd.conf /etc/clamd.d/milter.conf \
 	's!^##*\(\(LogFile\|LocalSocket\|PidFile\|User\)\s\|\(StreamSaveToDisk\|ScanMail\)$\)!\1!;'
 
@@ -295,15 +310,6 @@
 	%{__chown} root:%{username} %{freshclamlog}
 }
 
-min=$[ RANDOM % 60 ]
-hour=$[ RANDOM % 3 ]
-tmp=$(mktemp /tmp/freshclam-cron.XXXXXX)
-src=%_sysconfdir/cron.d/clamav-update
-%__sed -e "s!@MIN@!$min!g;s!@HOUR@!$hour-23!g" "$src" >$tmp
-cmp -s $tmp "$src" || cat "$tmp" >"$src"
-rm -f $tmp
-
-
 %postun data
 test "$1" != 0 || /usr/sbin/fedora-userdel  %{username} &>/dev/null || :
 test "$1" != 0 || /usr/sbin/fedora-groupdel %{username} &>/dev/null || :
@@ -375,9 +381,11 @@
 %defattr(-,root,root,-)
 %_bindir/freshclam
 %_mandir/man1/freshclam*
-%config(noreplace) %verify(not mtime) %_sysconfdir/freshclam.conf
-%config(noreplace) %verify(not mtime) %attr(0600,root,root) %_sysconfdir/cron.d/*
-%config(noreplace) %verify(not mtime) %_sysconfdir/logrotate.d/*
+%pkgdatadir/freshclam-sleep
+%config(noreplace) %verify(not mtime)    %_sysconfdir/freshclam.conf
+%config(noreplace) %verify(not mtime)    %_sysconfdir/logrotate.d/*
+%config(noreplace) %_sysconfdir/cron.d/*
+%config(noreplace) %_sysconfdir/sysconfig/freshclam
 
 %ghost %attr(0664,root,%{username}) %verify(not size md5 mtime) %{freshclamlog}
 
@@ -414,6 +422,13 @@
 %endif	# _without_milter
 
 %changelog
+* Mon Jul 25 2005 Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de> - 0.86.2-1
+- updated to 0.86.2 (SECURITY)
+- changed the freshclam updating mechanism (again); now, it consists
+  of a crontab which does not need to be changed and a helper script
+  (freshclam-sleep). This helper script is configured by
+  /etc/sysconfig/freshclam
+
 * Sat Jun 25 2005 Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de> - 0.86.1-2
 - updated to 0.86.1
 - fixed randomization in %%post scriptlet: hour should be a range but


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/clamav/FC-4/sources,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- sources	25 Jun 2005 17:51:52 -0000	1.10
+++ sources	25 Jul 2005 17:47:54 -0000	1.11
@@ -1,2 +1,2 @@
-df7116898cdd80ce56721a91e9cff206  clamav-0.86.1.tar.gz
-dd5b89f732f84112207843748df5218c  clamav-0.86.1.tar.gz.sig
+870de14ba123d6e9cba9850498c49f5d  clamav-0.86.2.tar.gz
+7d9ffe964a67ee6db157e112203a2678  clamav-0.86.2.tar.gz.sig




More information about the scm-commits mailing list