ports/78629: New port: fast spam/antivirus scanner for qmail written in C

Anton Karpov toxa at toxahost.ru
Wed Mar 9 16:00:12 UTC 2005


>Number:         78629
>Category:       ports
>Synopsis:       New port: fast spam/antivirus scanner for qmail written in C
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 09 16:00:10 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Anton Karpov
>Release:        FreeBSD 5.3-STABLE i386
>Organization:
>Environment:
System: FreeBSD mercury.ank-pki.ru 5.3-STABLE FreeBSD 5.3-STABLE #0: 
Fri Nov 19 21:34:12 MSK 2004 root at mercury.ank-pki.ru:/usr/obj/usr/src/sys/MERCURY i386

>Description:
Currently, there are too few good spam/anti-virus scanners for qmail in ports. Simscan
is a good, simple, and fast qmail scanner, which works with SpamAssassin/ClamAV, written
in C. 
Hope it will be useful for a lot of people searching for fast and  simple "glue" to integrate 
qmail with spamassassin/clamav
This PR obsoletes PR #75717, and made due to committer's request
>How-To-Repeat:

>Fix:
New port shar file attached

--- simscan.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:
#
#	.
#	./Makefile
#	./distinfo
#	./pkg-install
#	./pkg-message
#	./pkg-plist
#	./pkg-descr
#
echo c - .
mkdir -p . > /dev/null 2>&1
echo x - ./Makefile
sed 's/^X//' >./Makefile << 'END-of-./Makefile'
X# New ports collection makefile for:	simscan
X# Date created:        2005-01-01
X# Whom:                Anton Karpov <toxa at unixforge.org>
X#
X# $FreeBSD$
X#
X
XPORTNAME=	simscan
XPORTVERSION=	1.1
XCATEGORIES=	mail security
XMASTER_SITES=	http://www.inter7.com/simscan/
XMASTER_SITE_SUBDIR=	${PORTNAME}
XDISTNAME=	${PORTNAME}-${PORTVERSION:S/.r/rc/}
X
XMAINTAINER=	toxa at unixforge.org
XCOMMENT=	Fast Content/Anti-virus Scanner for qmail Written in C
X
XBUILD_DEPENDS=	${QMAIL_QUEUE}:${PORTSDIR}/mail/qmail
X
XGNU_CONFIGURE=	yes
X
X# A normal qmail installation puts everything into /var/qmail/.
X# Must match your qmail installation
XQMAIL_DIR?=	/var/qmail
XWORKDIR?=	${QMAIL_DIR}/${PORTNAME}
XSIMSCAN_USER?=	simscan
XQMAIL_QUEUE=	${QMAIL_DIR}/bin/qmail-queue
XPLIST_SUB=	QMAIL_DIR=${QMAIL_DIR} \
X		SIMSCAN_DIR=${PORTNAME} \
X		SIMSCAN_USER=${SIMSCAN_USER}
X
XOPTIONS=	CLAMAV "Support for ClamAV Virus Scanning" on \
X		RIPMIME "Ripmime Processing (if Clamav ScanMail disabled)" on \
X		SPAMD "Support for SpamAssassin Spam Filtering" off \
X		USER "Turn On Per User SpamAssassin (required SPAMD)" off \
X		DOMAIN "Turn On Per Domain Based Checking" off \
X		ATTACH "Turn On Attachment Scanning (required CLAMAV)" off \
X		DROPMSG "Drop Message in Case of Virus Found" off \
X		PASSTHRU "Pass Spam Thru, Do Not Reject (required SPAMD)" off \
X		HEADERS "Add a Received Line With Versions of Scanners" off \
X		PORTDOCS "Readme/ChangeLog/Tips for further reading" on
X
X.include <bsd.port.pre.mk>
X
XCONFIGURE_ARGS=--enable-clamavdb-path=/var/db/clamav \
X		--enable-qmaildir=${QMAIL_DIR} \
X	  	--enable-spamc-user=n \
X		--enable-workdir=${WORKDIR}
X
X.if defined(WITHOUT_CLAMAV)
XCONFIGURE_ARGS+=-enable-clamav=n
X.else
XBUILD_DEPENDS+=	clamdscan:${PORTSDIR}/security/clamav
X.endif
X
X.if defined(WITHOUT_RIPMIME)
XCONFIGURE_ARGS+=--disable-ripmime
X.else
XBUILD_DEPENDS+=	ripmime:${PORTSDIR}/mail/ripmime
X.endif
X
X.if defined(WITH_SPAMD)
XBUILD_DEPENDS+=	spamassassin:${PORTSDIR}/mail/p5-Mail-SpamAssassin
XCONFIGURE_ARGS+=--enable-spam=y
XCONFIGURE_ARGS+=--enable-spamassassin-path=${LOCALBASE}/bin/spamassassin
X.endif
X
X.if defined(WITH_USER)
XCONFIGURE_ARGS+=--enable-spamc-user=y
X.endif
X
X.if defined(WITH_DOMAIN)
XCONFIGURE_ARGS+=--enable-per-domain=y
X.endif
X
X.if defined(WITH_ATTACH)
XCONFIGURE_ARGS+=--enable-attach=y
X.endif
X
X.if defined(WITH_DROPMSG)
XCONFIGURE_ARGS+=--enable-dropmsg=y
X.endif
X
X.if defined(WITH_PASSTHRU)
XCONFIGURE_ARGS+=--enable-spam-passthru=y
X.endif
X
X.if defined(WITH_HEADERS)
XCONFIGURE_ARGS+=--enable-received=y
XCONFIGURE_ARGS+=--enable-sigtool-path=${LOCALBASE}/bin/sigtool
X.endif
X
X.if defined(SPAM_HITS)
XCONFIGURE_ARGS+=--enable-spam-hits=${SPAM_HITS}
X.endif
X
X.if defined(QUARANTINE_DIR)
XCONFIGURE_ARGS+=--enable-quarantinedir=${QUARANTINE_DIR}
X.endif
X
X.if defined(SPAMC_ARGS)
XCONFIGURE_ARGS+=--enable-spamc-args=${SPAMC_ARGS}
X.endif
X
X.if defined(QMAIL_QUEUE)
XCONFIGURE_ARGS+=--enable-qmail-queue=${QMAIL_QUEUE}
X.endif
X
X.if (${SIMSCAN_USER} != "simscan")
XCONFIGURE_ARGS+=--enable-user=${SIMSCAN_USER}
X.endif
X
XPORTDOCS=	AUTHORS ChangeLog README TODO
X
Xif ! ${TEST} -f ${QMAIL_QUEUE}; then \
X	${ECHO_MSG} "Unable to found qmail-queue binary trying '${QMAIL_QUEUE}'.";  \
X	${ECHO_MSG} "Please set QMAIL_DIR to your qmail installation directory !"; \
X	exit 1; \
Xfi
X
Xpre-configure:
X	@PKG_PREFIX=${PREFIX} ${SH} ${PKGDIR}/pkg-install ${SIMSCAN_USER}
X	@${ECHO_MSG} ""
X	@${ECHO_MSG} "=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~="
X	@${ECHO_MSG} "You may also use the following build options:"
X	@${ECHO_MSG} ""
X	@${ECHO_MSG} "SIMSCAN_USER		User for simscan. Default is simscan"
X	@${ECHO_MSG} "QMAIL_DIR		Base qmail directory. Default is /var/qmail"
X	@${ECHO_MSG} "QMAIL_QUEUE		Define full path and name of the qmail-queue program"
X	@${ECHO_MSG} "			Incoming mail is passed to this program after being"
X	@${ECHO_MSG} "			scanned by SimScan. Default is /var/qmail/bin/qmail-queue"
X	@${ECHO_MSG} "SPAMC_ARGS		Define the arguments to pass to spamc."
X	@${ECHO_MSG} "			Be sure to place quotes around the options you define"
X	@${ECHO_MSG} "SPAM_HITS		Reject spam only above this hit level"
X	@${ECHO_MSG} "			Default is 10.0. Useful without PASSTHRU option"
X	@${ECHO_MSG} "QUARANTINE_DIR		Directory to keep spam and/or infected emails"
X	@${ECHO_MSG} "			Default is disabled"
X	@${ECHO_MSG} "=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~="
X	@${ECHO_MSG} ""
X
Xdo-install:
X	${INSTALL} -o ${SIMSCAN_USER} -g qmail -m 4711 ${WRKSRC}/simscan ${QMAIL_DIR}/bin
X	${INSTALL} -g qmail ${WRKSRC}/simscanmk ${QMAIL_DIR}/bin
X	@${STRIP_CMD} ${QMAIL_DIR}/bin/simscan
X	@${STRIP_CMD} ${QMAIL_DIR}/bin/simscanmk
X	@${MKDIR} ${{QMAIL_DIR}/${PORTNAME}
X.if defined(WITH_PORTDOCS)
X	@${MKDIR} ${DOCSDIR}
X.for i in ${PORTDOCS}
X	@${INSTALL_DATA} ${WRKSRC}/${i} ${DOCSDIR}
X.endfor
X.endif
X	@${CAT} ${PKGMESSAGE}
X
X.include <bsd.port.post.mk>
END-of-./Makefile
echo x - ./distinfo
sed 's/^X//' >./distinfo << 'END-of-./distinfo'
XMD5 (simscan-1.1.tar.gz) = 2ba25145dc0c1b6159f26f3f4c03d3c6
XSIZE (simscan-1.1.tar.gz) = 130114
END-of-./distinfo
echo x - ./pkg-install
sed 's/^X//' >./pkg-install << 'END-of-./pkg-install'
X#!/bin/sh
X#
X
X[ $# -ne 1 ] && exit 1
X
XSIMSCAN_USER=$1
XGROUP=${SIMSCAN_USER}
XUID=99
XGID=99
X
Xif ! pw groupshow "${GROUP}" 2>/dev/null 1>&2; then
X	if pw groupadd ${GROUP} -g ${GID}; then
X		echo "Added group \"${GROUP}\"."
X	else
X		echo "Adding group \"${GROUP}\" failed..."
X		exit 1
X	fi
Xfi
X
Xif ! pw usershow "${SIMSCAN_USER}" 2>/dev/null 1>&2; then
X	if pw useradd ${SIMSCAN_USER} -u ${UID} -g ${GROUP} -h - \
X		-s "/sbin/nologin" -d "/nonexistent" \
X		-c "Simscan user"; \
X	then
X		echo "Added user \"${SIMSCAN_USER}\"."
X	else
X		echo "Adding user \"${SIMSCAN_USER}\" failed..."
X		exit 1
X	fi
Xfi
Xexit 0
END-of-./pkg-install
echo x - ./pkg-message
sed 's/^X//' >./pkg-message << 'END-of-./pkg-message'
X
X=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
XNOTES:
X
X* You have to configure your anti-virus and anti-spam products!
X
X* You have to modify your qmail startup files to call simscan.
XIn most cases, you just need to edit /var/qmail/tcp.smtp in
Xorder to call simscan instead of qmail-queue, by setting up
XQMAILQUEUE variable. For example:
X
X127.0.0.1:allow,RELAYCLIENT=""
X192.168.0.:allow,RELAYCLIENT="",QMAILQUEUE="/var/qmail/bin/simscan"
X:allow,QMAILQUEUE="/var/qmail/bin/simscan"
X
X* Don't forget to rebuild tcp.smtp.cdb from new tcp.smtp using tcprules!
X
X* Also, read documentation about how to configure 
Xattachment blocking and per domain processing. 
XAdditional documentation can be found here: 
Xhttp://qmailwiki.inter7.com/index.php?title=Simscan
X
X=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
X
END-of-./pkg-message
echo x - ./pkg-plist
sed 's/^X//' >./pkg-plist << 'END-of-./pkg-plist'
X at cwd %%QMAIL_DIR%%
Xbin/simscan
Xbin/simscanmk
X at unexec echo ""
X at unexec echo "If you're not updating this port, you can delete %%QMAIL_DIR%%/%%SIMSCAN_DIR%% directory"
X at unexec echo "And type 'pw userdel %%SIMSCAN_USER%%' as well."
X at unexec echo ""
END-of-./pkg-plist
echo x - ./pkg-descr
sed 's/^X//' >./pkg-descr << 'END-of-./pkg-descr'
XSimscan is a simple program that enables qmail-smtpd to reject 
Xviruses, spam and block attachments during the SMTP conversation 
Xso the email never makes it into your computers. It is completely 
Xopen source and uses other open source components. 
XVery efficient and written in C.
X
XWWW:	http://www.inter7.com/?page=simscan
END-of-./pkg-descr
exit
--- simscan.shar ends here ---


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



More information about the freebsd-ports-bugs mailing list