qmail-scanner is a virus scanning interface to qmail. It provides a convenient and standardized way of using any commercial virus scanner with qmail, as well as a sophisticated content filter which can be used to provide protection from specific virii even in the absence of a commercial scanner. i have successfully tested it on my FreeBSD Box with: - SpamAssassin (installed by ports of course) - clam Anti-Virus (idem) - F-Prot Anti-Virus for BSD file servers (evaluation version from www.fprot.com) How-To-Repeat: because this ports need reformime from MailDrop, i will submit a "mail/maildrop-reformime" port in few days ;-) i have included my own creation patch for internationalization, because the configure script of qmail-scanner don't appreciate a lot a environnement with LANG set with charset (like "fr_FR.ISO8859-1")... i have submitted this patch on sourceforge, of course ;-)
Responsible Changed From-To: freebsd-ports-bugs->sergei I'll take it.
Mmmm In fact, at this stage, i am a more up-to-date version to submit to you. And the port himself is more 'clean' (use of pkg-install) ;-) IMPORTANT NOTICE Since qmail-scanner-1.20r3 we need a user 'qscand:qscand', created by pkg-install script with uid/gid of 98. Thank you for including this in FreeBSD! --- qmail-scanner-1.20r4.shar begins here --- # 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: # # qmail-scanner/ # qmail-scanner/distinfo # qmail-scanner/Makefile # qmail-scanner/pkg-descr # qmail-scanner/pkg-plist # qmail-scanner/files # qmail-scanner/files/patch-configure # qmail-scanner/files/patch-spams # qmail-scanner/pkg-message # qmail-scanner/pkg-install # echo c - qmail-scanner/ mkdir -p qmail-scanner/ > /dev/null 2>&1 echo x - qmail-scanner/distinfo sed 's/^X//' >qmail-scanner/distinfo << 'END-of-qmail-scanner/distinfo' XMD5 (qmail-scanner-1.20rc4.tgz) =3D 3324c752ce4d0d85d5a68821722d7240 END-of-qmail-scanner/distinfo echo x - qmail-scanner/Makefile sed 's/^X//' >qmail-scanner/Makefile << 'END-of-qmail-scanner/Makefile' X# New ports collection makefile for: qmail-scanner X# Date created: 24 august 2003 X# Whom: moeti X# X# $FreeBSD$ X# X XPORTNAME=3D qmail-scanner XPORTVERSION=3D 1.20r4 XCATEGORIES=3D mail security XMASTER_SITES=3D ${MASTER_SITE_SOURCEFORGE} XMASTER_SITE_SUBDIR=3D qmail-scanner XDISTNAME=3D ${PORTNAME}-1.20rc4 XEXTRACT_SUFX=3D .tgz X XMAINTAINER=3D moeti-freebsd@ouestil.com XCOMMENT=3D Content/Anti-virus Scanner for qmail X X# A normal qmail installation puts everything into /var/qmail/. X# Must match your qmail installation XPREFIX?=3D /var/qmail X XBUILD_DEPENDS=3D ${PREFIX}/bin/qmail-queue:${PORTSDIR}/mail/qmail \ X ${SITE_PERL}/${PERL_ARCH}/Time/HiRes.pm:${PORTSDIR}/devel/p5-Time-HiRes = \ X ${LOCALBASE}/bin/reformime:${PORTSDIR}/mail/maildrop-reformime X XUSE_PERL5=3D yes XNO_BUILD=3D yes X X# Barely optionnal X.if !defined(WITHOUT_TNF) XBUILD_DEPEND+=3D ${LOCALBASE}/bin/tnef:${PORTSDIR}/converters/tnef X.endif X X# Options XQMAILSCAN_ADMIN?=3D root X.if defined(QMAILSCAN_ADMINREALNAME) XCONFIGURE_ARGS+=3D --admin-realname "${QMAILSCAN_ADMINREALNAME}" X.endif XQMAILSCAN_NOTIFY?=3D sender,recips,admin X.if defined(QMAILSCAN_LOCALDOMAINS) XCONFIGURE_ARGS+=3D --local-domains "${QMAILSCAN_LOCALDOMAINS}" X.endif X.if defined(QMAILSCAN_SPAMSREDIRECT) XCONFIGURE_ARGS+=3D --spams-redirect "${QMAILSCAN_SPAMSREDIRECT}" X.endif X.if defined(QMAILSCAN_SPAMSTOSUFFIX) XCONFIGURE_ARGS+=3D --spams-tosuffix "${QMAILSCAN_SPAMSTOSUFFIX}" X.endif X XSPOOLDIR=3D ${PREFIX}/qmailscan X XHAS_CONFIGURE=3D yes XCONFIGURE_ARGS+=3D--qmaildir ${PREFIX} --spooldir ${SPOOLDIR} --bindir ${PREFIX}/bin \ X --admin "${QMAILSCAN_ADMIN}" --notify = "${QMAILSCAN_NOTIFY}" \ X --silent-viruses auto \ X --archive no --redundant yes --unzip yes \ X --add-dscr-hdrs yes \ X --scanners auto \ X --fix-mime yes \ X --log-details syslog --debug no \ X --batch X Xpre-configure: X @PKG_PREFIX=3D${PREFIX} ${SH} ${PKGDIR}/pkg-install ${PKGNAME} PRE-INSTALL X Xdo-install: X.if exists(${PREFIX}/bin/qmail-scanner-queue.pl) X ${MV} ${PREFIX}/bin/qmail-scanner-queue.pl ${PREFIX}/bin/qmail-scanner-queue.pl.old X.endif X ${CP} ${WRKSRC}/qmail-scanner-queue.pl ${PREFIX}/bin/ X ${CP} ${WRKSRC}/quarantine-attachments.txt ${SPOOLDIR}/quarantine-attachments.sample X.if !exists(${SPOOLDIR}/quarantine-attachments.txt) X ${CP} ${WRKSRC}/quarantine-attachments.txt ${SPOOLDIR} X.endif X @PKG_PREFIX=3D${PREFIX} ${SH} ${PKGDIR}/pkg-install ${PKGNAME} POST-INSTALL X Xpost-install: X @${CAT} ${PKGMESSAGE} X Xpost-deinstall: X @${ECHO_MSG} X @${ECHO_MSG} "If you're not updating this ports, you can delete directory '${SPOOLDIR}'." X @${ECHO_MSG} "" X Xtest: X @${WRKSRC}/contrib/test_installation.sh -doit X X.include <bsd.port.mk> END-of-qmail-scanner/Makefile echo x - qmail-scanner/pkg-descr sed 's/^X//' >qmail-scanner/pkg-descr << = 'END-of-qmail-scanner/pkg-descr' XQmail-Scanner, is a Email content scanner that enables a Qmail Email = server to Xscan all Email it receives for certain characteristics (normally = viruses), Xand react accordingly. X XIf you have a commercial virus scanner (eg, Sophos sweep, McAfee Xuvscan, etc) installed when you build qmail-scanner, qmail-scanner Xwill configure itself to use that. Otherwise, it will only use its Xinternal content filter which only allows you to block mail based Xon text in the subject/body, general types of attachments, etc. X X XWWW: http://qmail-scanner.sourceforge.net/ X X- Moeti Xmoeti-freebsd@ouestil.com END-of-qmail-scanner/pkg-descr echo x - qmail-scanner/pkg-plist sed 's/^X//' >qmail-scanner/pkg-plist << = 'END-of-qmail-scanner/pkg-plist' Xbin/qmail-scanner-queue.pl Xqmailscan/qmail-scanner-queue-version.txt Xqmailscan/quarantine-attachments.db Xqmailscan/quarantine-attachments.sample X@dirrm qmailscan/archives/cur X@dirrm qmailscan/archives/new X@dirrm qmailscan/archives/tmp X@dirrm qmailscan/archives X@dirrm qmailscan/quarantine/cur X@dirrm qmailscan/quarantine/new X@dirrm qmailscan/quarantine/tmp X@dirrm qmailscan/quarantine X@dirrm qmailscan/tmp END-of-qmail-scanner/pkg-plist echo c - qmail-scanner/files mkdir -p qmail-scanner/files > /dev/null 2>&1 echo x - qmail-scanner/files/patch-configure sed 's/^X//' >qmail-scanner/files/patch-configure << 'END-of-qmail-scanner/files/patch-configure' X--- configure.orig Fri Aug 22 02:06:54 2003 X+++ configure Sun Aug 24 23:32:50 2003 X@@ -48,6 +48,8 @@ X QSLANG=3D"en_GB" X fi X X+QSLANG=3D`echo $QSLANG|sed 's/\..*//'` X+ X if [ ! -d "./locale/$QSLANG" ]; then X echo " X END-of-qmail-scanner/files/patch-configure echo x - qmail-scanner/files/patch-spams sed 's/^X//' >qmail-scanner/files/patch-spams << 'END-of-qmail-scanner/files/patch-spams' X--- configure.orig Tue Sep 30 06:59:35 2003 X+++ configure Tue Sep 30 08:26:32 2003 X@@ -81,7 +81,8 @@ X FORCE_UNZIP=3D"0" X DESCRIPTIVE_HEADERS=3D"0" X NOTIFY_ADDRESSES=3D"sender,admin" X-USERNAME=3D"$USER" X+ADMIN_MAIL=3D"$USER" X+ADMIN_REALNAME=3D"System Anti-Virus Administrator" X MANUAL_INSTALL=3D"0" X INSTALLIT=3D"0" X DONOTCONFIRM=3D"0" X@@ -97,8 +98,10 @@ X --spooldir) if [ "$2" !=3D "" ] ; then shift ; fi ; = AS_QQ=3D"$1" ;; X --qmaildir) if [ "$2" !=3D "" ]; then shift ; fi ; = QMAILDIR=3D"$1" ;; X --bindir) if [ "$2" !=3D "" ] ; then shift ; fi ; BINDIR=3D"$1" = ;; X- --user|--admin) if [ "$2" !=3D "" ] ; then shift ; fi ; = USERNAME=3D"$1" ;; X- --domain) if [ "$2" !=3D "" ] ; then shift ; fi ; = MAILDOMAIN=3D"$1" ;; X+ --admin|--user) if [ "$2" !=3D "" ] ; then shift ; fi ; ADMIN_MAIL=3D`echo $1 | sed 's/@/\\\\@/'` ;; X+ --admin-realname) if [ "$2" !=3D "" ] ; then shift ; fi ; ADMIN_REALNAME=3D`echo $1 | sed 's/_/ /g'` ;; X+ --spams-redirect) if [ "$2" !=3D "" ] ; then shift ; fi ; SPAMS_REDIRECT=3D`echo $1 | sed 's/@/\\\\@/'` ;; X+ --spams-tosuffix) if [ "$2" !=3D "" ] ; then shift ; fi ; SPAMS_TOSUFFIX=3D"$1" ;; X --notify) if [ "$2" !=3D "" ]; then shift ; fi ; = NOTIFY_ADDRESSES=3D"$1" ;; X --batch) DONOTCONFIRM=3D"1" ; if [ "$2" !=3D "" -a "`echo = $2|grep '\-'`" =3D "" ] ; then shift ; fi ;; X --silent-viruses) if [ "$2" !=3D "" ]; then shift ; fi ; FIND_SILENT_VIRUSES=3D"$1" ;; X@@ -126,9 +129,17 @@ X --spooldir <spooldir> defaults to $AS_QQ/ X --bindir <installdir> where to install qmail-scanner-queue.pl X Defaults to /var/qmail/bin/ X- --admin <username> user to Email alerts to (default: $USERNAME) X- --domain <domain name> "user"@"domain" makes up Email address X- to Email alerts to. X+ --admin <email> email to send alerts to (default: $ADMIN_MAIL) X+ --admin-realname <...> realname for sending alerts X+ Defaults to "$ADMIN_REALNAME" X+ nb: use '_' instead of ' ' (sorry for inconvenience) X+ --spams-redirect <email> email to redirect detected spams to X+ Defaults to empty (no redirection) X+ --spams-tosuffix <suffix> suffix to alter recipient with X+ i.e. recipient user@domain X+ will be transform into = user-suffix@domain X+ Defaults to empty (do not alter = recipients) X+ nb: 'spams-admin' option has precedence on this X --scanners <list of installed content scanners> X Defaults to "auto" - will use X whatever scanners are found on = system. X@@ -903,12 +914,16 @@ X if [ "$UNAME" ] ; then FQDN=3D"$UNAME" ; fi X if [ "$HOST" ] ; then FQDN=3D"$HOST" ; fi X X-MAILDOMAIN=3D${MAILDOMAIN:-$FQDN} X-LOCAL_DOMAINS_ARRAY=3D${LOCAL_DOMAINS_ARRAY:-$MAILDOMAIN} X-CMDLINE=3D"$0 --spooldir $AS_QQ --qmaildir $QMAILDIR --bindir $BINDIR --qmail-queue-binary $QMAILQUEUE_BIN --admin $USERNAME --domain = $MAILDOMAIN --notify $NOTIFY_ADDRESSES --local-domains $LOCAL_DOMAINS_ARRAY --silent-viruses $SILENT_VIRUSES --lang $QSLANG --debug $DEBUG_LEVEL = --unzip $FORCE_UNZIP --add-dscr-hdrs $DESCRIPTIVE_HEADERS --archive $ARCHIVEIT --redundant $REDUNDANT --log-details $LOG_DETAILS --log-crypto = $LOG_CRYPTO --fix-mime $FIX_MIME --scanners \"$SCANNERS\"" X- X+LOCAL_DOMAINS_ARRAY=3D${LOCAL_DOMAINS_ARRAY:-$FQDN} X+CMDLINE=3D"$0 --spooldir $AS_QQ --qmaildir $QMAILDIR --bindir $BINDIR --qmail-queue-binary $QMAILQUEUE_BIN --admin $ADMIN_MAIL = --admin-realname \"$ADMIN_REALNAME\" --notify $NOTIFY_ADDRESSES --local-domains $LOCAL_DOMAINS_ARRAY --silent-viruses $SILENT_VIRUSES --lang $QSLANG = --debug $DEBUG_LEVEL --unzip $FORCE_UNZIP --add-dscr-hdrs $DESCRIPTIVE_HEADERS --archive $ARCHIVEIT --redundant $REDUNDANT --log-details $LOG_DETAILS --log-crypto $LOG_CRYPTO --fix-mime $FIX_MIME --scanners \"$SCANNERS\"" X X X+if [ -n "$SPAMS_REDIRECT" ]; then X+ CMDLINE=3D"$CMDLINE --spams-redirect $SPAMS_REDIRECT" X+fi X+if [ -n "$SPAMS_TOSUFFIX" ]; then X+ CMDLINE=3D"$CMDLINE --spams-tosuffix $SPAMS_TOSUFFIX" X+fi X if [ "$MANUAL_INSTALL" =3D "1" ]; then X CMDLINE=3D"$CMDLINE --no-QQ-check $MANUAL_INSTALL" X fi X@@ -1278,7 +1293,7 @@ X fi X fi X X-USERNAME=3D${USERNAME:-$LOGNAME} X+ADMIN_MAIL=3D${ADMIN_MAIL:-$LOGNAME} X X SCANNER_ARRAY=3D`echo $SCANNER_ARRAY|sed 's/^,//g'` X X@@ -1352,7 +1367,13 @@ X fi X echo "archiving $ASTRING into $AS_QQ/$ARCHIVEDIR/" X fi X-echo "virus-admin=3D$USERNAME@$MAILDOMAIN" X+echo "admin=3D$ADMIN_MAIL" X+if [ -n "$SPAMS_REDIRECT" ]; then X+ echo "spams-admin=3D$SPAMS_REDIRECT" X+fi X+if [ -n "$SPAMS_TOSUFFIX" ]; then X+ echo "spams-suffix=3D$SPAMS_TOSUFFIX" X+fi X echo "local-domains=3D$LOCAL_DOMAINS_ARRAY" X echo "silent-viruses=3D$FIND_SILENT_VIRUSES_ARRAY" X echo "scanners=3D$SCANNER_ARRAY" X@@ -1496,10 +1517,12 @@ X s?SPAMC_BINARY?$SPAMC_BINARY?g; X s?SPAMC_OPTIONS?$SPAMC_OPTIONS?g; X s?SPAMC_SUBJECT?$SPAMC_SUBJECT?g; X-s?USERNAME?$USERNAME?g; X+s?ADMIN_MAIL?$ADMIN_MAIL?g; X+s?ADMIN_REALNAME?$ADMIN_REALNAME?g; X+s?SPAMS_REDIRECT?$SPAMS_REDIRECT?g; X+s?SPAMS_TOSUFFIX?$SPAMS_TOSUFFIX?g; X s?SKIP_TEXT_MSGS?$SKIP_TEXT_MSGS?g; X s?FQDN?$FQDN?g; X-s?MAILDOMAIN?$MAILDOMAIN?g; X s?LOCAL_DOMAINS_ARRAY?$LOCAL_DOMAINS_ARRAY?g; X s?NOTIFY_ADDRESSES?$NOTIFY_ADDRESSES?g; X s?FIND?$FIND?g; X--- qmail-scanner-queue.template.orig Tue Sep 30 06:23:42 2003 X+++ qmail-scanner-queue.template Tue Sep 30 07:53:05 2003 X@@ -85,11 +85,17 @@ X X X #From: line information used when making reports X-my $V_FROM=3D'USERNAME@MAILDOMAIN'; X-my $V_FROMNAME=3D'System Anti-Virus Administrator'; X+my $V_FROM=3D'ADMIN_MAIL'; X+my $V_FROMNAME=3D'ADMIN_REALNAME'; X X # Address carbon-copied on any virus reports X-my $QUARANTINE_CC=3D'USERNAME@MAILDOMAIN'; X+my $QUARANTINE_CC=3D'ADMIN_MAIL'; X+ X+# Address to where spams are redirected X+my $SPAMSADMIN=3D'SPAMS_REDIRECT'; X+ X+# Suffix to alter recipients with (when spam detected) X+my $SPAMSSUFFIX=3D'SPAMS_TOSUFFIX'; X X #Array of local domains that are checked against for X #deciding whether or not to send recipient alerts to X@@ -289,6 +295,7 @@ X chdir($scandir); X umask(0077); X my $quarantine_event=3D0; X+my $spam_event=3D0; X X my $file_id =3D &uniq_id(); X X@@ -410,7 +417,18 @@ X &email_quarantine_report; X } else { X &qmail_parent_check; X- &qmail_requeue($env_returnpath,$env_recips,"$scandir/$wmaildir/new/$file_= id" ); X+ if ($spam_event) { X+ if ($SPAMSADMIN) { X+ &qmail_requeue($env_returnpath,"T$SPAMSADMIN\0\0","$scandir/$wmaildir/new= /$f ile_id"); X+ } elsif ($SPAMSSUFFIX) { X+ $env_recips =3D~ s/\@/\-$SPAMSSUFFIX\@/g; X+ &qmail_requeue($env_returnpath,$env_recips,"$scandir/$wmaildir/new/$file_= id" ); X+ } else { X+ &qmail_requeue($env_returnpath,$env_recips,"$scandir/$wmaildir/new/$file_= id" ); X+ } X+ } else { X+ &qmail_requeue($env_returnpath,$env_recips,"$scandir/$wmaildir/new/$file_= id" ); X+ } X } X alarm 0; X }; X--- sub-spamassassin.pl.orig Tue Sep 30 07:11:51 2003 X+++ sub-spamassassin.pl Tue Sep 30 07:12:14 2003 X@@ -57,6 +57,7 @@ X $tag_score .=3D "SA:1($sa_score/$sa_max):"; X $sa_comment =3D "Yes, hits=3D$sa_score required=3D$sa_max" if ($spamc_options =3D~ /\-c/); X &debug("SA: yup, this smells like SPAM"); X+ $spam_event =3D 1; X } X $stop_spamassassin_time=3D[gettimeofday]; X $spamassassin_time =3D tv_interval ($start_spamassassin_time, $stop_spamassassin_time); END-of-qmail-scanner/files/patch-spams echo x - qmail-scanner/pkg-message sed 's/^X//' >qmail-scanner/pkg-message << 'END-of-qmail-scanner/pkg-message' X**************************************************** XNOTES: X - You have to configure your anti-virus and anti-spams products! X - You HAVE to reinstall this port each time you add or remove one! X XNow, you have to modify your qmail startup files to call qmail-scanner. XIn most case, you just need to add: X export QMAILQUEUE=3D"${PREFIX}/bin/qmail-scanner-queue.pl" Xto your tcpserver startup file. X XYou can test installation by running 'make test' in port dir. X**************************************************** END-of-qmail-scanner/pkg-message echo x - qmail-scanner/pkg-install sed 's/^X//' >qmail-scanner/pkg-install << 'END-of-qmail-scanner/pkg-install' X#!/bin/sh X XCHMOD=3D/bin/chmod XCHOWN=3D/usr/sbin/chown XMKDIR=3D/bin/mkdir XPW=3D/usr/sbin/pw X XGU_ID=3D98 XGU_NAME=3Dqscand X XPREFIX=3D${PKG_PREFIX} XSPOOLDIR=3D${PREFIX}/qmailscan X Xcase "$2" in XPRE-INSTALL) X # User and group X ${PW} groupshow -n ${GU_NAME} >/dev/null 2>&1 \ X || ${PW} groupadd -n ${GU_NAME} -g ${GU_ID} X ${PW} usershow -n ${GU_NAME} >/dev/null 2>&1 \ X || ${PW} useradd ${GU_NAME} -g ${GU_NAME} -u ${GU_ID} -s no X break;; XPOST-INSTALL) X # Directories X for i in working quarantine archives; do X for j in tmp cur new; do X ${MKDIR} -p ${SPOOLDIR}/$i/$j X done X done X ${MKDIR} -p ${SPOOLDIR}/tmp X X # Setuid qmail-scanner-queue.pl script X ${CHOWN} ${GU_NAME}:${GU_NAME} ${PREFIX}/bin/qmail-scanner-queue.pl X ${CHMOD} 4755 ${PREFIX}/bin/qmail-scanner-queue.pl X X # Initialize X ${PREFIX}/bin/qmail-scanner-queue.pl -z X ${PREFIX}/bin/qmail-scanner-queue.pl -g X X # Mode and owner X ${CHOWN} -R ${GU_NAME}:${GU_NAME} ${SPOOLDIR} X break;; Xesac END-of-qmail-scanner/pkg-install exit --- qmail-scanner-1.20r4.shar ends here --- -- MOULIN Cl=E9ment SimpleRezo - http://www.simplerezo.com/
State Changed From-To: open->closed New port added, thanks!