I'm submitting this in the hope it may be of use to someone,
and in the open source spirit of "release early, release
often."  I spent several hours yesterday installing
qmail-scanner and building RPMs for it, so maybe this will
save someone out there some time.  It is by no means
finished (I just started using qmail-scanner yesterday!), so
please treat it as a guide.  Maybe once some improvements
are made and it is more fully tested, Jason can post it on
the home page.

Thanks for the great software.
-Adi
%define name qmail-scanner
%define real_name qmail-scanner
%define version 1.11
%define real_version 1.11
%define release 2
%define initdir %{_initrddir}

Summary: Qmail-Scanner is a content scanner for Qmail
Name: %{name}
Version: %{version}
Release: %{release}
License: GPL
Group: Networking/Mail
URL: http://qmail-scanner.sourceforge.net/
Source: http://prdownloads.sourceforge.net/qmail-scanner/qmail-scanner-1.11.tgz
Patch: qmail-scanner-quarattach_tabs.patch
Requires: perl >= 5.005_03 perl-Time-HiRes qmail daemontools /usr/bin/reformime
Buildroot: %{_tmppath}/%{name}-root
Prefix: %{_prefix}
BuildPrereq: perl >= 5.005_03 qmail
Distribution: Qmail-Scanner

%define __find_provides /usr/lib/rpm/find-provides.perl
%define __find_requires /usr/lib/rpm/find-requires.perl

%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 -q
%setup -q -n %{real_name}-%{real_version}
%patch

%build
yes | ./configure --archive yes

%install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT

mkdir -p $RPM_BUILD_ROOT/var/spool/qmailscan
maildirmake $RPM_BUILD_ROOT/var/spool/qmailscan/quarantine
maildirmake $RPM_BUILD_ROOT/var/spool/qmailscan/working
maildirmake $RPM_BUILD_ROOT/var/spool/qmailscan/archive
install -m 0644 quarantine-attachments.txt \
  $RPM_BUILD_ROOT/var/spool/qmailscan/quarantine-attachments.txt
chown -R qmailq:qmail $RPM_BUILD_ROOT/var/spool/qmailscan/

mkdir -p $RPM_BUILD_ROOT/var/qmail/bin
   #(i.e same perms as qmail-queue)
install -m 4755 qmail-scanner-queue.pl \
  $RPM_BUILD_ROOT/var/qmail/bin/qmail-scanner-queue.pl
chown qmailq:qmail $RPM_BUILD_ROOT/var/qmail/bin/qmail-scanner-queue.pl

[ -x /usr/lib/rpm/brp-compress ] && /usr/lib/rpm/brp-compress


%files
#%defattr(-,root,root)
%doc CHANGES COPYING FAQ.php manual-install.php perlscanner.php README README.html 
TODO.php
/var/qmail/bin/qmail-scanner-queue.pl
/var/spool/qmailscan/


%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT


%post
PATH="/usr/local/bin:$PATH" export PATH
# initialize the version file
setuidgid qmaild /var/qmail/bin/qmail-scanner-queue.pl -z
# initialize the perlscanner database
setuidgid qmaild /var/qmail/bin/qmail-scanner-queue.pl -g

if svc-isup smtpd; then
  if ! [ -e /service/smtpd/env/ ]; then
    mkdir /service/smtpd/env/
  fi
  echo "/var/qmail/bin/qmail-scanner-queue.pl" > /service/smtpd/env/QMAILQUEUE
  echo ""
  echo "qmail-scanner-queue.pl has been added to /service/smtpd/env/QMAILQUEUE"
  echo "Now, you need to add 'envdir /service/smtpd/env' to your"
  echo "/service/smtpd/run script, and then restart qmail-smtpd with:"
  echo "  svc-stop smtpd; svc-start smtpd"
  echo ""
else
  echo ""
  echo "Now update your Qmail startup script(s) (e.g. /etc/rc.d/init.d/qmail )"
  echo "so that Qmail knows to use qmail-scanner-queue.pl instead of qmail-queue."
  echo "See the README file for details."
  echo ""
fi

%postun
rm -f /var/spool/qmailscan/qmail-scanner-queue-version.txt
rm -f /var/spool/qmailscan/quarantine-attachments.db
if [ -e /service/smtpd/env/QMAILQUEUE ] &&
   [ `cat /service/smtpd/env/QMAILQUEUE` = "/var/qmail/bin/qmail-scanner-queue.pl" ]
then
  rm -f /service/smtpd/env/QMAILQUEUE
fi


%changelog
* Tue Apr 30 2002 Adi Fairbank <[EMAIL PROTECTED]>
- made a few improvements for release 2

* Mon Apr 29 2002 Adi Fairbank <[EMAIL PROTECTED]>
- initial RPM spec file
--- quarantine-attachments.txt~ Wed Mar  6 18:17:35 2002
+++ quarantine-attachments.txt  Mon Apr 29 16:22:38 2002
@@ -71,11 +71,11 @@
 #The following matches Date: headers that are over 100 chars in length
 #these are impossible in the wild
 .{100,}                        Virus-Date:     MIME Header Buffer Overflow
-.{100,}                        Virus-Mime-Version:  MIME Header Buffer Overflow 
-.{100,}                        Virus-Message-ID:    MIME Header Buffer Overflow
+.{100,}                        Virus-Mime-Version:     MIME Header Buffer Overflow 
+.{100,}                        Virus-Message-ID:       MIME Header Buffer Overflow
 .{100,}                        Virus-From:          MIME Header Buffer Overflow
-.{100,}                        Virus-Return-Path:   MIME Header Buffer Overflow
-.{100,}                        Virus-Resent-Date:   MIME Header Buffer Overflow
+.{100,}                        Virus-Return-Path:      MIME Header Buffer Overflow
+.{100,}                        Virus-Resent-Date:      MIME Header Buffer Overflow
 #
 #Let's stop that nasty BadTrans virus from uploading your keystrokes...
 
[EMAIL PROTECTED]|[EMAIL PROTECTED]|[EMAIL PROTECTED]|[EMAIL PROTECTED]|[EMAIL PROTECTED]|[EMAIL PROTECTED]|[EMAIL PROTECTED]|[EMAIL PROTECTED]|[EMAIL PROTECTED]|[EMAIL PROTECTED]|[EMAIL PROTECTED]|[EMAIL PROTECTED]|[EMAIL PROTECTED]|[EMAIL PROTECTED]|[EMAIL PROTECTED]|[EMAIL PROTECTED]|[EMAIL PROTECTED]
    Virus-To:       BadTrans Trojan exploit!

Reply via email to