[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Sendmail>MailScanner>SpamAssassin:WebMin



Hello Dave,

/etc/mailscanner is artifact from stable.   try 'dpkg -s /etc/mailscanner/mailscanner.conf' to verify package ownership, then 'dpkg --purge mailscanner' to rid yourself of it.  Note that this will also remove any later versions, like your current testing package.

Now, for the backport. 

The mailscanner 4.26.7 debian testing/unstable needs a bit more magic than prior versions for backporting, as pulls some ucf magic that doesn't work on stable's version of ucf.

Luckly, this can all be worked around by making package changes.  Use the debian/rules and debian/control files appended below the signature, and you should be off to the races.

Other little details on how I build my backports for mailscanner:

apt-get -t unstable source mailscanner (/etc/apt/sources.list has stable deb sources, and unstable deb-src entries)
cd mailscanner-4.26.7
dch -i
vi debian/rules
vi debian/control
make -f debian/rules clean
make -f debian/rules binary

If all goes well, you'll have a much happier mailscanner package. 
Edit /etc/MailScanner/MailScanner.conf, then /etc/default/mailscanner prior to starting.

You will also need a backport of libnet-cidr-perl-0.09 for MailScanner 4.26.7 to work.   It also needs some magic in debian/rules and debian/control.  You could get this using CPAN, but that defeats the purpose of a package management system. 

I can't help you with the webmin plugin as I hit the configuration files directly, but I'll assume that you'll need it's testing/unstable equivalent.

You'll also want to ensure that 'Notify Senders = no' in MailScanner.conf.  The package and upstream have this set to 'yes', which is a *major* source of spam.  I've filed a bug report with the package maintainer to have this defaulted to 'no', but I'm unsure if he'll act on it. 

Finally, if you use sendmail, you'll need to setup two daemons, one to send the inbound mail through to a queue directory for MailScanner, and another to deliver once mailscanner is done.   See the sendmail start script below.

Good luck, feel free to contact me if you have any other issues. 

-- 


Martin Foster                                   Phone:   +61 3 9674 7500
Systems Engineer               P A C I F I C    Fax:     +61 3 9698 4959
Pacific Internet (Australia)  I N T E R N E T   
http://www.pacific.net.au/                      NASDAQ:  PCNTF




---[MailScanner debian/rules]--------------------------
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This is the debhelper compatability version to use.
export DH_COMPAT=4

p = mailscanner
d = debian/$(p)

PWD = $(shell pwd)

patch_stamp = patch-stamp
patchdir = debian/patches

build: $(patch_stamp) build-stamp
build-stamp:
        dh_testdir
        : # don't build anything
        touch build-stamp

clean: unpatch
        dh_testdir
        dh_testroot
        rm -f *-stamp
        rm -rf bin/tnef*
        rm -rf ../$(shell basename $(PWD)).orig/bin/tnef*
        -find . ../$(shell basename $(PWD)).orig -name '.#*' | xargs rm -f
        dh_clean

install: build
        dh_testdir
        dh_testroot
        dh_clean -k
        dh_installdirs \
                usr/sbin \
                usr/share/doc/mailscanner/html \
                usr/share/doc/mailscanner/examples \
                usr/share/doc/mailscanner/exim \
                usr/share/doc/mailscanner/sendmail \
                usr/share/man/man5 \
                usr/share/man/man8 \
                usr/share/MailScanner \
                etc \
                etc/default \
                etc/cron.daily \
                var/lock/subsys \
                var/run/MailScanner \
                var/lib/MailScanner \
                var/spool/MailScanner/archive \
                var/spool/MailScanner/incoming \
                var/spool/MailScanner/quarantine

#       cp -p bin/MailScanner $(d)/usr/sbin/
        sed -e 's,/opt/MailScanner/lib,/usr/share/MailScanner,g' \
                bin/MailScanner > $(d)/usr/sbin/MailScanner
        chmod 755 $(d)/usr/sbin/MailScanner

        sed -e 's,/opt/MailScanner/bin,/usr/sbin,g' \
            -e 's,/opt/MailScanner/etc,/etc/MailScanner,g' \
                bin/check_mailscanner > $(d)/usr/sbin/check_mailscanner
        chmod 755 $(d)/usr/sbin/check_mailscanner

        cp -p bin/df2mbox $(d)/usr/sbin/

        cp -p bin/upgrade_MailScanner_conf $(d)/usr/sbin/
        pod2man --section=8 bin/upgrade_MailScanner_conf --center=MailScanner \
                > $(d)/usr/share/man/man8/upgrade_MailScanner_conf.8

        sed -e 's,/opt/MailScanner/bin,/usr/sbin,g' \
            -e 's,/tmp/MailScanner,/var/lock/subsys/MailScanner,g' \
                bin/update_virus_scanners > $(d)/usr/sbin/update_virus_scanners
        chmod 755 $(d)/usr/sbin/update_virus_scanners

        chown mail.mail $(d)/var/lib/MailScanner
        chmod 750 $(d)/var/lib/MailScanner

        cp -a lib/MailScanner* $(d)/usr/share/MailScanner/.
        -find $(d)/usr/share/MailScanner -type f | xargs -n 50 chmod 644

        : # config files
        cp -a etc $(d)/etc/MailScanner
        rmdir $(d)/etc/MailScanner/old
        rmdir $(d)/etc/MailScanner/tcp
        cp -a debian/mailscanner.default $(d)/etc/default/mailscanner
        cp -a debian/cron.daily $(d)/etc/cron.daily/mailscanner
        chmod 755 $(d)/etc/cron.daily/mailscanner
        mkdir $(d)/etc/MailScanner/wrapper
        mkdir $(d)/etc/MailScanner/autoupdate
        cp -p lib/*wrapper* $(d)/etc/MailScanner/wrapper/.
        cp -p lib/*autoupdate* $(d)/etc/MailScanner/autoupdate/.
        sed -e 's,/usr/local,/usr,g' \
                lib/clamav-autoupdate \
                        > $(d)/etc/MailScanner/autoupdate/clamav-autoupdate
        chmod 755 $(d)/etc/MailScanner/autoupdate/clamav-autoupdate
        cp -p debian/01_mailscanner_config \
                $(d)/usr/share/doc/mailscanner/examples/.

        : # examples
        mv $(d)/etc/MailScanner/*mcp $(d)/usr/share/doc/mailscanner/examples/.
        cp -a $(d)/etc/MailScanner/rules \
                $(d)/usr/share/doc/mailscanner/examples/.
        chmod 644 $(d)/usr/share/doc/mailscanner/examples/rules/EXAMPLES
        chmod 644 $(d)/usr/share/doc/mailscanner/examples/rules/README
        chmod 644 $(d)/usr/share/doc/mailscanner/examples/rules/spam.whitelist.rules

        rm -f $(d)/etc/MailScanner/rules/EXAMPLES
        rm -f $(d)/etc/MailScanner/rules/README

        : # documentation
        cp -a docs/* $(d)/usr/share/doc/mailscanner/html/
        rm -f $(d)/usr/share/doc/mailscanner/html/COPYING
        rm -f $(d)/usr/share/doc/mailscanner/html/ChangeLog
        mv $(d)/usr/share/doc/mailscanner/html/man/MailScanner.8 \
                $(d)/usr/share/man/man8/.
        mv $(d)/usr/share/doc/mailscanner/html/man/MailScanner.conf.5 \
                $(d)/usr/share/man/man5/.
        cp -p README notes.txt INSTALL $(d)/usr/share/doc/$(p)/

        cp -a debian/exim-init.d debian/exim-cron.daily \
                $(d)/usr/share/doc/mailscanner/exim/

        cp -a debian/sendmail-init.d debian/sendmail.conf \
                $(d)/usr/share/doc/mailscanner/sendmail/

        -find $(d) -name '*[Ss]olaris' | xargs rm -f
        -find $(d) -name CVS | xargs rm -rf
        sed -e 's,/usr/local/MailScanner/bin/tnef,/usr/bin/tnef,g' \
            -e 's,^\(Run As .*=\),\1 Debian-exim,g' \
            -e 's,^\(Max Children =\).*,\1 1,g' \
            -e '/^MTA/s,sendmail,exim,g' \
            -e 's,/usr/sbin/sendmail,/usr/sbin/exim,g' \
            -e 's,/etc/exim/exim_send\.conf,/etc/exim/exim4_outgoing.conf,g' \
            -e 's,^\(Sendmail2\),#\1,g' \
            -e 's,^#\(Sendmail2.*exim\),\1,g' \
            -e 's,/opt/MailScanner/bin/tnef,/usr/bin/tnef,g' \
            -e 's,/opt/MailScanner/etc,/etc/MailScanner,g' \
            -e 's,/opt/MailScanner/var,/var/MailScanner,g' \
            -e 's,/var/spool/mqueue *$$,/var/spool/exim4/input,g' \
            -e 's,/var/spool/mqueue\.in *$$,/var/spool/exim4_incoming/input,g' \
            -e 's,^\(PID file *= *\).*,\1/var/run/MailScanner/MailScanner.pid,g' \
            -e 's,^\(Information Header *= *\),#\1,g' \
            -e 's,^\(Spam List *= *\),\1# ,g' \
            -e 's,^\(Virus Scanner *= *\).*,\1none,g' \
            -e 's,^\(Accept Spam From\),#\1,g' \
            -e 's,^\(Spam Checks *= *\).*,\1yes,g' \
            -e 's,^\(Use SpamAssassin *= *\).*,\1yes,g' \
            -e 's,^\(SpamAssassin User State Dir *=\).*,\1 /var/lib/MailScanner,g' \
                etc/MailScanner.conf > $(d)/etc/MailScanner/MailScanner.conf

        sed -e 's,^#\(auto_whitelist_\),\1,g' \
            -e 's,^\(auto_whitelist_path[       ]*\).*,\1/var/lib/MailScanner/auto-whitelist,' \
            -e 's,^#\(bayes_\),\1,g' \
            -e 's,^\(bayes_path[        ]*\).*,\1/var/lib/MailScanner/bayes,' \
                etc/spam.assassin.prefs.conf \
                > $(d)/etc/MailScanner/spam.assassin.prefs.conf

        sed -e 's,/opt/MailScanner/lib/,/etc/MailScanner/wrapper/,g' \
                etc/virus.scanners.conf \
                > $(d)/etc/MailScanner/virus.scanners.conf

        -find $(d)/etc/MailScanner -type f | xargs -n 50 chmod 644
        chmod 755 $(d)/etc/MailScanner/autoupdate/*
        chmod 755 $(d)/etc/MailScanner/wrapper/*

#       sed -e 's,/usr/local/f-prot,/usr/lib/f-prot,g' \
#               f-prot/f-protwrapper \
#               > $(d)/etc/mailscanner/wrapper/f-protwrapper
#       chmod 755 $(d)/etc/mailscanner/wrapper/f-protwrapper

# Build architecture-independent files here.
binary-indep: build install
        dh_testdir
        dh_testroot
        dh_installdebconf
        dh_installdocs debian/README.exim4
        dh_installexamples
#       dh_installlogrotate
        dh_installinit
        dh_installcron
        dh_installman
        dh_undocumented check_mailscanner.8 df2mbox.8
        dh_installchangelogs docs/ChangeLog
        dh_compress -X.shtml -X01_mail -Xreports
        dh_fixperms
        chmod -R 750 $(d)/var/spool/MailScanner
        chown -R mail:mail $(d)/var/spool/MailScanner
        chown -R mail:mail $(d)/var/run/MailScanner

#       dh_perl
        dh_gencontrol
        dh_md5sums
        dh_builddeb

# Build architecture-dependent files here.
binary-arch: build install
# We have nothing to do by default.

binary: binary-indep binary-arch

debian_patches = \
        awk-location \
        f-prot-location \
        clamav-location \
        filename.rules.conf \
        filetype.rules.conf \
        spam.assassin.prefs.conf \
        upgrade-manpage

#       rfc822-conformance

patch: $(patch_stamp)
$(patch_stamp): $(unpack_stamp) \
    $(foreach p,$(debian_patches),$(patch_stamp)-$(p))
        @echo "Patches applied: $(debian_patches)"
        @echo -e "\nPatches that Debian applied in this version:" > pxxx
        @for i in $(debian_patches); do \
          echo -e "\n$$i:" >> pxxx; \
          sed -n 's/^# *DP: */  /p' $(patchdir)/$$i.dpatch >> pxxx; \
        done
        @mv -f pxxx $@

unpatch:
        @for stamp in none `ls -1t $(patch_stamp)-* 2>/dev/null`; do \
          case "$$stamp" in none|patched-stamp|patched-\*) continue; esac; \
          patch=`echo $$stamp | sed -e 's,$(patch_stamp)-,,'`; \
          echo "trying to revert patch $$patch ..."; \
          if [ -x $(patchdir)/$$patch.dpatch ]; then true; else \
            chmod +x $(patchdir)/$$patch.dpatch; fi; \
          if $(patchdir)/$$patch.dpatch -unpatch; then \
            echo "reverted $$patch patch."; \
            rm -f $$stamp; \
          else \
            echo "error in reverting $$patch patch."; \
            exit 1; \
          fi; \
        done
        rm -f patched-stamp

