diff options
author | Sergei Kolobov <sergei@FreeBSD.org> | 2003-12-11 11:40:35 +0000 |
---|---|---|
committer | Sergei Kolobov <sergei@FreeBSD.org> | 2003-12-11 11:40:35 +0000 |
commit | 46a4563118d992f8c05b8f3dbfb42d326e3e030b (patch) | |
tree | c9efc792f8edbaa084463d138bfd0b73adf1c14e /mail/qmail-scanner1 | |
parent | Update from 1.3Beta3 to 1.4. Parts of the fixes are from Kopete to get (diff) |
Add qmail-scanner 1.20.r4, Content/Anti-virus Scanner for qmail.
Qmail-Scanner is e-mail content scanner that enables a qmail server to
scan all messages it receives for certain characteristics (normally viruses),
and react accordingly.
If you have a commercial virus scanner (eg, Sophos sweep, McAfee
uvscan, etc) installed when you build qmail-scanner, qmail-scanner
will configure itself to use that. Otherwise, it will only use its
internal content filter which only allows you to block mail based
on text in the subject/body, general types of attachments, etc.
WWW: http://qmail-scanner.sourceforge.net/
PR: 55941
Submitted by: moeti <freebsd@simplerezo.com>
Diffstat (limited to 'mail/qmail-scanner1')
-rw-r--r-- | mail/qmail-scanner1/Makefile | 89 | ||||
-rw-r--r-- | mail/qmail-scanner1/distinfo | 1 | ||||
-rw-r--r-- | mail/qmail-scanner1/files/patch-configure | 106 | ||||
-rw-r--r-- | mail/qmail-scanner1/files/patch-qmail-scanner-queue.template | 51 | ||||
-rw-r--r-- | mail/qmail-scanner1/files/patch-sub-spamassassin.pl | 10 | ||||
-rw-r--r-- | mail/qmail-scanner1/pkg-descr | 11 | ||||
-rw-r--r-- | mail/qmail-scanner1/pkg-install | 43 | ||||
-rw-r--r-- | mail/qmail-scanner1/pkg-message | 12 | ||||
-rw-r--r-- | mail/qmail-scanner1/pkg-plist | 14 |
9 files changed, 337 insertions, 0 deletions
diff --git a/mail/qmail-scanner1/Makefile b/mail/qmail-scanner1/Makefile new file mode 100644 index 000000000000..8449d2f34ee5 --- /dev/null +++ b/mail/qmail-scanner1/Makefile @@ -0,0 +1,89 @@ +# New ports collection makefile for: qmail-scanner +# Date created: 2003-08-24 +# Whom: moeti +# +# $FreeBSD$ +# + +PORTNAME= qmail-scanner +PORTVERSION= 1.20.r4 +CATEGORIES= mail security +MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} +MASTER_SITE_SUBDIR= ${PORTNAME} +DISTNAME= ${PORTNAME}-${PORTVERSION:S/.r/rc/} +EXTRACT_SUFX= .tgz + +MAINTAINER= freebsd@simplerezo.com +COMMENT= Content/Anti-virus Scanner for qmail + +# A normal qmail installation puts everything into /var/qmail/. +# Must match your qmail installation +QMAIL_DIR?= /var/qmail + +BUILD_DEPENDS= ${QMAIL_DIR}/bin/qmail-queue:${PORTSDIR}/mail/qmail \ + ${SITE_PERL}/${PERL_ARCH}/Time/HiRes.pm:${PORTSDIR}/devel/p5-Time-HiRes \ + reformime:${PORTSDIR}/mail/maildrop + +USE_PERL5= yes +NO_BUILD= yes + +# Barely optionnal +.if !defined(WITHOUT_TNEF) +BUILD_DEPENDS+= ${LOCALBASE}/bin/tnef:${PORTSDIR}/converters/tnef +.endif + +# Options +QMAILSCAN_ADMIN?= root +.if defined(QMAILSCAN_ADMINREALNAME) +CONFIGURE_ARGS+= --admin-realname "${QMAILSCAN_ADMINREALNAME}" +.endif +QMAILSCAN_NOTIFY?= sender,recips,admin +.if defined(QMAILSCAN_LOCALDOMAINS) +CONFIGURE_ARGS+= --local-domains "${QMAILSCAN_LOCALDOMAINS}" +.endif +.if defined(QMAILSCAN_SPAMSREDIRECT) +CONFIGURE_ARGS+= --spams-redirect "${QMAILSCAN_SPAMSREDIRECT}" +.endif +.if defined(QMAILSCAN_SPAMSTOSUFFIX) +CONFIGURE_ARGS+= --spams-tosuffix "${QMAILSCAN_SPAMSTOSUFFIX}" +.endif + +SPOOLDIR= ${PREFIX}/qmailscan +PLIST_SUB= SPOOLDIR="${SPOOLDIR:S,${PREFIX}/,,}" + +HAS_CONFIGURE= yes +CONFIGURE_ARGS+= --qmaildir ${QMAIL_DIR} --spooldir ${SPOOLDIR} \ + --bindir ${PREFIX}/bin \ + --admin "${QMAILSCAN_ADMIN}" --notify "${QMAILSCAN_NOTIFY}" \ + --silent-viruses auto \ + --archive no --redundant yes --unzip yes \ + --add-dscr-hdrs yes \ + --scanners auto \ + --fix-mime yes \ + --log-details syslog --debug no \ + --batch + +pre-configure: + @PKG_PREFIX=${PREFIX} ${SH} ${PKGDIR}/pkg-install ${PKGNAME} PRE-INSTALL + +do-install: + -${TEST} -f ${PREFIX}/bin/qmail-scanner-queue.pl && \ + ${MV} ${PREFIX}/bin/qmail-scanner-queue.pl \ + ${PREFIX}/bin/qmail-scanner-queue.pl.old + ${INSTALL_SCRIPT} ${WRKSRC}/qmail-scanner-queue.pl ${PREFIX}/bin + ${INSTALL_DATA} ${WRKSRC}/quarantine-attachments.txt \ + ${SPOOLDIR}/quarantine-attachments.sample + ${TEST} -f ${SPOOLDIR}/quarantine-attachments.txt || \ + ${INSTALL_DATA} ${WRKSRC}/quarantine-attachments.txt ${SPOOLDIR} + @PKG_PREFIX=${PREFIX} ${SH} ${PKGDIR}/pkg-install ${PKGNAME} POST-INSTALL + @${CAT} ${PKGMESSAGE} + +post-deinstall: + @${ECHO_MSG} + @${ECHO_MSG} "If you're not updating this port, you can delete directory '${SPOOLDIR}'." + @${ECHO_MSG} "" + +test: + @${WRKSRC}/contrib/test_installation.sh -doit + +.include <bsd.port.mk> diff --git a/mail/qmail-scanner1/distinfo b/mail/qmail-scanner1/distinfo new file mode 100644 index 000000000000..e959ceb85822 --- /dev/null +++ b/mail/qmail-scanner1/distinfo @@ -0,0 +1 @@ +MD5 (qmail-scanner-1.20rc4.tgz) = 3324c752ce4d0d85d5a68821722d7240 diff --git a/mail/qmail-scanner1/files/patch-configure b/mail/qmail-scanner1/files/patch-configure new file mode 100644 index 000000000000..5eec14b74de8 --- /dev/null +++ b/mail/qmail-scanner1/files/patch-configure @@ -0,0 +1,106 @@ +--- configure.orig Thu Dec 11 14:28:41 2003 ++++ configure Thu Dec 11 14:28:48 2003 +@@ -83,7 +83,8 @@ DEBUG_LEVEL="1" + FORCE_UNZIP="0" + DESCRIPTIVE_HEADERS="0" + NOTIFY_ADDRESSES="sender,admin" +-USERNAME="$USER" ++ADMIN_MAIL="$USER" ++ADMIN_REALNAME="System Anti-Virus Administrator" + MANUAL_INSTALL="0" + INSTALLIT="0" + DONOTCONFIRM="0" +@@ -100,8 +101,10 @@ do + --spooldir) if [ "$2" != "" ] ; then shift ; fi ; AS_QQ="$1" ;; + --qmaildir) if [ "$2" != "" ]; then shift ; fi ; QMAILDIR="$1" ;; + --bindir) if [ "$2" != "" ] ; then shift ; fi ; BINDIR="$1" ;; +- --user|--admin) if [ "$2" != "" ] ; then shift ; fi ; USERNAME="$1" ;; +- --domain) if [ "$2" != "" ] ; then shift ; fi ; MAILDOMAIN="$1" ;; ++ --admin|--user) if [ "$2" != "" ] ; then shift ; fi ; ADMIN_MAIL=`echo $1 | sed 's/@/\\\\@/'` ;; ++ --admin-realname) if [ "$2" != "" ] ; then shift ; fi ; ADMIN_REALNAME=`echo $1 | sed 's/_/ /g'` ;; ++ --spams-redirect) if [ "$2" != "" ] ; then shift ; fi ; SPAMS_REDIRECT=`echo $1 | sed 's/@/\\\\@/'` ;; ++ --spams-tosuffix) if [ "$2" != "" ] ; then shift ; fi ; SPAMS_TOSUFFIX="$1" ;; + --notify) if [ "$2" != "" ]; then shift ; fi ; NOTIFY_ADDRESSES="$1" ;; + --batch) DONOTCONFIRM="1" ; if [ "$2" != "" -a "`echo $2|grep '\-'`" = "" ] ; then shift ; fi ;; + --silent-viruses) if [ "$2" != "" ]; then shift ; fi ; FIND_SILENT_VIRUSES="$1" ;; +@@ -130,9 +133,17 @@ valid options: + --spooldir <spooldir> defaults to $AS_QQ/ + --bindir <installdir> where to install qmail-scanner-queue.pl + Defaults to /var/qmail/bin/ +- --admin <username> user to Email alerts to (default: $USERNAME) +- --domain <domain name> "user"@"domain" makes up Email address +- to Email alerts to. ++ --admin <email> email to send alerts to (default: $ADMIN_MAIL) ++ --admin-realname <...> realname for sending alerts ++ Defaults to "$ADMIN_REALNAME" ++ nb: use '_' instead of ' ' (sorry for inconvenience) ++ --spams-redirect <email> email to redirect detected spams to ++ Defaults to empty (no redirection) ++ --spams-tosuffix <suffix> suffix to alter recipient with ++ i.e. recipient user@domain ++ will be transform into user-suffix@domain ++ Defaults to empty (do not alter recipients) ++ nb: 'spams-admin' option has precedence on this + --scanners <list of installed content scanners> + Defaults to "auto" - will use + whatever scanners are found on system. +@@ -911,12 +922,16 @@ fi + if [ "$UNAME" ] ; then FQDN="$UNAME" ; fi + if [ "$HOST" ] ; then FQDN="$HOST" ; fi + +-MAILDOMAIN=${MAILDOMAIN:-$FQDN} +-LOCAL_DOMAINS_ARRAY=${LOCAL_DOMAINS_ARRAY:-$MAILDOMAIN} +-CMDLINE="$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\"" +- ++LOCAL_DOMAINS_ARRAY=${LOCAL_DOMAINS_ARRAY:-$FQDN} ++CMDLINE="$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\"" + + ++if [ -n "$SPAMS_REDIRECT" ]; then ++ CMDLINE="$CMDLINE --spams-redirect $SPAMS_REDIRECT" ++fi ++if [ -n "$SPAMS_TOSUFFIX" ]; then ++ CMDLINE="$CMDLINE --spams-tosuffix $SPAMS_TOSUFFIX" ++fi + if [ "$MANUAL_INSTALL" = "1" ]; then + CMDLINE="$CMDLINE --no-QQ-check $MANUAL_INSTALL" + fi +@@ -1286,7 +1301,7 @@ if [ "$SPAMC_BINARY" != "" ]; then + fi + fi + +-USERNAME=${USERNAME:-$LOGNAME} ++ADMIN_MAIL=${ADMIN_MAIL:-$LOGNAME} + + SCANNER_ARRAY=`echo $SCANNER_ARRAY|sed 's/^,//g'` + +@@ -1360,7 +1375,13 @@ if [ "$ARCHIVEIT" != "0" ]; then + fi + echo "archiving $ASTRING into $AS_QQ/$ARCHIVEDIR/" + fi +-echo "virus-admin=$USERNAME@$MAILDOMAIN" ++echo "admin=$ADMIN_MAIL" ++if [ -n "$SPAMS_REDIRECT" ]; then ++ echo "spams-admin=$SPAMS_REDIRECT" ++fi ++if [ -n "$SPAMS_TOSUFFIX" ]; then ++ echo "spams-suffix=$SPAMS_TOSUFFIX" ++fi + echo "local-domains=$LOCAL_DOMAINS_ARRAY" + echo "silent-viruses=$FIND_SILENT_VIRUSES_ARRAY" + echo "scanners=$SCANNER_ARRAY" +@@ -1506,10 +1527,12 @@ s?SPAMASSASSIN_BINARY?$SPAMASSASSIN_BINA + s?SPAMC_BINARY?$SPAMC_BINARY?g; + s?SPAMC_OPTIONS?$SPAMC_OPTIONS?g; + s?SPAMC_SUBJECT?$SPAMC_SUBJECT?g; +-s?USERNAME?$USERNAME?g; ++s?ADMIN_MAIL?$ADMIN_MAIL?g; ++s?ADMIN_REALNAME?$ADMIN_REALNAME?g; ++s?SPAMS_REDIRECT?$SPAMS_REDIRECT?g; ++s?SPAMS_TOSUFFIX?$SPAMS_TOSUFFIX?g; + s?SKIP_TEXT_MSGS?$SKIP_TEXT_MSGS?g; + s?FQDN?$FQDN?g; +-s?MAILDOMAIN?$MAILDOMAIN?g; + s?LOCAL_DOMAINS_ARRAY?$LOCAL_DOMAINS_ARRAY?g; + s?NOTIFY_ADDRESSES?$NOTIFY_ADDRESSES?g; + s?FIND?$FIND?g; diff --git a/mail/qmail-scanner1/files/patch-qmail-scanner-queue.template b/mail/qmail-scanner1/files/patch-qmail-scanner-queue.template new file mode 100644 index 000000000000..90136d5f21a2 --- /dev/null +++ b/mail/qmail-scanner1/files/patch-qmail-scanner-queue.template @@ -0,0 +1,51 @@ +--- qmail-scanner-queue.template.orig Thu Oct 16 02:05:10 2003 ++++ qmail-scanner-queue.template Thu Dec 11 14:28:48 2003 +@@ -85,11 +85,17 @@ $qsmsgid=tolower("$V_HEADER-message-id") + + + #From: line information used when making reports +-my $V_FROM='USERNAME@MAILDOMAIN'; +-my $V_FROMNAME='System Anti-Virus Administrator'; ++my $V_FROM='ADMIN_MAIL'; ++my $V_FROMNAME='ADMIN_REALNAME'; + + # Address carbon-copied on any virus reports +-my $QUARANTINE_CC='USERNAME@MAILDOMAIN'; ++my $QUARANTINE_CC='ADMIN_MAIL'; ++ ++# Address to where spams are redirected ++my $SPAMSADMIN='SPAMS_REDIRECT'; ++ ++# Suffix to alter recipients with (when spam detected) ++my $SPAMSSUFFIX='SPAMS_TOSUFFIX'; + + #Array of local domains that are checked against for + #deciding whether or not to send recipient alerts to +@@ -294,6 +300,7 @@ if (! -d "$scandir/tmp") { + } + + my $quarantine_event=0; ++my $spam_event=0; + + my $file_id = &uniq_id(); + +@@ -415,7 +422,18 @@ eval { + &email_quarantine_report; + } else { + &qmail_parent_check; +- &qmail_requeue($env_returnpath,$env_recips,"$scandir/$wmaildir/new/$file_id"); ++ if ($spam_event) { ++ if ($SPAMSADMIN) { ++ &qmail_requeue($env_returnpath,"T$SPAMSADMIN\0\0","$scandir/$wmaildir/new/$file_id"); ++ } elsif ($SPAMSSUFFIX) { ++ $env_recips =~ s/\@/\-$SPAMSSUFFIX\@/g; ++ &qmail_requeue($env_returnpath,$env_recips,"$scandir/$wmaildir/new/$file_id"); ++ } else { ++ &qmail_requeue($env_returnpath,$env_recips,"$scandir/$wmaildir/new/$file_id"); ++ } ++ } else { ++ &qmail_requeue($env_returnpath,$env_recips,"$scandir/$wmaildir/new/$file_id"); ++ } + } + alarm 0; + }; diff --git a/mail/qmail-scanner1/files/patch-sub-spamassassin.pl b/mail/qmail-scanner1/files/patch-sub-spamassassin.pl new file mode 100644 index 000000000000..eae1990e2606 --- /dev/null +++ b/mail/qmail-scanner1/files/patch-sub-spamassassin.pl @@ -0,0 +1,10 @@ +--- sub-spamassassin.pl.orig Mon Sep 29 04:17:22 2003 ++++ sub-spamassassin.pl Thu Dec 11 14:28:48 2003 +@@ -57,6 +57,7 @@ sub spamassassin { + $tag_score .= "SA:1($sa_score/$sa_max):"; + $sa_comment = "Yes, hits=$sa_score required=$sa_max" if ($spamc_options =~ /\-c/); + &debug("SA: yup, this smells like SPAM"); ++ $spam_event = 1; + } + $stop_spamassassin_time=[gettimeofday]; + $spamassassin_time = tv_interval ($start_spamassassin_time, $stop_spamassassin_time); diff --git a/mail/qmail-scanner1/pkg-descr b/mail/qmail-scanner1/pkg-descr new file mode 100644 index 000000000000..e1a3e30d6f0e --- /dev/null +++ b/mail/qmail-scanner1/pkg-descr @@ -0,0 +1,11 @@ +Qmail-Scanner is e-mail content scanner that enables a qmail server to +scan all messages it receives for certain characteristics (normally viruses), +and react accordingly. + +If you have a commercial virus scanner (eg, Sophos sweep, McAfee +uvscan, etc) installed when you build qmail-scanner, qmail-scanner +will configure itself to use that. Otherwise, it will only use its +internal content filter which only allows you to block mail based +on text in the subject/body, general types of attachments, etc. + +WWW: http://qmail-scanner.sourceforge.net/ diff --git a/mail/qmail-scanner1/pkg-install b/mail/qmail-scanner1/pkg-install new file mode 100644 index 000000000000..414c1f77bb1b --- /dev/null +++ b/mail/qmail-scanner1/pkg-install @@ -0,0 +1,43 @@ +#!/bin/sh + +CHMOD=/bin/chmod +CHOWN=/usr/sbin/chown +MKDIR=/bin/mkdir +PW=/usr/sbin/pw + +GU_ID=98 +GU_NAME=qscand + +PREFIX=${PKG_PREFIX} +SPOOLDIR=${PREFIX}/qmailscan + +case "$2" in +PRE-INSTALL) + # User and group + ${PW} groupshow -n ${GU_NAME} >/dev/null 2>&1 \ + || ${PW} groupadd -n ${GU_NAME} -g ${GU_ID} + ${PW} usershow -n ${GU_NAME} >/dev/null 2>&1 \ + || ${PW} useradd ${GU_NAME} -g ${GU_NAME} -u ${GU_ID} -s /sbin/nologin + ${MKDIR} -p ${SPOOLDIR} + ;; +POST-INSTALL) + # Directories + for i in quarantine working archives; do + for j in tmp cur new; do + ${MKDIR} -p ${SPOOLDIR}/$i/$j + done + done + ${MKDIR} -p ${SPOOLDIR}/tmp + + # Mod and owner + ${CHOWN} ${GU_NAME}:${GU_NAME} ${PREFIX}/bin/qmail-scanner-queue.pl + ${CHMOD} 4755 ${PREFIX}/bin/qmail-scanner-queue.pl + + # Initialize + ${PREFIX}/bin/qmail-scanner-queue.pl -z + ${PREFIX}/bin/qmail-scanner-queue.pl -g + + # Mod and owner (final) + ${CHOWN} -R ${GU_NAME}:${GU_NAME} ${SPOOLDIR} + ;; +esac diff --git a/mail/qmail-scanner1/pkg-message b/mail/qmail-scanner1/pkg-message new file mode 100644 index 000000000000..e61b55935bea --- /dev/null +++ b/mail/qmail-scanner1/pkg-message @@ -0,0 +1,12 @@ +**************************************************** +NOTES: + - You have to configure your anti-virus and anti-spams products! + - You HAVE to reinstall this port each time you add or remove one! + +Now, you have to modify your qmail startup files to call qmail-scanner. +In most case, you just need to add: + export QMAILQUEUE="${PREFIX}/bin/qmail-scanner-queue.pl" +to your tcpserver startup file. + +You can test installation by running 'make test' in port dir. +**************************************************** diff --git a/mail/qmail-scanner1/pkg-plist b/mail/qmail-scanner1/pkg-plist new file mode 100644 index 000000000000..785de258f924 --- /dev/null +++ b/mail/qmail-scanner1/pkg-plist @@ -0,0 +1,14 @@ +@comment $FreeBSD$ +bin/qmail-scanner-queue.pl +%%SPOOLDIR%%/quarantine-attachments.sample +%%SPOOLDIR%%/quarantine-attachments.txt +@unexec rmdir %%SPOOLDIR%%/archives/cur 2>1 || true +@unexec rmdir %%SPOOLDIR%%/archives/new 2>1 || true +@unexec rmdir %%SPOOLDIR%%/archives/tmp 2>1 || true +@unexec rmdir %%SPOOLDIR%%/archives 2>1 || true +@unexec rmdir %%SPOOLDIR%%/quarantine/cur 2>1 || true +@unexec rmdir %%SPOOLDIR%%/quarantine/new 2>1 || true +@unexec rmdir %%SPOOLDIR%%/quarantine/tmp 2>1 || true +@unexec rmdir %%SPOOLDIR%%/quarantine 2>1 || true +@unexec rmdir %%SPOOLDIR%%/tmp 2>1 || true +@unexec rmdir %%SPOOLDIR%% 2>1 || true |