Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 31 Dec 2000 15:32:38 +0200 (IST)
From:      roman@xpert.com
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/23978: NEW PORT: security/amavis-perl
Message-ID:  <200012311332.eBVDWcG18803@alchemy.oven.org>
Resent-Message-ID: <200012311340.eBVDe4O74508@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         23978
>Category:       ports
>Synopsis:       NEW PORT: security/amavis-perl, mail antivirus
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 31 05:40:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Roman Shterenzon
>Release:        FreeBSD 4.2-RELEASE i386
>Organization:
>Environment:

I believe any of FreeBSD versions known to me. I tried to make it flexible.

>Description:

This is mail antivirus wrapper - it gets mail from sendmail, unpacks if needed,
then runs an external antivirus on it. Just like commercial software a/v.

>How-To-Repeat:


>Fix:

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	amavis-perl
#	amavis-perl/Makefile
#	amavis-perl/pkg-plist
#	amavis-perl/pkg-message
#	amavis-perl/pkg-descr
#	amavis-perl/pkg-comment
#	amavis-perl/distinfo
#	amavis-perl/files
#	amavis-perl/files/patch-aa
#	amavis-perl/files/patch-ab
#	amavis-perl/pkg-deinstall
#	amavis-perl/pkg-install
#
echo c - amavis-perl
mkdir -p amavis-perl > /dev/null 2>&1
echo x - amavis-perl/Makefile
sed 's/^X//' >amavis-perl/Makefile << 'END-of-amavis-perl/Makefile'
X# New ports collection makefile for:	amavis
X# Date Created:				13 Nov 2000
X# Whom:					Roman Shterenzon <roman@xpert.com>
X#
X# $FreeBSD$
X#
X
XPORTNAME=	amavis-perl
XPORTVERSION=	10
XCATEGORIES=     security
XMASTER_SITES=	http://www.amavis.org/dist/perl/
X
XMAINTAINER=	roman@xpert.com
X
XBUILD_DEPENDS=	${LOCALBASE}/bin/uvscan:${PORTSDIR}/security/vscan \
X		${LOCALBASE}/bin/bunzip2:${PORTSDIR}/archivers/bzip2 \
X		${LOCALBASE}/bin/lha:${PORTSDIR}/archivers/lha \
X		${LOCALBASE}/bin/unarj:${PORTSDIR}/archivers/unarj \
X		${LOCALBASE}/bin/unrar:${PORTSDIR}/archivers/unrar \
X		${LOCALBASE}/bin/unzip:${PORTSDIR}/archivers/unzip \
X		${LOCALBASE}/bin/zoo:${PORTSDIR}/archivers/zoo \
X		${LOCALBASE}/bin/arc:${PORTSDIR}/archivers/arc \
X		${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/IO/AtomicFile.pm:${PORTSDIR}/devel/p5-IO-stringy \
X		${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/MIME/Base64.pm:${PORTSDIR}/converters/p5-MIME-Base64 \
X		${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/MIME/Body.pm:${PORTSDIR}/mail/p5-MIME-Tools \
X		${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/Mail/Address.pm:${PORTSDIR}/mail/p5-Mail-Tools \
X		${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/Compress/Zlib.pm:${PORTSDIR}/archivers/p5-Compress-Zlib \
X		${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/Convert/UUlib.pm:${PORTSDIR}/converters/p5-Convert-UUlib \
X		${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/Convert/TNEF.pm:${PORTSDIR}/converters/p5-Convert-TNEF \
X		${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/Archive/Tar.pm:${PORTSDIR}/archivers/p5-Archive-Tar \
X		${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/Unix/Syslog.pm:${PORTSDIR}/sysutils/p5-Unix-Syslog
X
XRUN_DEPENDS="${BUILD_DEPENDS}"
X
X#FORBIDDEN=	"This is alpha quality, use at your own risk"
X
XGNU_CONFIGURE=	yes
XCONFIGURE_ARGS+=	--disable-qmail --disable-postfix --disable-exim --with-virusdir=/var/spool/quarantine --enable-relay
X
Xdo-install:
X	${INSTALL_SCRIPT} ${WRKSRC}/amavis/amavis ${PREFIX}/sbin
X.if !defined(NOPORTDOCS)
X	${MKDIR} ${PREFIX}/share/doc/amavis
X.for i in README README.exim README.postfix README.sendmail README.scanners doc/amavis.txt
X	${INSTALL_DATA} ${WRKSRC}/${i} ${PREFIX}/share/doc/amavis
X.endfor
X.endif
X
Xpost-install:
X	@PKG_PREFIX=${PREFIX} ${PERL5} ${PKGINSTALL} _ POST-INSTALL
X	@${CAT} ${PKGMESSAGE}
X
X.include <bsd.port.mk>
END-of-amavis-perl/Makefile
echo x - amavis-perl/pkg-plist
sed 's/^X//' >amavis-perl/pkg-plist << 'END-of-amavis-perl/pkg-plist'
Xsbin/amavis
Xshare/doc/amavis/amavis.txt
Xshare/doc/amavis/README
Xshare/doc/amavis/README.exim
Xshare/doc/amavis/README.postfix
Xshare/doc/amavis/README.sendmail
Xshare/doc/amavis/README.scanners
X@dirrm share/doc/amavis
END-of-amavis-perl/pkg-plist
echo x - amavis-perl/pkg-message
sed 's/^X//' >amavis-perl/pkg-message << 'END-of-amavis-perl/pkg-message'
X
XPlease read documentation on http://www.amavis.org/ before you start using it.
X
END-of-amavis-perl/pkg-message
echo x - amavis-perl/pkg-descr
sed 's/^X//' >amavis-perl/pkg-descr << 'END-of-amavis-perl/pkg-descr'
XImagine a heterogene network environment with both UN*X and DOS / Windows/
XMacintosh workstations. Now think of an UN*X server that serves Windows
Xand/or Macintosh workstations via a POP3 service. Would it not be nice to
Xensure attachments coming via email are scanned for viruses before they reach
Xa system they are able to infect? Well - that is what this package is for.
XIt resides on the server that handles your incoming mails. When a mail
Xarrives, instead of being delivered via procmail directly, is parsed through
Xa script that extracts all attachments from the mail, unpacks (if needed)
Xand scans them using a professional virus scanner program.
X
XThis is a perl implementation of the mailscan.
X
XWWW: http://www.amavis.org/
X
XRoman Shterenzon <roman@xpert.com>
END-of-amavis-perl/pkg-descr
echo x - amavis-perl/pkg-comment
sed 's/^X//' >amavis-perl/pkg-comment << 'END-of-amavis-perl/pkg-comment'
XMail Virus Scanner (uses external antivirus)
END-of-amavis-perl/pkg-comment
echo x - amavis-perl/distinfo
sed 's/^X//' >amavis-perl/distinfo << 'END-of-amavis-perl/distinfo'
XMD5 (amavis-perl-10.tar.gz) = 48acf27fa6d418863b4094dac8bdafe8
END-of-amavis-perl/distinfo
echo c - amavis-perl/files
mkdir -p amavis-perl/files > /dev/null 2>&1
echo x - amavis-perl/files/patch-aa
sed 's/^X//' >amavis-perl/files/patch-aa << 'END-of-amavis-perl/files/patch-aa'
X--- configure.orig	Thu Dec  7 19:04:06 2000
X+++ configure	Sun Dec 31 15:22:09 2000
X@@ -1109,16 +1109,16 @@
X   { echo "configure: error: Sorry, you need the "file" command" 1>&2; exit 1; }
X fi
X 
X-echo $ac_n "checking if file can be brief""... $ac_c" 1>&6
X-echo "configure:1114: checking if file can be brief" >&5
X-$file -b /bin/sh > /dev/null 2>&1
X-if test $? -ne 0 ; then
X-  { echo "configure: error: 
X-You need a "file" command that supports -b
X-Check ftp://ftp.astron.com/pub/file/" 1>&2; exit 1; }
X-else
X-  echo "$ac_t""yes" 1>&6
X-fi
X+#echo $ac_n "checking if file can be brief""... $ac_c" 1>&6
X+#echo "configure:1114: checking if file can be brief" >&5
X+#$file -b /bin/sh > /dev/null 2>&1
X+#if test $? -ne 0 ; then
X+#  { echo "configure: error: 
X+#You need a "file" command that supports -b
X+#Check ftp://ftp.astron.com/pub/file/" 1>&2; exit 1; }
X+#else
X+#  echo "$ac_t""yes" 1>&6
X+#fi
X 
X for ac_prog in grep
X do
X@@ -1775,7 +1775,7 @@
X   if test ! -f "$sendmail_cf_orig" ; then
X     if test -f /etc/sendmail.cf ; then
X       sendmail_cf_orig=/etc/sendmail.orig.cf
X-    elif test -f /etc/mail/sendmail.orig.cf ; then
X+    elif test -f /etc/mail/sendmail.cf ; then
X       sendmail_cf_orig=/etc/mail/sendmail.orig.cf
X     else
X       { echo "configure: error: 
END-of-amavis-perl/files/patch-aa
echo x - amavis-perl/files/patch-ab
sed 's/^X//' >amavis-perl/files/patch-ab << 'END-of-amavis-perl/files/patch-ab'
X--- amavis/amavis.in.orig	Sun Dec 31 15:16:34 2000
X+++ amavis/amavis.in	Sun Dec 31 15:24:31 2000
X@@ -414,7 +414,7 @@
X 		do_exit($REGERR, __LINE__);
X 	}
X 
X-	my $filetype = `$file -b $TEMPDIR/parts/$part`;
X+	my $filetype = `$file $TEMPDIR/parts/$part`;
X 	chop $filetype;
X 	do_debug("File-type of $part: $filetype\n");
X 
X@@ -609,7 +609,7 @@
X 	}
X 
X 	# older versions of file report tnef files as data
X-	if ($filetype =~ /^data$/) {
X+	if ($filetype =~ /:\sdata$/) {
X 		# may be tnef
X 
X 		# checked already?
END-of-amavis-perl/files/patch-ab
echo x - amavis-perl/pkg-deinstall
sed 's/^X//' >amavis-perl/pkg-deinstall << 'END-of-amavis-perl/pkg-deinstall'
X#!/bin/sh
X# $FreeBSD$
X
Xprefix=/usr/local
XPATH="/bin:/usr/bin"
X
Xif [ "$2" != "POST-DEINSTALL" ]; then
X  exit 0
Xfi
X
Xif [ -f /etc/sendmail.cf.pre-amavis ]; then
X  CFG=/etc
Xelif [ -f /etc/mail/sendmail.cf.pre-amavis ]; then
X  CFG=/etc/mail
Xelse
X  echo "No sendmail.cf.pre-amavis found, are you sure that amavis was installed?"
X  exit 1
Xfi
X 
Xrm -f ${CFG}/sendmail.cf
Xrm -f ${CFG}/sendmail.orig.cf
Xmv ${CFG}/sendmail.cf.pre-amavis ${CFG}/sendmail.cf
Xsed /^virusalert/d ${CFG}/aliases > ${CFG}/aliases.tmp
Xmv ${CFG}/aliases.tmp ${CFG}/aliases
Xnewaliases
Xrmdir /var/spool/mqamavis 2>/dev/null || echo "You may wish to inspect /var/spool/mqamavis directory by yourself and remove it"
Xrmdir /var/spool/quarantine 2>/dev/null || echo "You may wish to inspect /var/spool/quarantine directory by yourself and remove it"
Xexit 0
END-of-amavis-perl/pkg-deinstall
echo x - amavis-perl/pkg-install
sed 's/^X//' >amavis-perl/pkg-install << 'END-of-amavis-perl/pkg-install'
X#!/usr/bin/perl
X# Roman Shterenzon <roman@xpert.com> 27/12/2000 
X# $FreeBSD$
X
Xuse strict;
X
X$ENV{'PATH'}='/bin:/usr/bin';
X
Xmy $cfg;
Xmy $result;
X
Xexit 0 if $ARGV[1] ne "POST-INSTALL";
X
Xif ( -f '/etc/mail/sendmail.cf' ) {
X  $cfg='/etc/mail';
X}
Xelsif ( -f '/etc/sendmail.cf' ) {
X  $cfg='/etc';
X}
Xmy $cf="$cfg/sendmail.cf";
Xmy $new="$cfg/amavis.cf";
X
Xprint "===> Adding neccessary hooks to sendmail.cf file\n";
X
Xopen(IN, $cf) || die "Cannot open $cf";
Xopen(OUT, ">$new") || die "Cannot create $new";
X
Xmy $replace=0;
X
Xwhile(<IN>) {
X  if ( /^O QueueDirectory/ ) {
X    $_="O QueueDirectory=/var/spool/mqamavis\n";
X    $replace++;
X  }
X  elsif ( /O StatusFile/ ) {
X    $_="O StatusFile=/var/log/amavis.st\n";
X    $replace++;
X  }
X  elsif ( /^Mlocal/ ) {
X    print OUT <<'EOF';
XMamavis,	P=/usr/local/sbin/amavis, F=mlsACDFMS5:/|@qhP, S=0, R=0
X		T=DNS/RFC822/X-Unix,
X		A=amavis $f $u 
X
XEOF
X    $replace++;
X  }
X  elsif ( /\s+final\s+parsing$/ ) {
X    print OUT "R\$*\t\t\t\$#amavis \$:\$1\n";
X    $replace++;
X  }
X  s/^(DZ.*)/$1av/;
X  print OUT;
X}
Xclose(OUT);
Xclose(IN);
Xdie "I couldn't patch the sendmail.cf file, its format is unknown to me\n"
X	unless ( $replace == 4 );
X
Xprint "===> Adding alias for virusalert to the aliases file\n";
Xif ( ! -f "$cfg/aliases" ) {
X  print "Can't find aliases file, you have to add an alias for virusalert by yourself\n";
X}
Xelse {
X  open (IN, "$cfg/aliases") || die "Cannot open aliases file for reading\n";
X  my $found;
X  while(<IN>) {
X    $found=1, last if /^virusalert/;
X  }
X  close(IN);
X  unless ($found) {
X    open(OUT, ">>$cfg/aliases") || die "Cannot open aliases file for writing\n";
X    print OUT "virusalert:\troot\n";
X    close(OUT);
X    $result=system("newaliases");
X    die "Failed to run newaliases command\n" if $result;
X  }
X}
X
Xprint "===> Creating /var/spool/mqamavis directory\n";
Xif ( ! -d "/var/spool/mqamavis" ) {
X  mkdir "/var/spool/mqamavis",0755 || die "Can't create /var/spool/mqamavis\n";
X}
Xmy $gid=getgrnam('daemon');
Xchown 0, $gid, "/var/spool/mqamavis";
X
Xprint "===> Creating /var/spool/quarantine directory\n";
Xif ( ! -d "/var/spool/quarantine" ) {
X  mkdir "/var/spool/quarantine",0755 || die "Can't create /var/spool/quarantine\n";
X}
Xchown 0, $gid, "/var/spool/quarantine";
X
Xdie "There's already a $cf.pre-amavis, is amavis already installed?\n"
X  if -f "$cf.pre-amavis";
X$result=system("cp $cf $cf.pre-amavis");
Xdie "Failed to copy $cf to $cf.pre-amavis\n" if $result;
Xrename "$cf", "${cfg}/sendmail.orig.cf" ||
X  die "Unable to rename $cf to ${cfg}/sendmail.orig.cf\n";
Xrename "$new", "$cf" || die "Unable to rename $new to $cf\n";
END-of-amavis-perl/pkg-install
exit


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200012311332.eBVDWcG18803>