$(patch_stamp)-%: $(patchdir)/%.dpatch
        @if [ -x $< ]; then true; else chmod +x $<; fi
        @if [ -f $@ ]; then \
          echo "$* patches already applied."; exit 1; \
        fi
        $< -patch
        @echo "$* patches applied." > $@


.PHONY: build clean binary-indep binary-arch binary install patch unpatch
--------------------------------------------------

---[MailScanner debian/control]-------------------------
Source: mailscanner
Section: mail
Priority: optional
Maintainer: Matthias Klose <doko@debian.org>
Build-Depends-Indep: debhelper (>> 4.0.2), perl (>= 5.6.1)
Standards-Version: 3.6.1

Package: mailscanner
Architecture: all
Pre-Depends: debconf (>= 0.5.00)
Depends: exim4 | mail-transport-agent, perl (>= 5.6.1), libio-stringy-perl, libmime-base64-perl, libmailtools-perl, libmime-perl (>= 5.411-1), libnet-cidr-perl, libhtml-parser-perl, libmail-audit-perl, unzip, ncftp | wget, ucf
Recommends: tnef (>= 1.1.1), spamassassin
Suggests: clamav, f-prot-installer
Conflicts: exim4-base (<< 4.30-3)
Description: An email virus scanner and spam tagger
MailScanner is a freely distributable E-Mail gateway virus scanner
and spam detector. It uses sendmail or Exim as its basis, and a choice of
17 commercial virus scanning engines to do the actual virus scanning.
It can decode and scan attachments intended solely for Microsoft Outlook
users (MS-TNEF). If possible, it will disinfect infected documents and
deliver them automatically. It also has features which protect it against
Denial Of Service attacks.
.
Virus checking is disabled by default, spam checking is enabled by default.
After installation, you can enable virus checking, write your own virus
scanner or install one of the supported commercial anti-virus packages.
---------------------------------------

