# Conditional build (--with/--without option) # --without milter Summary: Clamav - an antivirus toolkit for Unix Name: clamav Version: 0.91.2 Release: 1 Epoch: 113 License: GPL Group: System Environment/Daemons URL: http://www.clamav.net/ Source0: http://download.sf.net/clamav/%{name}-%{version}.tar.gz Source1: clamd.sh Source2: clamav-milter.sh Source3: freshclam.sh Source4: clamav-milter.sysconfig Source5: clamd.logrotate Source6: freshclam.logrotate Source7: RPM-clamav.txt Source8: clamav-milter.daily Source9: freshclam.daily Patch0: clamav-milter-dontsux.patch Requires: bzip2-libs gmp zlib >= 1.2.1.2 Requires: curl libidn BuildRequires: bzip2-devel gmp-devel zlib-devel >= 1.2.1.2 BuildRequires: autoconf automake BuildRequires: curl-devel libidn-devel Obsoletes: clamav-lib clamav-update BuildRoot: %{_tmppath}/%{name}-%{version}-root %description Clam AntiVirus is a GPL anti-virus toolkit for UNIX. The main purpose of this software is the integration with mail servers (attachment scanning). The package provides a flexible and scalable multi-threaded daemon, a command line scanner, and a tool for automatic updating via Internet. The programs are based on a shared library distributed with package, which you can use with your own software. Most importantly, the virus database is kept up to date . %if %{!?_without_milter:1}%{?_without_milter:0} %package milter Summary: Clamav - milter Group: System Environment/Daemons License: GPL Requires: %{name}-server = %{epoch}:%{version}-%{release} Requires: sendmail >= 8.12 Requires: sendmail-cf >= 8.12 Requires: tcp_wrappers BuildRequires: sendmail-devel >= 8.12 BuildRequires: tcp_wrappers %description milter This package contains ClamAV's sendmail filter using MILTER interface. %endif %package server Summary: Clamav - clamd an anti-virus daemon Group: System Environment/Daemons Requires: %{name} = %{epoch}:%{version}-%{release} Obsoletes: clamd %description server This package contains clamd. The daemon listens for incoming connections on Unix or TCP socket and scans files or directories on demand. %package devel Summary: Clamav - Development header files and libraries Group: Development/Libraries Requires: %{name} = %{epoch}:%{version}-%{release} %description devel This package contains the development header files and libraries necessary to develope your own clamav based applications. %package db Summary: Clamav - virus patterns DB Group: System Environment/Daemons Requires: %{name} = %{epoch}:%{version}-%{release} Obsoletes: clamav-data %description db This package contains the virus patterns database. You need this package only on systems not connected to internet. In all other cases get the new, fresh and actual version from net. Run command 'freshclam --verbose' as root. %prep %setup -q %patch0 -p1 -b .dontsux %build %configure \ --program-prefix=%{?_program_prefix} \ %{!?_without_milter:--enable-milter} \ --enable-dns \ --with-libcurl \ --disable-clamav \ --enable-id-check \ --with-user=clamav \ --with-group=clamav \ --disable-zlib-vcheck \ --with-dbdir=%{_localstatedir}/lib/clamav %{__make} %install [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT install -d $RPM_BUILD_ROOT%{_initrddir}/ install -d $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ install -d $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/ install -d $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/ install -d $RPM_BUILD_ROOT%{_localstatedir}/lib/clamav/ install -d $RPM_BUILD_ROOT%{_localstatedir}/log/clamav/ install -d $RPM_BUILD_ROOT%{_localstatedir}/run/clamav/ install -d $RPM_BUILD_ROOT%{_localstatedir}/spool/clamav/ %{__make} DESTDIR=$RPM_BUILD_ROOT install %{?_without_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*} install %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/clamd install %{SOURCE3} $RPM_BUILD_ROOT%{_initrddir}/freshclam install %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/clamd install %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/freshclam install etc/clamd.conf $RPM_BUILD_ROOT%{_sysconfdir}/clamd.conf install etc/freshclam.conf $RPM_BUILD_ROOT%{_sysconfdir}/freshclam.conf install %{SOURCE7} RPM-clamav.txt install %{SOURCE9} $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/freshclam touch $RPM_BUILD_ROOT%{_localstatedir}/log/clamav/clamav.log touch $RPM_BUILD_ROOT%{_localstatedir}/log/clamav/freshclam.log # Milter %if %{!?_without_milter:1}%{?_without_milter:0} install %{SOURCE2} $RPM_BUILD_ROOT%{_initrddir}/clamav-milter install %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/clamav-milter install %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/clamav-milter %endif # # Customize config files sed -e 's!^Example!#Example!; s!^#LogFile .*!LogFile /var/log/clamav/clamd.log!; s!^#LogFileMaxSize .*!LogFileMaxSize 0!; s!^#LogTime .*!LogTime yes!; s!^#PidFile .*!PidFile /var/run/clamav/clamd.pid!; s!^#TemporaryDirectory .*!TemporaryDirectory /tmp!; s!^#DatabaseDirectory .*!DatabaseDirectory /var/lib/clamav!; s!^LocalSocket .*!#LocalSocket /var/run/clamav/clamd.sock!; s!^#FixStaleSocket .*!FixStaleSocket yes!; s!^#TCPSocket .*!TCPSocket 3310!; s!^#MaxConnectionQueueLength .*!MaxConnectionQueueLength 30!; s!^#MaxThreads .*!MaxThreads 50!; s!^#ReadTimeout .*!ReadTimeout 300!; s!^#User .*!User clamav!; s!^#AllowSupplementaryGroups .*!AllowSupplementaryGroups yes!; s!^#DetectBrokenExecutables .*!DetectBrokenExecutables yes!; s!^#ArchiveMaxCompressionRatio .*!ArchiveMaxCompressionRatio 300!; s!^#ArchiveBlockEncrypted .*!ArchiveBlockEncrypted yes!; s!^#ArchiveBlockMax .*!ArchiveBlockMax yes!;' \ etc/clamd.conf > $RPM_BUILD_ROOT%{_sysconfdir}/clamd.conf sed -e 's!^Example!#Example!; s!^#DatabaseDirectory .*!DatabaseDirectory /var/lib/clamav!; s!^#UpdateLogFile .*!UpdateLogFile /var/log/clamav/freshclam.log!; s!^#PidFile .*!PidFile /var/run/clamav/freshclam.pid!; s!^#DatabaseOwner .*!DatabaseOwner clamav!; s!^#AllowSupplementaryGroups .*!AllowSupplementaryGroups yes!; s!^#DNSDatabaseInfo .*!DNSDatabaseInfo current.cvd.clamav.net!; s!^#Checks .*!Checks 24!; s!^#NotifyClamd .*!NotifyClamd /etc/clamd.conf!;' \ etc/freshclam.conf > $RPM_BUILD_ROOT%{_sysconfdir}/freshclam.conf # %clean [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT ######################## # Scripts starts there # ######################## %pre # Add clamav user if [ -z "`/usr/bin/id -g clamav 2>/dev/null`" ]; then /usr/sbin/groupadd -g 46 -r -f clamav 2>&1 || : fi if [ -z "`/usr/bin/id -u clamav 2>/dev/null`" ]; then /usr/sbin/useradd -u 46 -r -M -d /tmp -s /sbin/nologin -c "Clam AntiVirus" -g clamav clamav 2>&1 || : fi # %post /sbin/ldconfig /sbin/chkconfig --add freshclam # Use country mirror for virus DB ZONES="/usr/share/zoneinfo/zone.tab" CONFIG="/etc/sysconfig/clock" FRESHCFG=`/bin/mktemp /tmp/freshclam.XXXXXX` if [ -r "$CONFIG" -a -r "$ZONES" ]; then source "$CONFIG" export CODE="$(grep -E "\b$ZONE\b" "$ZONES" | head -1 | cut -f1 | tr [A-Z] [a-z])" fi if [ -z "$CODE" ]; then export CODE="local" fi sed -e "s%^#DatabaseMirror .*%DatabaseMirror db.$CODE.clamav.net%" \ %{_sysconfdir}/freshclam.conf > $FRESHCFG mv $FRESHCFG %{_sysconfdir}/freshclam.conf if [ -f %{_sysconfdir}/freshclam.conf.rpmnew ]; then sed -e "s%^#DatabaseMirror .*%DatabaseMirror db.$CODE.clamav.net%" \ %{_sysconfdir}/freshclam.conf.rpmnew > $FRESHCFG mv $FRESHCFG %{_sysconfdir}/freshclam.conf.rpmnew fi chmod 0640 %{_sysconfdir}/freshclam.conf* # # Get actual virus DB from net on first installation if [ $1 -eq 1 ]; then freshclam --verbose 2>/dev/null exit 0 fi %preun if [ $1 -eq 0 ]; then /sbin/service freshclam stop > /dev/null 2>&1 || : /sbin/chkconfig --del freshclam fi %postun /sbin/ldconfig if [ $1 -eq 0 ]; then rm -rf %{_localstatedir}/run/clamav/ rm -rf %{_localstatedir}/log/clamav/ rm -rf %{_localstatedir}/lib/clamav/ /usr/sbin/userdel -r clamav > /dev/null 2>&1 || : else /sbin/service freshclam condrestart > /dev/null 2>&1 || : fi %post server /sbin/chkconfig --add clamd # Change back files owner for systems with non clamav user CLAMUSER=`grep ^User /etc/clamd.conf | cut -d ' ' -f2` if [ -z $CLAMUSER ] ; then CLAMUSER="clamav" fi if [ $CLAMUSER != "clamav" -a `/usr/bin/id $CLAMUSER > /dev/null 2>&1 ; echo $?` = 0 ] ; then echo "WARNING!!!" echo "This function will be removed on next version." echo " More details on Petr@Kristof.cz" chown root:$CLAMUSER %{_sysconfdir}/clamd.conf chown root:$CLAMUSER %{_sysconfdir}/freshclam.conf chown -R $CLAMUSER:$CLAMUSER %{_localstatedir}/lib/clamav/ chown -R $CLAMUSER:$CLAMUSER %{_localstatedir}/log/clamav/ chown -R $CLAMUSER:$CLAMUSER %{_localstatedir}/run/clamav/ fi # %preun server if [ $1 -eq 0 ]; then /sbin/service clamd stop > /dev/null 2>&1 || : /sbin/chkconfig --del clamd fi %postun server if [ $1 -ge 1 ]; then /sbin/service clamd condrestart > /dev/null 2>&1 || : fi # Milter %if %{!?_without_milter:1}%{?_without_milter:0} %post milter /sbin/chkconfig --add clamav-milter %preun milter if [ $1 -eq 0 ]; then /sbin/service clamav-milter stop > /dev/null 2>&1 || : /sbin/chkconfig --del clamav-milter fi %postun milter if [ $1 -ge 1 ]; then /sbin/service clamav-milter condrestart > /dev/null 2>&1 || : fi %endif # %files %defattr(0644,root,root,0755) %doc AUTHORS BUGS COPYING ChangeLog FAQ INSTALL NEWS README UPGRADE %doc docs/*.pdf docs/html/ test/ RPM-clamav.txt #%lang(de) %doc docs/German %attr(0640,root,clamav) %config(noreplace) %{_sysconfdir}/freshclam.conf %attr(0755,root,root) %{_sysconfdir}/cron.daily/freshclam %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/logrotate.d/freshclam %attr(0755,root,root) %{_initrddir}/freshclam %attr(0755,root,root) %{_bindir}/* %attr(0755,root,root) %{_libdir}/libclamav.so.* %attr(0755,clamav,clamav) %dir %{_localstatedir}/lib/clamav/ %attr(0755,clamav,clamav) %dir %{_localstatedir}/log/clamav/ %attr(0755,clamav,clamav) %dir %{_localstatedir}/run/clamav/ %attr(0640,clamav,clamav) %ghost %{_localstatedir}/log/clamav/freshclam.log %{_mandir}/man1/* %{_mandir}/man5/* %files server %attr(0644,root,clamav) %config(noreplace) %{_sysconfdir}/clamd.conf %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/logrotate.d/clamd %attr(0755,root,root) %{_initrddir}/clamd %attr(0755,root,root) %{_sbindir}/clamd %attr(0640,clamav,clamav) %ghost %{_localstatedir}/log/clamav/clamav.log %{_mandir}/man8/clamd.8* # Milter %if %{!?_without_milter:1}%{?_without_milter:0} %files milter %defattr(0644,root,root,0755) %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/clamav-milter %attr(0755,root,root) %{_initrddir}/clamav-milter %attr(0755,root,root) %{_sysconfdir}/cron.daily/clamav-milter %attr(0755,root,root) %{_sbindir}/clamav-milter %{_mandir}/man8/clamav-milter.8* %attr(0700,clamav,clamav) %{_localstatedir}/spool/clamav/ %endif # %files devel %defattr(0644,root,root,0755) %attr(0755,root,root) %{_libdir}/libclamav.so %attr(0755,root,root) %{_libdir}/*.a %attr(0755,root,root) %{_libdir}/*.la %attr(0644,root,root) %{_includedir}/*.h %attr(0644,root,root) %{_libdir}/pkgconfig/libclamav.pc %files db %defattr(0644,root,root,0755) %attr(0644,clamav,clamav) %config(noreplace) %verify(user group mode) %{_localstatedir}/lib/clamav/main.cvd %attr(0644,clamav,clamav) %config(noreplace) %verify(user group mode) %{_localstatedir}/lib/clamav/daily.cvd %changelog * Sun Dec 16 2007 Petr Krištof 0.91.2-1 - Update to 0.91.2 * Sun Jul 8 2007 Petr Krištof 0.90.3-1 - Update to 0.90.3 * Sun Apr 22 2007 Petr Krištof 0.90.2-1 - Update to 0.90.2 * Thu Apr 12 2007 Petr Krištof 0.90.1-1 - Fix new db files handling * Sun Mar 4 2007 Petr Krištof 0.90.1-0 - Update to 0.90.1 * Wed Dec 13 2006 Petr Krištof 0.88.7-1 - Update to 0.88.7 * Wed Nov 8 2006 Petr Krištof 0.88.6-1 - Update to 0.88.6 * Wed Oct 18 2006 Petr Krištof 0.88.5-1 - Update to 0.88.5 * Mon Aug 7 2006 Petr Krištof 0.88.4-1 - Update to 0.88.4 * Thu Jun 12 2006 Petr Krištof 0.88.3-1 - Update to 0.88.3 * Sun Apr 30 2006 Petr Krištof 0.88.2-1 - Update to 0.88.2 * Wed Apr 12 2006 Petr Krištof 0.88.1-1 - Update to 0.88.1 * Tue Jan 10 2006 Petr Krištof 0.88-1 - Update to 0.88 * Wed Nov 30 2005 Petr Krištof 0.87.1-3 - More silent on first db install * Sun Nov 27 2005 Petr Krištof 0.87.1-2 - Cleanup .spec file * Sat Nov 5 2005 Petr Krištof 0.87.1-1 - Update to 0.87.1 - Split clamav-db package * Sun Sep 18 2005 Petr Krištof 0.87-1 - Update to 0.87 - Split clamav-server package * Fri Jul 29 2005 Petr Krištof 0.86.2-1 - Update to 0.86.2 * Sun Jun 26 2005 Petr Krištof 0.86.1-1 - Update to 0.86.1 * Mon Jun 20 2005 Petr Krištof 0.86-1 - Update to 0.86 - Rebuild on FC-4 * Wed May 18 2005 Petr Krištof 0.85.1-1 - Update to 0.85.1 - Reworked init script to start clamd as clamav user * Sun May 15 2005 Petr Krištof 0.85-2 - Use bad_log_file_ownership workaround in init script * Wed May 11 2005 Petr Krištof 0.85-1 - Update to 0.85 * Sat Apr 30 2005 Petr Krištof 0.84-1 - Update to 0.84 * Mon Feb 14 2005 Petr Krištof 0.83-1 - Update to 0.83 * Mon Feb 7 2005 Petr Krištof 0.82-1 - Update to 0.82 * Mon Jan 31 2005 Petr Krištof 0.81-2 - Backport mydoom patch from CVS - Use clamav-milter --external option * Thu Jan 27 2005 Petr Krištof 0.81-1 - Update to 0.81 * Wed Nov 17 2004 Petr Krištof 0.80-4 - Fix libidn dependency by Jean-Noël Chardron * Sat Nov 13 2004 Petr Krištof 0.80-3 - Add Obsoletes tag - Rebuild on FC-3 * Tue Nov 2 2004 Petr Krištof 0.80-2 - Use country mirror for virus DB by Dag Wieers - Remove no more needed logwatch scripts * Mon Oct 18 2004 Petr Krištof 0.80-1 - Update to 0.80 - Add curl dependency - Change /etc/clamav.conf -> /etc/clamd.conf - New clamd option ArchiveBlockMax * Fri Jul 30 2004 Petr Krištof 0.75.1-1 - Update to 0.75.1 - Mark /etc/logrotate.d/* as config files - Clamd now listen on all interfaces * Sat Jul 24 2004 Petr Krištof 0.75-1 - Update to 0.75 - Add --dont-wait to clamav-milter sysconfig - Remove --max-children from clamav-milter sysconfig - Set Max-Threads in clamav.conf * Thu Jul 1 2004 Petr Krištof 0.74-1 - Update to 0.74 * Mon Jun 14 2004 Petr Krištof 0.73-1 - Update to 0.73 - Drop sendmail-8.11 support - Fix logwatch files conflict - Move libclamav.so to devel by Tom G. Christensen - Rebuild on FC-2 * Thu Jun 3 2004 Petr Krištof 0.72-1 - Update to 0.72 * Wed May 19 2004 Petr Krištof 0.71-1 - Update to 0.71 - Update to clamav-logwatch 0.32 - Fix freshclam linuxconf problem by George Law * Mon May 10 2004 Petr Krištof 0.70-2 - Update to clamav-logwatch 0.30 - Add %post check for non clamav user file ownership - Add freshclam cron script by Milan Keršláger - Remove --noreject option to clamav-milter * Sun Apr 18 2004 Petr Krištof 0.70-1 - Update to 0.70 - Add --noreject option to clamav-milter - Change reload option in init scripts - Fix tcp_wrapper dependency by Harrie Overdijk - Fix logrotate scripts by Ján Ondrej (SAL) * Tue Mar 16 2004 Petr Krištof 0.70rc-1 - Update to 0.70rc - Some spec ideas by Enrico Scholz - Run clamav-milter with --dont-log-clean - Use SIGHUP to rotate logs - Enable ArchiveDetectEncrypted option * Sun Mar 7 2004 Petr Krištof 0.67-2 - Fix init script locking by Luigi Iotti - Aply clamav ulimits by Robert Schmidt - Compile w/o --enable-debug by Robert Schmidt - Fix tcp_wrapper dependencies by Mauro Vaiani - Fix missing library link by Doru Petrescu - Increase clamav-milter max-childrens=10 - Add i18n docs files * Mon Feb 16 2004 Petr Krištof 0.67-1 - Update to 0.67 - No replace config files by James Genus Jr. * Wed Feb 11 2004 Petr Krištof - Update to clamav 0.66 - Update to clamav-logwatch 0.23 - Use TCPsocket instead LOCALsocket - Replace /etc/sysconfig/freshclam with /etc/freshclam.conf - Fixed dependencies by Michal Jaegermann - Add clamav-milter.daily to cleanup quarantine spool - Add test/* suite to %doc by Peter A. Gomez * Sun Dec 7 2003 Petr Krištof - Fix Epoch dependencies by Eduardo Kaftanski * Sun Nov 23 2003 Petr Krištof - Update .spec file - Fix RH-7.3 program-prefix by Kenneth Porter - Rebuild on FC-1 * Sun Nov 16 2003 Petr Krištof - Fix doc errors - Fix dependencies - Patch for RH-7.3 by Lionel Bouton - Patch for RH-7.3 by Chris de Vidal - Option --without-milter by Ján Ondrej (SAL) * Wed Nov 12 2003 Petr Krištof - Removed package db - Added LogWatch support - Added FreshClam support - Moved logfiles to own subdirectory - Update to 0.65 * Wed Sep 10 2003 Petr Krištof - Option for build without clamavdb * Thu Jul 10 2003 Petr Krištof - Split package to clamav, db, milter, devel * Sun Jun 22 2003 Petr Krištof - Update to 0.60 * Tue Jun 10 2003 Petr Krištof - Fixed post, preun, postun scripts - Update to 2003xxxx snapshots * Tue Feb 4 2003 Petr Krištof - Rebuild on RH-8.0 * Sun Dec 1 2002 Petr Krištof - Based on PLD package - Initial RH-7.3 build