diff --git a/clamav.spec b/clamav.spec index 062897b..bd1e8d5 100644 --- a/clamav.spec +++ b/clamav.spec @@ -1,4 +1,4 @@ -## $Id: clamav.spec,v 1.26 2005/07/28 15:35:10 ensc Exp $ +## $Id: clamav.spec,v 1.26 2005/07/29 16:37:45 ensc Exp $ ## This package understands the following switches: ## --without milter ... deactivate the -milter subpackage @@ -14,6 +14,9 @@ %global milterlog %_var/log/clamd.milter %global milteruser clamilt %global milterstatedir %_var/run/clamav-milter +%global clameximlog %_var/log/clamd.exim +%global clameximuser clamexim +%global clameximstatedir %_var/run/clamd.exim %global pkgdatadir %_datadir/%name @@ -22,7 +25,7 @@ Summary: End-user tools for the Clam Antivirus scanner Name: clamav Version: 0.86.2 -Release: %release_func 4 +Release: %release_func 5 License: GPL Group: Applications/File @@ -107,6 +110,21 @@ Requires(preun): chkconfig initscripts Requires(pre): fedora-usermgmt >= 0.7 Requires(postun): fedora-usermgmt >= 0.7 +%package exim +Summary: Exim dæmon configuration for the Clam Antivirus scanner +Group: System Environment/Daemons +## For now, use this as a placeholder. Later, generate separate -sysv +## and -minit subpackages +Requires: init(clamav-exim) +Provides: init(clamav-exim) +Requires(pre): exim +Requires(pre): %_initrddir +Requires(postun): %_initrddir initscripts +Requires(post): chkconfig coreutils +Requires(preun): chkconfig initscripts +Requires(pre): fedora-usermgmt >= 0.7 +Requires(postun): fedora-usermgmt >= 0.7 + %description Clam AntiVirus is an anti-virus toolkit for UNIX. The main purpose of this @@ -159,6 +177,22 @@ to your sendmail.mc. THIS PACKAGE IS TO BE CONSIDERED AS EXPERIMENTAL! +%description exim +This package contains files which are needed to run the clamav dæmon for use +by the Exim MTA. It can be activated by adding + + av_scanner = clamd:%clameximstatedir/clamd.sock + +to your exim.conf, and using the 'malware' condition in the data ACL, +as follows: + + deny message = This message contains malware ($malware_name) + demime = * + malware = * + +For further details of Exim content scanning, see chapter 40 of the Exim +specification: http://www.exim.org/exim-html-4.50/doc/html/spec_40.html + ## ------------------------------------------------------------ %prep @@ -226,6 +260,7 @@ function smartsubst() { ${RPM_BUILD_ROOT}%{_sysconfdir}/{clamd.d,cron.d,logrotate.d,sysconfig} \ ${RPM_BUILD_ROOT}%{_var}/log \ ${RPM_BUILD_ROOT}%milterstatedir \ + ${RPM_BUILD_ROOT}%clameximstatedir \ ${RPM_BUILD_ROOT}%pkgdatadir/template \ ${RPM_BUILD_ROOT}%{_initrddir} @@ -268,15 +303,34 @@ smartsubst 's!webmaster,clamav!webmaster,%username!g; $RPM_BUILD_ROOT%pkgdatadir/freshclam-sleep -%if 0%{!?_without_milter:1} -#### The milter stuff +#### The Exim stuff function subst() { - sed -e 's!!milter!g;s!!%milteruser!g;'"$3" "$1" >"$RPM_BUILD_ROOT$2" + sed -e "s!!$3!g;s!!$4!g;""$5" "$1" >"$RPM_BUILD_ROOT$2" } +subst etc/clamd.conf %_sysconfdir/clamd.d/exim.conf exim %clameximuser \ + 's!^##*\(\(LogFile\|LocalSocket\|PidFile\|User\)\s\|\(StreamSaveToDisk\|ScanMail\|LogTime\|ScanArchive\)$\)!\1!;s!^Example!#Example!;' + -subst etc/clamd.conf /etc/clamd.d/milter.conf \ +subst %{SOURCE7} %_initrddir/clamd.exim exim %clameximuser '' +chmod 0755 $RPM_BUILD_ROOT%_initrddir/clamd.exim +subst %{SOURCE3} %_sysconfdir/logrotate.d/clamd.exim exim %clameximuser '' + +cat <$RPM_BUILD_ROOT%_sysconfdir/sysconfig/clamd.exim +CLAMD_CONFIG='%_sysconfdir/clamd.d/exim.conf' +CLAMD_SOCKET=%clameximstatedir/clamd.sock +EOF + +mkdir -p $RPM_BUILD_ROOT/%clameximstatedir +ln -sf clamd $RPM_BUILD_ROOT%_sbindir/clamd.exim + +touch $RPM_BUILD_ROOT%clameximstatedir/clamd.sock $RPM_BUILD_ROOT%clameximlog + +%if 0%{!?_without_milter:1} +#### The milter stuff + +subst etc/clamd.conf /etc/clamd.d/milter.conf milter %milteruser \ 's!^##*\(\(LogFile\|LocalSocket\|PidFile\|User\)\s\|\(StreamSaveToDisk\|ScanMail\)$\)!\1!;' @@ -337,6 +391,26 @@ test "$1" != 0 || /usr/sbin/fedora-userdel %{milteruser} &>/dev/null || : test "$1" != 0 || /usr/sbin/fedora-groupdel %{milteruser} &>/dev/null || : test "$1" = 0 || %{_initrddir}/clamav-milter condrestart >/dev/null || : +%pre exim +/usr/sbin/fedora-useradd 5 -r -s /sbin/nologin -d %clameximstatedir -M \ + -c 'Clamav Exim User' -g exim %clameximuser &>/dev/null || : + +%post exim +/sbin/chkconfig --add clamd.exim +test -e %clameximlog || { + touch %clameximlog + chmod 0620 %clameximlog + chown root:exim %clameximlog +} + +%preun exim +test "$1" != 0 || %{_initrddir}/clamd.exim stop &>/dev/null || : +test "$1" != 0 || /sbin/chkconfig --del clamd.exim + +%postun exim +test "$1" != 0 || /usr/sbin/fedora-userdel %{clameximuser} &>/dev/null || : +test "$1" = 0 || %{_initrddir}/clamd.exim condrestart >/dev/null || : + %post lib -p /sbin/ldconfig %postun lib -p /sbin/ldconfig @@ -414,6 +488,19 @@ test "$1" = 0 || %{_initrddir}/clamav-milter condrestart >/dev/null || : ## ----------------------- +%files exim +%defattr(-,root,root,-) +%_sbindir/clamd.exim +%config %{_initrddir}/clamd.exim +%config(noreplace) %verify(not mtime) %{_sysconfdir}/clamd.d/exim.conf +%config(noreplace) %verify(not mtime) %{_sysconfdir}/sysconfig/clamd.exim +%config(noreplace) %verify(not mtime) %{_sysconfdir}/logrotate.d/clamd.exim +%attr(0750,%clameximuser,exim) %dir %clameximstatedir +%ghost %clameximstatedir/* +%ghost %attr(0620,root,exim) %verify(not size md5 mtime) %clameximlog + +## ----------------------- + %files milter %defattr(-,root,root,-) %doc clamav-milter/INSTALL @@ -428,6 +515,9 @@ test "$1" = 0 || %{_initrddir}/clamav-milter condrestart >/dev/null || : %endif # _without_milter %changelog +* Fri Sep 9 2005 David Woodhouse - 0.86.2-5 +- Add clamav-exim configuration package + * Fri Jul 29 2005 Enrico Scholz - 0.86.2-4 - [milter] create the milter-logfile in the %%post scriptlet - [milter] reverted the change of the default child_timeout value; it