Browse Source

provide optional MILTER support for scanning mails for viruses via the MTA MILTER API

master
parent
commit
6fa76bc5df
  1. 16
      clamav/clamav.patch
  2. 22
      clamav/clamav.spec
  3. 56
      clamav/rc.clamav

16
clamav/clamav.patch

@ -0,0 +1,16 @@
Index: clamav-milter/clamav-milter.c
--- clamav-milter/clamav-milter.c.orig 2006-12-11 01:42:18 +0100
+++ clamav-milter/clamav-milter.c 2006-12-30 10:42:08 +0100
@@ -830,10 +830,12 @@
}
port = argv[optind];
+#if 0
if(verifyIncomingSocketName(port) < 0) {
fprintf(stderr, _("%s: socket-addr (%s) doesn't agree with sendmail.cf\n"), argv[0], port);
return EX_CONFIG;
}
+#endif
if(strncasecmp(port, "inet:", 5) == 0)
if(!lflag) {
/*

22
clamav/clamav.spec

@ -33,11 +33,15 @@ Class: EVAL
Group: AntiVirus
License: GPL
Version: 0.88.7
Release: 20061211
Release: 20061230
# package options
%option with_milter no
# list of sources
Source0: http://switch.dl.sourceforge.net/clamav/clamav-%{version}.tar.gz
Source1: rc.clamav
Patch0: clamav.patch
# build information
Prefix: %{l_prefix}
@ -46,6 +50,10 @@ BuildPreReq: OpenPKG, openpkg >= 20060823, gcc, bzip2
PreReq: OpenPKG, openpkg >= 20060823
BuildPreReq: zlib, curl, gmp
PreReq: zlib, curl, gmp
%if "%{with_milter}" == "yes"
BuildPreReq: milter
PreReq: milter
%endif
AutoReq: no
AutoReqProv: no
@ -68,6 +76,7 @@ AutoReqProv: no
%prep
%setup -q
%patch -p0
%build
# configure package
@ -84,10 +93,17 @@ AutoReqProv: no
--with-libcurl \
--with-user=%{l_rusr} \
--with-group=%{l_rgrp} \
--without-tcpwrappers \
--disable-clamav \
--disable-clamuko \
--disable-urandom \
--disable-cr \
%if "%{with_milter}" == "yes"
--enable-milter \
--with-sendmail=/dev/null \
%else
--disable-milter \
%endif
--disable-shared
# build package
@ -130,7 +146,9 @@ AutoReqProv: no
# strip-down installation hierarchy
strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/clamav-milter.1
%if "%{with_milter}" == "no"
rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/clamav-milter.8
%endif
# create additional installation directory
%{l_shtool} mkdir -f -p -m 755 \

56
clamav/rc.clamav

@ -5,6 +5,9 @@
%config
clamav_enable="$openpkg_rc_def"
clamav_daemons="clamd clamav-milter"
clamav_clamd_flags=""
clamav_clamav_milter_flags=""
clamav_update="daily"
clamav_log_prolog="true"
clamav_log_epilog="true"
@ -14,9 +17,17 @@
%common
clamav_cfgfile="@l_prefix@/etc/clamav/clamd.conf"
clamav_pidfile="@l_prefix@/var/clamav/clamd.pid"
clamav_pidfile_clamd="@l_prefix@/var/clamav/clamd.pid"
clamav_pidfile_clamav_milter="@l_prefix@/var/clamav/clamav-milter.pid"
clamav_signal () {
[ -f $clamav_pidfile ] && kill -$1 `cat $clamav_pidfile`
[ -f $clamav_pidfile_clamd ] \
&& kill -$1 `cat $clamav_pidfile_clamd`
local rc_clamav_clamd=$?
[ -f $clamav_pidfile_clamav_milter ] \
&& kill -$1 `cat $clamav_pidfile_clamav_milter`
local rc_clamav_clamav_milter=$?
[ $rc_clamav_clamd -eq 0 \
-o $rc_clamav_clamav_milter -eq 0 ]
}
%status -u @l_rusr@ -o
@ -31,13 +42,28 @@
%start -u @l_rusr@
rcService clamav enable yes || exit 0
rcService clamav active yes && exit 0
@l_prefix@/sbin/clamd --config-file=$clamav_cfgfile
for daemon in $clamav_daemons; do
if [ ".$daemon" = ".clamd" ]; then
@l_prefix@/sbin/clamd \
--config-file=$clamav_cfgfile \
$clamav_clamd_flags
elif [ ".$daemon" = ".clamav-milter" -a -x @l_prefix@/sbin/clamav-milter ]; then
@l_prefix@/sbin/clamav-milter \
--config-file=$clamav_cfgfile \
--max-children=4 --outgoing --local \
--pidfile=$clamav_pidfile_clamav_milter \
--sendmail-cf=/dev/null \
$clamav_clamav_milter_flags \
local:@l_prefix@/var/clamav/clamav-milter.socket
fi
done
%stop -u @l_rusr@
rcService clamav enable yes || exit 0
rcService clamav active no && exit 0
clamav_signal TERM
rm -f $clamav_pidfile 2>/dev/null || true
rm -f $clamav_pidfile_clamd 2>/dev/null || true
rm -f $clamav_pidfile_clamav_milter 2>/dev/null || true
%restart -u @l_rusr@
rcService clamav enable yes || exit 0
@ -62,22 +88,20 @@
%daily -u @l_rusr@
rcService clamav enable yes || exit 0
shtool rotate -f \
-n ${clamav_log_numfiles} -s ${clamav_log_minsize} -d \
-z ${clamav_log_complevel} -o @l_rusr@ -g @l_rgrp@ -m 644 \
-P "${clamav_log_prolog}" \
-E "${clamav_log_epilog}; rc clamav restart" \
@l_prefix@/var/clamav/clamd.log
shtool rotate -f \
-n ${clamav_log_numfiles} -s ${clamav_log_minsize} -d \
-z ${clamav_log_complevel} -o @l_rusr@ -g @l_rgrp@ -m 644 \
-P "${clamav_log_prolog}" \
-E "${clamav_log_epilog}; rc clamav restart" \
@l_prefix@/var/clamav/freshclam.log
if [ ".$clamav_update" = .daily ]; then
@l_prefix@/bin/freshclam
if [ $? -ge 10 ]; then exit $?; fi
fi
logfiles=""
for daemon in freshclam $clamav_daemons; do
logfiles="$logfiles @l_prefix@/var/clamav/$daemon.log"
done
shtool rotate -f \
-n $clamav_log_numfiles -s $clamav_log_minsize -d \
-z $clamav_log_complevel -o @l_rusr@ -g @l_rgrp@ -m 644 \
-P "$clamav_log_prolog" \
-E "$clamav_log_epilog; rc clamav restart" \
$logfiles
%weekly -u @l_rusr@
rcService clamav enable yes || exit 0

Loading…
Cancel
Save