---[etc/init.d/sendmail, assumes that MailScanner is configured for an inbound queue on /var/spool/mqueue.in]--------
#!/bin/sh -e
#
# $Sendmail: init.d,v 8.12.3 2002-04-15 17:35:56 cowboy Exp $
#
# Sendmail rc script for Debian (/etc/init.d/sendmail)
#
# Copyright (c) 2001-2002, Richard Nelson <cowboy@debian.org>.
#
# Notes (to all):
#       * *** Do not edit this file *** Instead edit /etc/mail/sendmail.conf
#
# Notes (to self):
#       *
#
set -e;
PATH=/bin:/usr/bin:/sbin:/usr/sbin;
 
case "$1" in
        start)
                /usr/sbin/sendmail -bd -ODeliveryMode=queueonly \
                                        -OQueueDirectory=/var/spool/mqueue.in \
                                        -OControlSocketName=/var/run/sendmail/mta.in/smcontrol \
                                        -OPidFile=/var/run/sendmail/mta.in/sendmail.pid \
                                        -OProcessTitlePrefix=MTA.in
                /usr/sbin/sendmail -q30s
                touch /var/run/sendmail/stampdir/reload
                ;;
        stop)
                kill -15 `head -1 /var/run/sendmail/mta/sendmail.pid`
                kill -15 `head -1 /var/run/sendmail/mta.in/sendmail.pid`
                ;;
        restart|reload)
                kill -1 `head -1 /var/run/sendmail/mta/sendmail.pid`
                kill -1 `head -1 /var/run/sendmail/mta.in/sendmail.pid`
                touch /var/run/sendmail/stampdir/reload
                ;;
        *)
                echo "Not implemented."
                ;;
