%define debug_package %{nil} Summary: Software to scan incoming email. Name: qmail-scanner Version: 2.10 Release: 10 Epoch: 1 URL: http://qmail-scanner.sourceforge.net/ Packager: Scott R. Shinn Source0: %{name}-%{version}.tgz Source1: qmail-scanner-reconfigure.psa Source2: qmail-scanner-reconfigure.project-gamera Source3: qmail-scanner.ini Source4: qmail-scanner.logrotate Source5: qmail-log-parse.sh Patch0: q-s-2.10st-20111118.patch Patch1: altermime-disclaimer.patch Patch2: submission-relay.patch License: GPL Group: Applications/System BuildRoot: %{_tmppath}/%{name}-root BuildRequires: perl Requires: perl, qmail, daemontools >= 0.76, tnef, unzip, perl(Time::HiRes), perl(Sys::Syslog), maildrop, spamassassin, perl-suidperl Requires: bind-utils BuildRequires: perl(Time::HiRes), perl(DB_File), perl(Sys::Syslog) BuildRequires: maildrop %{?rh90:Requires: perl(DB_File) } %{?rhel3:Requires: perl(DB_File) } Conflicts: drweb, drweb-qmail %description Qmail-Scanner, (also known as scan4virus) is an addon that enables a Qmail Email server to scan all gatewayed Email for certain characteristics (i.e. a content scanner). It is typically used for its anti-virus protection functions, in which case it is used in conjunction with commercial virus scanners. but also enables a site (at a server/site level) to react to Email that contains specific strings in particular headers, or particular attachment filenames or types (e.g. *.VBS attachments). It also can be used as an archiving tool for auditing or backup purposes. Qmail-Scanner is integrated into the mail server at a lower level than some other Unix-based virus scanners, resulting in better performance. It is capable of scanning not only locally sent/received Email, but also Email that crosses the server in a relay capacity. #------------------------------------------------------------------------------ %prep #%setup -q -n %{name}-%{version}st %setup -q %patch0 -p1 #%patch1 -p1 %patch2 -p1 # build the wrapper %build cd contrib/ make #------------------------------------------------------------------------------ %install # # NEW NEW #Remember to copy quarantine-events.txt to /var/spool/qscan and then # %{__rm} -rf %{buildroot} %{__mkdir} docs %{__mv} CHANGES README* COPYING *.php *.gpg docs/ %{__mkdir_p} -m 755 %{buildroot}%{_datadir}/%{name}/autoupdaters/ %{__mkdir_p} -m 755 %{buildroot}%{_datadir}/%{name}/contrib/ %{__install} -m 755 autoupdaters/* \ %{buildroot}%{_datadir}/%{name}/autoupdaters/ %{__install} -m 755 contrib/* %{buildroot}%{_datadir}/%{name}/contrib/ %{__cp} -r locale %{buildroot}%{_datadir}/%{name}/ %{__install} -m 644 *.template %{buildroot}%{_datadir}/%{name} %{__install} -m 644 *.txt %{buildroot}%{_datadir}/%{name}/ %{__install} -m 755 *.pl %{buildroot}%{_datadir}/%{name}/ %{__install} -m 755 *.sh %{buildroot}%{_datadir}/%{name}/ %{__install} -m 755 configure %{buildroot}%{_datadir}/%{name}/ # make the /var/spool/qscan %{__mkdir} -m 755 -p %{buildroot}/var/spool/qscan %{__mkdir} -m 755 -p %{buildroot}/var/spool/qscan/quarantine/spam/tmp %{buildroot}/var/spool/qscan/quarantine/spam/cur %{buildroot}/var/spool/qscan/quarantine/spam/new %{__mkdir} -m 755 -p %{buildroot}/var/spool/qscan/quarantine/policy/tmp %{buildroot}/var/spool/qscan/quarantine/policy/cur %{buildroot}/var/spool/qscan/quarantine/policy/new %{__mkdir} -m 755 -p %{buildroot}/var/spool/qscan/quarantine/viruses/tmp %{buildroot}/var/spool/qscan/quarantine/viruses/cur %{buildroot}/var/spool/qscan/quarantine/viruses/new %{__mkdir} -m 755 -p %{buildroot}/var/spool/qscan/working/tmp %{buildroot}/var/spool/qscan/working/cur %{buildroot}/var/spool/qscan/working/new %{__mkdir} -m 755 -p %{buildroot}/var/spool/qscan/archives/tmp %{buildroot}/var/spool/qscan/archives/cur %{buildroot}/var/spool/qscan/archives/new #%{__ln} -s %{buildroot}/var/spool/qscan/ %{buildroot}/var/spool/qscan %{__install} -m 644 quarantine-events.txt %{buildroot}/var/spool/qscan/ #%{__mkdir_p} -m 755 %{buildroot}%{_bindir} %{__install} -m 755 %{SOURCE1} %{buildroot}%{_datadir}/%{name}/ %{__install} -m 755 %{SOURCE2} %{buildroot}%{_datadir}/%{name}/ # obsoleted #%{__mkdir_p} -m 755 %{buildroot}%{_sysconfdir}/cron.daily #echo "setuidgid qmailq /var/qmail/bin/%{name}-queue.pl -z" > %{name}-cleanup.cron #%{__install} -m 755 %{name}-cleanup.cron %{buildroot}%{_sysconfdir}/cron.daily/ %{__mkdir_p} -m 755 %{buildroot}%{_sysconfdir}/logrotate.d # Legacy #%{__cp} contrib/logrotate.qmail-scanner %{buildroot}/%{_sysconfdir}/logrotate.d/qmail-scanner %{__install} -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/logrotate.d/qmail-scanner %{__install} -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/qmail-scanner.ini %{__install} -m 755 %{SOURCE5} %{buildroot}%{_datadir}/%{name}/contrib/qmail-log-parse.sh %{__mkdir_p} -m 755 %{buildroot}/var/log/qscan #------------------------------------------------------------------------------ %clean %{__rm} -rf %{buildroot} # This runs before the package, so the only fix here is to always run reinstall atm %triggerin -- psa-qmail ln -sf /usr/share/qmail-scanner/qmail-scanner-reconfigure.psa /usr/bin/qmail-scanner-reconfigure %{_bindir}/%{name}-reconfigure >/dev/null 2>&1 %triggerin -- project-gamera ln -sf /usr/share/qmail-scanner/qmail-scanner-reconfigure.project-gamera /usr/bin/qmail-scanner-reconfigure %{_bindir}/%{name}-reconfigure >/dev/null 2>&1 %triggerin -- clamd /usr/sbin/usermod -G clamav qscand %pre # This is the safety if [ -f /var/qmail/bin/qmail-queue.orig ]; then cp -f /var/qmail/bin/qmail-queue /var/qmail/bin/qmail-queue.backup cp -f /var/qmail/bin/qmail-queue.orig /var/qmail/bin/qmail-queue.orig.backup mv -f /var/qmail/bin/qmail-queue.orig /var/qmail/bin/qmail-queue fi if ! grep -q "^qscand:" /etc/group; then /usr/sbin/groupadd -r -f qscand fi if ! grep -q "^qscand:" /etc/passwd; then #/usr/sbin/useradd -r -d /tmp -s /bin/false -c "Qmail-Scanner Account" -g qscand qscand 1>&2 /usr/sbin/useradd -c "Qmail-Scanner Account" -g qscand -d /var/spool/qscan -s /bin/false qscand fi %post if [ "$1" = "1" ]; then if [ ! -d /var/qmail/.spamassassin ]; then mkdir /var/qmail/.spamassassin chown qmailq.qmail /var/qmail/.spamassassin fi fi # permissions check chown -R qscand.qscand /var/spool/qscan # NEW NEW #run "qmail-scanner-queue.pl -g" to generate DB version. %preun if [ "$1" = "0" ]; then if [ -f /var/qmail/bin/qmail-queue.orig ] ; then q1=$(stat -c %s /usr/share/qmail-scanner/contrib/qmail-scanner-queue) q2=$(stat -c %s /var/qmail/bin/qmail-queue) # current qmail-queue is larger than the wrapper, so it must have been replaced if [ $q1 -lt $q2 ]; then mv /var/qmail/bin/qmail-queue.orig /var/qmail/bin/qmail-queue fi fi /usr/sbin/userdel qscand if [ -f /etc/clamd.conf ]; then perl -pi -e "s|^User.*|User clamav|" /etc/clamd.conf perl -pi -e "s|create.*|create 664 clamav clamav|" /etc/logrotate.d/clamav perl -p -i -e "s|DatabaseOwner.*|DatabaseOwner qscand|g" /etc/freshclam.conf chown -R clamav.clamav /var/log/clamav chown -R clamav.clamav /var/run/clamav chown -R clamav.clamav /var/clamav fi fi #------------------------------------------------------------------------------ %files %defattr(-,root,root) %doc docs/* %attr (755,root,root) %{_datadir}/%{name} %config(noreplace) %{_sysconfdir}/qmail-scanner.ini /var/spool/qscan/quarantine-events.txt %{_sysconfdir}/logrotate.d/qmail-scanner %attr(755,qscand,qscand) /var/spool/qscan/ %attr(755,qscand,qscand) /var/spool/qscan/archives %attr(755,qscand,qscand) /var/spool/qscan/quarantine %attr(755,qscand,qscand) /var/spool/qscan/working %attr(755,qscand,qscand) /var/spool/qscan/quarantine-events.txt %attr(755,qscand,qscand) /var/log/qscan/ #------------------------------------------------------------------------------ %changelog * Mon Feb 25 2013 Support - 2.10-10 - Bugfix #1091, logrotate userid * Tue Jan 15 2013 Support - 2.10-9 - Add Requires for bind-utils (dig requirement) - Update to qmail-scanner-queue, increased default SA scan size from 256k to 1mb - Update to qmail-scanner-reconfigure, make project-gamera settings ASL aware - Update to clamd trigger, moved all complex logic into qmail-scanner-reconfigure - Update to psa trigger, moved all complex logic into qmail-scanner-reconfigure - Bugfix #XXX, increased ulimitdata from 40000000 to 80000000 - Bugfix #XXX, Moved %postun to %preun so plesk qmail-queue restoration would happen before its removal - Bugfix #XXX, override ASL NOTIFY with qmail-scanner NOTIFY * Wed Dec 12 2012 Support - 2.10-8 - Update to 2.10 - Update patch to 20111118 - Merge psa-qmail triggers into a single event - Disable altermime patch - Feature Request #296, logrotate quarantine.log - Bugfix #XXX, changed logic to detect file sizes on post/postun events instead of static if/exists events * Sun Mar 27 2011 Support - 2.08-5 - Add in the Sumission port auto-relay patch from Lemonbit.nl - Update to 20100626 patch * Tue Mar 2 2010 Support - 2.08-3 - Bugfix #XXX, this moves a trigger event into postun that was originally clamd. It fixes a condition where the User would be set to clamav on an update. * Wed Oct 14 2009 Scott R. Shinn - 2.08-1 - Update to 2.08st-20091012 - Trigger fix for Plesk 9 environments to add in qmail-scanner-reconfigure event - Dropped the noarch requirement * Mon Sep 21 2009 Scott R. Shinn - 2.06-2 - Bugfix #143, fixed condition where clamav permissions were not being set on /var/log/clamav to qscand - Bugfix #249, Added logrotate event for razor-agents.log * Thu Apr 23 2009 Scott R. Shinn - 2.0.6-1 - Update to 20090419 * Fri Apr 3 2009 Scott R. Shinn - 2.0.5-3 - Added ownership check for /var/clamav * Sat Feb 28 2009 Scott R. Shinn - 2.0.5-2 - leekspin... basshunter style (http://www.youtube.com/watch?v=q5aOR6-WkUo) - Updated triggers for Plesk 9 support * Wed Sep 24 2008 Scott R. Shinn - 2.0.5-1 - leekspin (http://www.leekspin.com/) - update to 2.05st-20080728 * Wed Jul 9 2008 Scott R. Shinn - 2.04-2 - ding, 35. Today is my birthday - update to 2.04 - updated clamav trigger to chmod the whole /var/log/clamav dir to qscand.qscand - Added qmail-log-parse.sh and /var/log/qscan, to contain log files used by stats * Wed Mar 26 2008 Scott R. Shinn - 2.02-1 - update to 2.02 - update to q-s-2.02st-20080119 * Thu Mar 22 2007 Scott R. Shinn 2.0.1-14.2 - really fixed the trigger this time. Older clamav would write the log as root, newer are enforcing the userID specified in User. - logrotate was setting ownership of clam logs back to 644/clamav.clamav - updated the trigger to 1) fix the above, and 2) set the perms on the log file to 664. This should resolve upgrade issues with a pre-existing install. * Wed Feb 21 2007 Scott R. Shinn 2.0.1-13 - fix for clamav 0.90 * Tue Jan 2 2007 Scott R. Shinn 2.0.1-12 - I should really keep the changelog updated better - cleaned up attrs on files (BUG found by bruen) - update to q-s-2.01st-20061223 - added back in logrotate script * Sun Jul 9 2006 Scott R. Shinn 2.0.1 - update to q-s-2.01st-20060626 - added PSA support - fixed upgrading event for PSA - major trigger work * Thu May 11 2006 Scott R. Shinn 2.0.1-3 - update to 2.0.1 - update salvatores q-s patch * Sun May 22 2005 Scott R. Shinn 1.25 - update salvatores q-s patch - merge project gamera and psa qmail-scanner into one package - major trigger tweaks - Requires updates - added Conflicts with drweb (it uses a wrapper) * Thu Feb 10 2005 Scott R. Shinn 1.25 - update to 1.25 - trigger fixes * Thu Nov 04 2004 Scott R. Shinn 1.24 - update to 1.24 - Project Gamera modifications * Tue Oct 05 2004 Scott R. Shinn 1.23-3 - dar tweaks * Sun Aug 22 2004 Scott R. Shinn 1.23-art.rh9.1 - updated to q-s 1.23 - updated Salvatore Toribio's st patch to 0819 - added in a trigger event to correct q-s when psa-qmail is upgraded * Sun Jun 06 2004 Scott R. Shinn 1.22-art.rh9.8 - updated Salvatore Toribio's st patch. This allows per-domain settings on scanners - more bug fixes to correct permissions issues * Tue May 25 2004 Scott R. Shinn 1.22-art.rh9.4 - boy I need to keep up on the changelog - updated to 1.22 - changed the qmail-scanner-reconfigure script to tag spam with ****SPAM****, reenabled mime checks - fixed a permissions bug on the nightly cleanup cronjob * Fri Feb 13 2004 Scott R. Shinn 1.20-gamera.rh9.12 - made a common generic rpm so I can build for both PSA and Gamera - added in delete/reject/quarantine support - fixed qscand bug * Sun Dec 28 2003 Scott R. Shinn 1.20-art.rh9.9 - lots of bug fixes - tweaks for the Gamera project - support for tcpserver * Wed Nov 26 2003 Scott R. Shinn 1.20-art.rh9.1 - updated to the final release of 1.20 - turned off debugging - disabled Bad MIME checks by default - disabled notices to admin by default * Fri Oct 26 2003 Scott R. Shinn 1.20rc3-art.rh9.1 - Modified to work with RH 9 - updated to 1.20rc4 * Fri Oct 03 2003 Scott R. Shinn 1.20rc3-art.rh73.1 - Modified to work with RH 7.3 - updated to 1.20rc3 * Sun Sep 07 2003 Scott R. Shinn 1.16-art.1 - Modified heavily to work with PSA's version of qmail * Tue Jun 24 2003 Konstantin Riabitsev 1.16-0.qvcs.5 - Adapting for qvcs. * Sat Apr 5 2003 Konstantin Riabitsev - Initial build. #------------------------------------------------------------------------------