From 0ce16b40647c3f3f4f93b06e371b9c2aa6d0160b Mon Sep 17 00:00:00 2001 From: ensc Date: Mon, 25 Jul 2005 17:17:06 +0000 Subject: [PATCH] initial checkin --- clamav-update.cron | 6 +++++ freshclam-sleep | 56 +++++++++++++++++++++++++++++++++++++++++++++ freshclam.sysconfig | 24 +++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 clamav-update.cron create mode 100755 freshclam-sleep create mode 100644 freshclam.sysconfig diff --git a/clamav-update.cron b/clamav-update.cron new file mode 100644 index 0000000..3f1b005 --- /dev/null +++ b/clamav-update.cron @@ -0,0 +1,6 @@ +## 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 diff --git a/freshclam-sleep b/freshclam-sleep new file mode 100755 index 0000000..25c3067 --- /dev/null +++ b/freshclam-sleep @@ -0,0 +1,56 @@ +#! /bin/bash +# Copyright (C) 2005 Enrico Scholz +# +# 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 || \ + : +} diff --git a/freshclam.sysconfig b/freshclam.sysconfig new file mode 100644 index 0000000..b11e207 --- /dev/null +++ b/freshclam.sysconfig @@ -0,0 +1,24 @@ +## 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