esac
 
exit 0;
----------------------------------------------



----[libnet-cidr-perl debian/rules]--------------
#!/usr/bin/make -f

TMP     =$(CURDIR)/debian/libnet-cidr-perl

build: build-stamp
build-stamp:
        dh_testdir
        /usr/bin/perl Makefile.PL INSTALLDIRS=vendor
        $(MAKE) OPTIMIZE="-O2 -g -Wall"

        touch build-stamp

clean:
        dh_testdir
        dh_testroot
        -$(MAKE) distclean
        dh_clean build-stamp install-stamp

install: install-stamp
install-stamp: build-stamp
        dh_testdir
        dh_testroot
        dh_clean -k

        $(MAKE) install PREFIX=$(TMP)/usr;
        touch install-stamp

binary-arch: build install
# We have nothing to do by default.

binary-indep: build install
        dh_testdir
        dh_testroot
        dh_installdocs README
        dh_perl
        dh_installmanpages
        dh_installchangelogs Changes
        dh_link
        dh_strip
        dh_compress
        dh_fixperms
        dh_installdeb
        dh_gencontrol
        dh_md5sums
        dh_builddeb

source diff:
        @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary
-----------------------------------------


---[libnet-cidr-perl debian/control]----------------
Source: libnet-cidr-perl
Section: net
Priority: optional
Build-Depends-Indep: perl (>= 5.6.0-16)
Build-Depends: debhelper (>= 4)
Maintainer: Marc Brockschmidt <marc@dch-faq.de>
Standards-Version: 3.6.1

