ports/50473: amavis-perl is no longer supported (supersedes pr ports/41314)

Martijn Lina martijn at pacno.net
Mon Mar 31 11:00:44 UTC 2003


>Number:         50473
>Category:       ports
>Synopsis:       amavis-perl is no longer supported (supersedes pr ports/41314)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 31 03:00:29 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Martijn Lina
>Release:        FreeBSD 5.0-RELEASE-p3 i386
>Organization:
>Environment:
System: FreeBSD drain 5.0-RELEASE-p6 FreeBSD 5.0-RELEASE-p6 #0: Sat Mar 29 13:14:57 CET 2003 root at drain:/usr/obj/usr/src/sys/DRAIN i386


	
>Description:
	amavis-perl-11 is no longer maintained and is lucking support for the new virus scanners like f-prot
>How-To-Repeat:
	install f-prot for Linux from ftp://ftp.complex.is/pub, make a link
	ln -s /usr/local/f-prot/f-prot.sh /usr/local/bin/f-prot
	and try to install amavis-perl.
	It fails with: You have to install at least ONE virusscanner to 
	scan for viruses! (Just in case you didn't know ...;-)
>Fix:
	replace the amavis-perl port with the attached one


# 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:
#
#	security/amavis
#	security/amavis/Makefile
#	security/amavis/distinfo
#	security/amavis/pkg-deinstall.qmail
#	security/amavis/pkg-message.sendmail
#	security/amavis/pkg-message.qmail
#	security/amavis/pkg-message.postfix
#	security/amavis/pkg-install.sendmail
#	security/amavis/pkg-install.qmail
#	security/amavis/pkg-install.postfix
#	security/amavis/pkg-descr
#	security/amavis/pkg-deinstall.sendmail
#	security/amavis/pkg-plist
#
echo c - security/amavis
mkdir -p security/amavis > /dev/null 2>&1
echo x - security/amavis/Makefile
sed 's/^X//' >security/amavis/Makefile << 'END-of-security/amavis/Makefile'
X# New ports collection makefile for:	amavis
X# Date Created:				31 Mar 2002
X# Whom:					Martijn Lina <martijn at pacno.net>
X#
X# $FreeBSD$
X
XPORTNAME=	amavis
XPORTVERSION=	0.3.12
XCATEGORIES=	security
XMASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
XMASTER_SITE_SUBDIR=	${PORTNAME}
X
XMAINTAINER=	ports at freebsd.org
XCOMMENT=	Mail Virus Scanner (uses external antivirus)
X
XBUILD_DEPENDS=	${LOCALBASE}/bin/uvscan:${PORTSDIR}/security/vscan \
X		${LOCALBASE}/bin/lha:${PORTSDIR}/archivers/lha \
X		${LOCALBASE}/bin/unarj:${PORTSDIR}/archivers/unarj \
X		${LOCALBASE}/bin/unrar:${PORTSDIR}/archivers/unrar \
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		${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/Archive/Zip.pm:${PORTSDIR}/archivers/p5-Archive-Zip
X.if !exists(/usr/bin/bzip2)
XBUILD_DEPENDS+=	bunzip2:${PORTSDIR}/archivers/bzip2
X.endif
XRUN_DEPENDS=	${BUILD_DEPENDS}
X
XGNU_CONFIGURE=	yes
XCONFIGURE_ARGS+=	--with-virusdir=/var/spool/quarantine --with-runtime-dir=/var/log/amavis \
X			--with-logdir=/var/log/amavis
X
X.if defined(WITH_QMAIL)
XMTA?=	qmail
XDIROWNER?=	qmailq:qmail
XCONFIGURE_ARGS+=	--enable-qmail
X.if exists(${LOCALBASE}/qmail/bin/qmail-send)
XQMAIL_DIR?=	${LOCALBASE}/qmail
X.else
XQMAIL_DIR?=	/var/qmail
X.endif
XBUILD_DEPENDS+=	${QMAIL_DIR}/bin/qmail-send:${PORTSDIR}/mail/qmail
XRUN_DEPENDS=	${BUILD_DEPENDS}
X.endif
X
X.if defined(MTA)
X.if ${MTA} == "postfix"
XDIROWNER?=	vscan:daemon
XCONFIGURE_ARGS+=	--enable-postfix --enable-smtp
XBUILD_DEPENDS+=	${LOCALBASE}/sbin/postfix:${PORTSDIR}/mail/postfix
X.elif ${MTA} == "exim"
XDIROWNER?=	root:daemon
XCONFIGURE_ARGS+=	--enable-exim
XBUILD_DEPENDS+=	${LOCALBASE}/sbin/exim:${PORTSDIR}/mail/exim
X.endif
XRUN_DEPENDS=	${BUILD_DEPENDS}
X.else
XMTA?=	sendmail
XDIROWNER?=	root:daemon
XCONFIGURE_ARGS+=	--enable-relay
X.endif
X
XPKGDEINSTALL=	${PKGDIR}/pkg-deinstall.${MTA}
XPKGINSTALL=	${PKGDIR}/pkg-install.${MTA}
XPKGMESSAGE=	${PKGDIR}/pkg-message.${MTA}
X
Xdo-install:
X	@${MKDIR} /var/log/amavis
X	@${MKDIR} /var/spool/quarantine
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.qmail README.milter 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} DIROWNER=${DIROWNER} ${PERL5} ${PKGINSTALL} _ POST-INSTALL
X	@${CHOWN} ${DIROWNER} /var/log/amavis /var/spool/quarantine
X	@${CHMOD} 0755 /var/log/amavis /var/spool/quarantine
X	@${CAT} ${PKGMESSAGE} |${SED} 's/$${DIROWNER}/${DIROWNER:C|:.*||}/g'
X
X.include <bsd.port.mk>
END-of-security/amavis/Makefile
echo x - security/amavis/distinfo
sed 's/^X//' >security/amavis/distinfo << 'END-of-security/amavis/distinfo'
XMD5 (amavis-0.3.12.tar.gz) = 9241bd0331330354955c9c7566176c18
END-of-security/amavis/distinfo
echo x - security/amavis/pkg-deinstall.qmail
sed 's/^X//' >security/amavis/pkg-deinstall.qmail << 'END-of-security/amavis/pkg-deinstall.qmail'
X#!/usr/bin/perl
X# $FreeBSD$
X
Xuse strict;
X
Xmy $qmailDir;
X
X# ensure we are running only as post installation
Xexit 0 if $ARGV[ 1 ] ne "POST-DEINSTALL";
X
X# find location of qmail
Xif ( -f "/var/qmail/bin/qmail-send" ) {
X    $qmailDir = "/var/qmail";
X} else {
X    $qmailDir = "/usr/local/qmail";
X}
X
Xprint "==> Removing virusalert user\n";
Xunlink "${qmailDir}/alias/.qmail-virusalert";
X
Xprint "==> Removing amavis from qmail\n";
Xunlink "${qmailDir}/bin/qmail-queue";
Xsystem( "mv ${qmailDir}/bin/qmail-queue-real ${qmailDir}/bin/qmail-queue" );
X
Xprint "==> Removing mode from suidperl\n";
Xchmod 0511, "/usr/bin/suidperl";
END-of-security/amavis/pkg-deinstall.qmail
echo x - security/amavis/pkg-message.sendmail
sed 's/^X//' >security/amavis/pkg-message.sendmail << 'END-of-security/amavis/pkg-message.sendmail'
X
XPlease read documentation on http://www.amavis.org/ before you start using it.
X
END-of-security/amavis/pkg-message.sendmail
echo x - security/amavis/pkg-message.qmail
sed 's/^X//' >security/amavis/pkg-message.qmail << 'END-of-security/amavis/pkg-message.qmail'
X
XPlease read documentation on http://www.amavis.org/ before you start using it.
X
XSECURITY NOTES:
X
XThe qmail installation already has bin/qmail-queue as suid qmailq.  This port
Xcopies bin/qmail-queue to bin/qmail-queue-real and installs itself as
Xbin/qmail-queue with suid qmailq.
X
XAdditionally, for this port to properly work with qmail, it requires that
X/usr/bin/suidperl be suid root.  The following changes were made:
X
X-rwsr-xr-x  3 root  wheel  50760 xxx xx xx:xx /usr/bin/suidperl
X
XADDITIONAL NOTES:
X
XAn alias for ~alias/.qmail-virusalert to root was created.  Modify this file
Xto meet your requirements.
X
X
END-of-security/amavis/pkg-message.qmail
echo x - security/amavis/pkg-message.postfix
sed 's/^X//' >security/amavis/pkg-message.postfix << 'END-of-security/amavis/pkg-message.postfix'
X
XPlease read documentation on http://www.amavis.org/ before you start using it.
X
X  To configure postfix, you have to do later:
X
X  * add
X
X    content_filter = vscan:
X
X    to /usr/local/etc/postfix/main.cf
X
X  * add
X
X    vscan  unix	-	n	n	-	10	pipe	user=${DIROWNER}
X	argv=/usr/local/sbin/amavis ${sender} ${recipient}
X    localhost:10025 inet n -	n	-	-	smtpd
X	-o content_filter=
X
X    to /etc/postfix/master.cf.
X
XPlease read /usr/local/share/doc/amavis/README.postfix for further information
X
END-of-security/amavis/pkg-message.postfix
echo x - security/amavis/pkg-install.sendmail
sed 's/^X//' >security/amavis/pkg-install.sendmail << 'END-of-security/amavis/pkg-install.sendmail'
X#!/usr/bin/perl
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 necessary 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
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-security/amavis/pkg-install.sendmail
echo x - security/amavis/pkg-install.qmail
sed 's/^X//' >security/amavis/pkg-install.qmail << 'END-of-security/amavis/pkg-install.qmail'
X#!/usr/bin/perl
X# $FreeBSD$
X
Xuse strict;
X
Xmy $qmailDir;
Xmy ( $uid, $gid );
Xlocal *F;
X
X# ensure we are running only as post installation
Xexit 0 if $ARGV[ 1 ] ne "POST-INSTALL";
X
X# find location of qmail
Xif ( -f "/var/qmail/bin/qmail-send" ) {
X    $qmailDir = "/var/qmail";
X} else {
X    $qmailDir = "/usr/local/qmail";
X}
X
X# create virusalert use as root
Xprint "==> Creating virusalert user as root\n";
Xopen( F, ">${qmailDir}/alias/.qmail-virusalert" );
Xprint F "root\n";
Xclose( F );
X
X# move qmail-queue to qmail-queue-real
Xprint "==> Moving qmail-queue\n";
Xif ( ! -f "${qmailDir}/bin/qmail-queue-real" ) {
X    system( "mv ${qmailDir}/bin/qmail-queue ${qmailDir}/bin/qmail-queue-real" );
X    system( "cp /usr/local/sbin/amavis ${qmailDir}/bin/qmail-queue" );
X    ( undef, undef, $uid, $gid ) = getpwnam( "qmailq" );
X    chown $uid, $gid, "${qmailDir}/bin/qmail-queue";
X    chmod 04711, "${qmailDir}/bin/qmail-queue";
X} else {
X    print "FAILURE: ${qmailDir}/bin/qmail-queue-real already exists!!\n";
X    exit 1;
X}
X
Xprint "==> Changing permissions on suidperl\n";
Xchmod 04755, "/usr/bin/suidperl";
END-of-security/amavis/pkg-install.qmail
echo x - security/amavis/pkg-install.postfix
sed 's/^X//' >security/amavis/pkg-install.postfix << 'END-of-security/amavis/pkg-install.postfix'
X#!/usr/bin/perl
X# $FreeBSD$
X
X$user=$ENV{'DIROWNER'};
X$user=~ s/:.*//g;
X$group=nogroup;
X
Xif (`grep ^${user}: /etc/passwd` eq "") {
X    print "You need a user \"${user}\".\n";
X    if (yesno("Would you like me to create it", "y")) {
X        system ("/usr/sbin/pw useradd ${user} -g ${group} -h - -d /nonexistent -s /nonexistent -c \"AMaViS Virus Scanner\" || exit");
X        print "Done.\n";
X    } else {
X        print "Please create it, and try again.\n";
X        exit 1;
X    };
X} else {
X    print "You already have a user \"${user}\", so I will use it.\n";
X};
X
Xsub yesno() {
X	my ($mes, $def) = @_;
X	print "$mes [$def]? ";
X	$answer = <STDIN>;
X	chomp($answer);
X	if ($answer eq "") {
X		$answer = "y";
X	};
X	if ($answer=~/^y/i) {
X		return 1;
X	};
X	return 0;
X};
END-of-security/amavis/pkg-install.postfix
echo x - security/amavis/pkg-descr
sed 's/^X//' >security/amavis/pkg-descr << 'END-of-security/amavis/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/
END-of-security/amavis/pkg-descr
echo x - security/amavis/pkg-deinstall.sendmail
sed 's/^X//' >security/amavis/pkg-deinstall.sendmail << 'END-of-security/amavis/pkg-deinstall.sendmail'
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-security/amavis/pkg-deinstall.sendmail
echo x - security/amavis/pkg-plist
sed 's/^X//' >security/amavis/pkg-plist << 'END-of-security/amavis/pkg-plist'
Xsbin/amavis
X%%PORTDOCS%%share/doc/amavis/amavis.txt
X%%PORTDOCS%%share/doc/amavis/README
X%%PORTDOCS%%share/doc/amavis/README.exim
X%%PORTDOCS%%share/doc/amavis/README.qmail
X%%PORTDOCS%%share/doc/amavis/README.postfix
X%%PORTDOCS%%share/doc/amavis/README.sendmail
X%%PORTDOCS%%share/doc/amavis/README.scanners
X%%PORTDOCS%%share/doc/amavis/README.milter
X%%PORTDOCS%%@dirrm share/doc/amavis
END-of-security/amavis/pkg-plist
exit

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



More information about the freebsd-ports-bugs mailing list