Submitted By: Jim Gifford (jim at linuxfromscratch dot org) Date: 2004-01-16 Initial Package Version: 0.3.12 Origin: Jim Gifford Description: Adds Support for the Courier-MTA diff -Naur amavis-0.3.12.orig/README.courier amavis-0.3.12/README.courier --- amavis-0.3.12.orig/README.courier 1970-01-01 00:00:00.000000000 +0000 +++ amavis-0.3.12/README.courier 2004-01-17 01:07:29.000000000 +0000 @@ -0,0 +1,74 @@ +How To Use AMaViS With postfix +****************************** + + By Lars Hecking + Modified for Courier by Jim Gifford + + This setup requires Courier and Maildrop. + + You'll also need external unpackers, like arc etc. + + And yes, you need to have a virusscanner installed; and it must be + in the $PATH environment variable. + + Also, a problem one might run into is some weird configure output + about undefined macros. To fix this, one needs to install: + + http://cryp.to/autoconf-archive/Installed_Packages/acx_pthread.m4 + into the directory specified by 'aclocal --print-ac-dir' and then rerun + aclocal && automake && autoconf ! + + In this configuration, amavis runs under a non-privileged user id + (by default: amavis). Make sure it exists before proceeding. If a different + user is chosen, use the "--with-amavisuser=USER" configure option for amavis. + + So, if you use defaults + + ./configure --enable-courier + + it should work. + + Configuring courier itself is very simple: + + * a change to /etc/courier/courierd or /usr/lib/etc/courier/courierd: + + From + DEFAULTDELIVERY="| /usr/bin/maildrop" + or + DEFAULTDELIVERY=./Maildir + + To + DEFAULTDELIVERY="| /usr/sbin/amavis | /usr/bin/maildrop" + + This is the recommended setup for Amavis. There is an alternative + method which is listed below. + + * a change to /etc/courier/courierd or /usr/lib/etc/courier/courierd: + + From + DEFAULTDELIVERY=./Maildir + + To + DEFAULTDELIVERY="| /usr/bin/maildrop" + + * add to /etc/courier/maildroprc or /usr/lib/etc/courier/maildroprc: + + # Virus Scan + # + import SENDER + import RECIPIENT + + xfilter "/usr/sbin/amavis $SENDER $RECIPIENT" + + Additional Maildroprc rules + + If you would like to put your infected emails into their own Maildir + you can add the following line to your maildroprc file. Make sure + you create the Maildir or this rule will not work properly + + if (/^Subject:.*VIRUS IN*/) + { + exception { + to "$DEFAULT/.Virus/" + } + } diff -Naur amavis-0.3.12.orig/amavis/Makefile.am amavis-0.3.12/amavis/Makefile.am --- amavis-0.3.12.orig/amavis/Makefile.am 2001-08-28 11:53:50.000000000 +0000 +++ amavis-0.3.12/amavis/Makefile.am 2004-01-17 01:06:12.000000000 +0000 @@ -27,6 +27,9 @@ else \ umask 077 ; \ $(mkinstalldirs) $$subdir ; \ + if test $(MTA) = courier ; then \ + chmod 777 $$subdir; \ + fi; \ if test -n $(amavisuser) ; then \ chown $(amavisuser) $$subdir ; \ if test $(MTA) = qmail ; then \ @@ -39,6 +42,9 @@ if test ! -d $(DESTDIR)$(virusdir) ; then \ umask 077 ; \ $(mkinstalldirs) $(DESTDIR)$(virusdir) ; \ + if test $(MTA) == courier ; then \ + chmod 777 $(DESTDIR)$(virusdir); \ + fi; \ if test -n $(amavisuser) ; then \ chown $(amavisuser) $(DESTDIR)$(virusdir) ; \ fi; \ diff -Naur amavis-0.3.12.orig/amavis/checkaccount.in amavis-0.3.12/amavis/checkaccount.in --- amavis-0.3.12.orig/amavis/checkaccount.in 2001-07-19 18:52:57.000000000 +0000 +++ amavis-0.3.12/amavis/checkaccount.in 2004-01-17 01:06:12.000000000 +0000 @@ -5,10 +5,19 @@ if test -f "/etc/mail/aliases"; then aliases=/etc/mail/aliases + newaliases=newaliases elif test -f "/etc/aliases"; then aliases=/etc/aliases + newaliases=newalaises +elif test -f "/etc/courier/aliases/system"; then + aliases=/etc/courier/aliases/system + newaliases=makealiases +elif test -f "/usr/lib/courier/etc/aliases/system"; then + aliases=/usr/lib/courier/etc/aliases/system + newaliases=/usr/lib/courier/sbin/makealiases else aliases= + newaliases= fi if test "`echo \"@mailto@\" | grep \"@\" | wc -l`" -eq 1; then @@ -22,7 +31,7 @@ if test "`grep \"@mailto@\" $aliases | wc -l`" -lt 1; then if test -w "$aliases"; then echo "@mailto@: $whoami" >> $aliases - `newaliases` || echo "WARNING: could not run \"newaliases\"" + `$newaliases` || echo "WARNING: could not run \"newaliases\"" else echo "WARNING: $aliases is not writable by \"$whoami\"" error="yes" diff -Naur amavis-0.3.12.orig/amavis/mta/courier_args amavis-0.3.12/amavis/mta/courier_args --- amavis-0.3.12.orig/amavis/mta/courier_args 1970-01-01 00:00:00.000000000 +0000 +++ amavis-0.3.12/amavis/mta/courier_args 2004-01-17 01:06:12.000000000 +0000 @@ -0,0 +1,6 @@ +# command line parsing, courier version + +# This file is just a place holder, it +# may be needed in the future. + +# End courier cmd line parsing diff -Naur amavis-0.3.12.orig/amavis/mta/courier_init amavis-0.3.12/amavis/mta/courier_init --- amavis-0.3.12.orig/amavis/mta/courier_init 1970-01-01 00:00:00.000000000 +0000 +++ amavis-0.3.12/amavis/mta/courier_init 2004-01-17 01:06:12.000000000 +0000 @@ -0,0 +1,12 @@ +# courier + +# error codes +$VIRUSERR = 0; +$REGERR = 75; # EX_TEMPFAIL from sendmail sysexits.h + +# don't run suid + +# set path explicitly +$ENV{PATH} = "/bin:/usr/bin:/usr/local/bin"; + +# End courier diff -Naur amavis-0.3.12.orig/amavis/mta/courier_send amavis-0.3.12/amavis/mta/courier_send --- amavis-0.3.12.orig/amavis/mta/courier_send 1970-01-01 00:00:00.000000000 +0000 +++ amavis-0.3.12/amavis/mta/courier_send 2004-01-17 01:06:12.000000000 +0000 @@ -0,0 +1,17 @@ + # sending mail, courier version + + # Courier is using STDIN and STDOUT so there is no + # need to open the mail file + while (<$fh>) { + next if ($seen_xheader == 0 && m/^$X_HEADER_TAG:/o); + if ($seen_xheader == 0 && m/\A\r?\n\Z/) { + print STDOUT "$X_HEADER_TAG: $X_HEADER_LINE\n"; + $seen_xheader = 1; + } + print STDOUT $_; + } + + # Pass up the LDA's error code + do_exit(retcode($?), __LINE__); + +# End courier diff -Naur amavis-0.3.12.orig/configure.in amavis-0.3.12/configure.in --- amavis-0.3.12.orig/configure.in 2003-02-18 12:48:38.000000000 +0000 +++ amavis-0.3.12/configure.in 2004-01-17 01:06:12.000000000 +0000 @@ -261,6 +261,20 @@ fi fi +AC_ARG_ENABLE(courier, +[ --enable-courier use courier as MTA], + [if test "x$enableval" = "xyes" ; then + MTA=courier + fi]) + +dnl Need to find out whether sendmail_wrapper is really courier' sendmail +if test "x$MTA" = "xsendmail" ; then + strings ${sendmail_wrapper} | grep -i courier >/dev/null 2>&1 + if test $? -eq 0 ; then + MTA=courier + fi +fi + AC_ARG_ENABLE(exim, [ --enable-exim use exim as MTA], [if test "x$enableval" = "xyes" ; then @@ -474,11 +488,13 @@ ### Clam Antivirus Daemon clamd_scanner_frag=/dev/null +if test "x$MTA" != "xcourier" ; then AC_CHECKING([*** Clam Antivirus (Daemon) ***]) AC_PATH_PROG(clamd,clamd,,$PATH:/usr/bin:/usr/local/bin) -if test "x$clamd" != "x" ; then - avscanner="$avscanner Clam Antivirus Daemon" - clamd_scanner_frag=$srcdir/amavis/av/clamavd + if test "x$clamd" != "x" ; then + avscanner="$avscanner Clam Antivirus Daemon" + clamd_scanner_frag=$srcdir/amavis/av/clamavd + fi fi ### Command AntiVirus for Linux @@ -726,11 +742,13 @@ ### OpenAntiVirus ScannerDaemon oav_scanner_frag=/dev/null +if test "x$MTA" != "xcourier" ; then AC_CHECKING([*** OpenAntiVirus ScannerDaemon ***]) AC_PATH_PROG(oav,ScannerDaemon.jar,,$PATH:/bin:/usr/bin:/usr/local/bin) -if test "x$oav" != "x" ; then - avscanner="$avscanner OpenAntiVirus ScannerDaemon" - oav_scanner_frag=$srcdir/amavis/av/oav + if test "x$oav" != "x" ; then + avscanner="$avscanner OpenAntiVirus ScannerDaemon" + oav_scanner_frag=$srcdir/amavis/av/oav + fi fi ### Norman Virus Control for Linux