Package: libnet-cidr-perl
Architecture: all
Depends: ${perl:Depends}
Description: Manipulate IPv4/IPv6 netblocks in CIDR notation
The Net::CIDR package contains functions that manipulate lists of
IP netblocks expressed in CIDR notation. The Net::CIDR functions
handle both IPv4 and IPv6 addresses.
---------------------------------------------------------------




On Thu, 2004-02-19 at 03:36, Dave's List Addy wrote:
Hi

We are setting up a Mailhub for our hosting clients, want to send mail to
our Debian box, Woody with BF4, and then redirect mail to the hosting/email
servers (we use Cobalt Raq's for the clients.)

We installed sendmail from stable, Mailscanner and SpamAssassin from Testing
using the instructions from the MailScanner website.

We felt we did everything correct except now we see 2 directories for
MailScanner

 /etc/MailScanner
 /etc/mailscanner

I am thinking we want the /etc/MailScanner as the true dir. Is this some
left over items from doing the MailScanner install from stable first, then
removing with apt and doing a testing install?? This was the method they
recommended at MailScanner.

Webmin seems to be picking up the lower case mail scanner. But when we go in
to make modifications it kills MailScanner with the following error

Cannot open config file /opt/MailScanner/etc/MailScanner.conf, no such file
or directory at /usr/share/MailScanner/MailScanner/Config.pm line 535.

Anyone have any hints or help to aid us??
-- 
Thanks!!
David Thurman
List Only at Web Presence Group Net


Reply to: