Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 07 Nov 2006 22:26:44 -0500
From:      Yarema <yds@CoolRat.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        delphij@FreeBSD.org
Subject:   ports/105277: [UPDATE] mail/spamd - improvements and clean up
Message-ID:  <courier.45514E74.000132A3@CoolRat.org>
Resent-Message-ID: <200611080330.kA83UITb050596@freefall.freebsd.org>

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

>Number:         105277
>Category:       ports
>Synopsis:       [UPDATE] mail/spamd - improvements and clean up
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Wed Nov 08 03:30:18 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Yarema
>Release:        FreeBSD 6.2-PRERELEASE i386
>Organization:
NYCBUG.org
>Environment:
System:  FreeBSD 6.2-PRERELEASE #0: Sat Nov 4 05:14:48 EST 2006 i386

>Description:

New files to be imported:
	files/pfspamlogd.sh.in
	files/greyscanner.sh.in

rcorder(8) settings changed in the startup scripts so that spamd(8),
and now spamlogd(8), start sooner.  This helps catch some spam which
otherwise slips through when running spamd(8) on an edge server/firewall
and the real SMTP server on a different box behind it.

Modifed files/pfspamd.sh.in to backgroud spamd-setup(8).  Speeds up
booting significantly.  There's no reason to have to wait for
spamd-setup(8) to finish before moving on.

When WITH_IPFW defined do not install spamlogd(8) or the new pfspamlogd.sh
RCng script since it only works with pflog(4).

New option WITH_GREYSCANNER to install Bob Beck's <beck@OpenBSD.org>
prototype greytrapping daemon presented at the NYC BSD Conference.
And an accompanying RCng script.
http://www.ualberta.ca/~beck/nycbug06/spamd/mgp00016.html

Add greyscanner to ${IGNOREFILES} for now so the port checksums and
revision don't need to be bumped as Bob works on the prototype.

Instead of ${PREFIX}/etc/spamd.conf.sample install into ${EXAMPLESDIR} as
per hier(7).  Then also install as ${PREFIX}/etc/spamd.conf unless there's
a modified copy there.  Don't uninstall the modified version.

Same goes for the ${PREFIX}/libexec/greyscanner since it needs to be edited
because there is no seperate config for it yet.

Tarball of updated port available at http://yds.CoolRat.org/freebsd/spamd.tbz

>How-To-Repeat:
	cd /usr/ports/mail/spamd && make install

>Fix:
diff -u -ruN spamd~/Makefile spamd/Makefile
--- spamd~/Makefile	Thu May 11 06:55:48 2006
+++ spamd/Makefile	Tue Nov  7 21:10:15 2006
@@ -7,42 +7,80 @@
 
 PORTNAME=	spamd
 PORTVERSION=	3.7
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	mail
 MASTER_SITES=	${MASTER_SITE_LOCAL}
 MASTER_SITE_SUBDIR=	delphij
 DISTNAME=	${PORTNAME}_${PORTVERSION}
+DISTFILES=	${DISTNAME}${EXTRACT_SUFX}
+EXTRACT_ONLY=	${DISTNAME}${EXTRACT_SUFX}
 
 MAINTAINER=	delphij@FreeBSD.org
-COMMENT=	Traps spammers with a very slow smtp-login and return 4xx error
+COMMENT=	Traps spammers with a very slow smtp-login and returns 4xx error
 
 USE_BZIP2=	yes
 
+.if !defined(BATCH) && !defined(PACKAGE_BUILDING)
+IS_INTERACTIVE=	yes
+.endif
+
 .include <bsd.port.pre.mk>
 
+USE_RC_SUBR=	pfspamd.sh
+
 .if defined(WITH_IPFW)
-CFLAGS+= -DIPFW
 .if ${OSVERSION} < 490000
 BROKEN=		IPFW with Tables is required for this port to function properly
 .endif
+CFLAGS+= -DIPFW
+PLIST_SUB+=	PFLOG="@comment "
 .else
 .if ${OSVERSION} < 502117
 BROKEN=		OpenBSD 3.5 pf/pfctl is necessary for this port to function properly.
 .else
+USE_RC_SUBR+=	pfspamlogd.sh
+PLIST_SUB+=	PFLOG=""
 LOCAL_PFCTL=	/sbin/pfctl
 .endif
 .endif
 
-USE_RC_SUBR=	pfspamd.sh
-
-.if !defined(BATCH) && !defined(PACKAGE_BUILDING)
-IS_INTERACTIVE=	yes
+.if defined(WITH_GREYSCANNER)
+MASTER_SITES+=	http://www.ualberta.ca/~beck/
+DISTFILES+=	greyscanner
+IGNOREFILES=	greyscanner
+RUN_DEPENDS=	${SITE_PERL}/Email/Valid.pm:${PORTSDIR}/mail/p5-Email-Valid
+USE_RC_SUBR+=	greyscanner.sh
+SUB_LIST=	PERL=${PERL}
+USE_PERL5=	yes
+PLIST_SUB+=	TRAPPER=""
+.else
+PLIST_SUB+=	TRAPPER="@comment "
 .endif
 
 MAN5=		spamd.conf.5
-MAN8=		spamd.8 spamd-setup.8 spamdb.8 spamlogd.8
+MAN8=		spamd.8 spamd-setup.8 spamdb.8
+.if !defined(WITH_IPFW)
+MAN8+=		spamlogd.8
+.endif
 
-SAMPLE_SPAMD_CONF=	${PREFIX}/etc/spamd.conf.sample
+INSTALL_DIR?=	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 -d
+
+pre-everything::
+.if !defined(WITH_IPFW)
+	@${ECHO_MSG}
+	@${ECHO_MSG} "Define WITH_IPFW to build with support for ipfw(4)"
+	@${ECHO_MSG}
+	@${ECHO_MSG} "Note:	spamlogd(8) requires pflog(4), unsupported"
+	@${ECHO_MSG} "	in ipfw(4) mode and will not be installed."
+	@${ECHO_MSG}
+.endif
+.if !defined(WITH_GREYSCANNER)
+	@${ECHO_MSG}
+	@${ECHO_MSG} "Define WITH_GREYSCANNER to install experimental"
+	@${ECHO_MSG} "spamdb scanner which flags excessively spammish"
+	@${ECHO_MSG} "GREY entries as TRAPPED for the next 24 hours."
+	@${ECHO_MSG}
+.endif
 
 post-patch:
 	@${REINPLACE_CMD} -e 's|%%LOCAL_PFCTL%%|${LOCAL_PFCTL}|;	\
@@ -50,6 +88,10 @@
 	    ${WRKSRC}/spamd-setup/spamd-setup.c
 	@${REINPLACE_CMD} -e 's|/etc/spamd.conf|${PREFIX}/etc/spamd.conf|' \
 	    ${WRKSRC}/spamd/spamd.8 ${WRKSRC}/spamd-setup/spamd-setup.8
+.if defined(WITH_GREYSCANNER)
+	@${SED} -e 's|/usr/bin/perl|${PERL}|'	\
+	    ${DISTDIR}/greyscanner > ${WRKSRC}/greyscanner
+.endif
 
 pre-su-install:
 .if !defined(BATCH) && !defined(PACKAGE_BUILDING)
@@ -58,18 +100,24 @@
 
 do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/spamd/spamd ${PREFIX}/libexec
+.if !defined(WITH_IPFW)
 	${INSTALL_PROGRAM} ${WRKSRC}/spamlogd/spamlogd ${PREFIX}/libexec
+.endif
 	${INSTALL_PROGRAM} ${WRKSRC}/spamd-setup/spamd-setup ${PREFIX}/sbin
 	${INSTALL_PROGRAM} ${WRKSRC}/spamdb/spamdb ${PREFIX}/sbin
 	${INSTALL_MAN} ${WRKSRC}/doc/spamd.conf.5 ${PREFIX}/man/man5
 	${INSTALL_MAN} ${WRKSRC}/spamd/spamd.8 ${PREFIX}/man/man8
 	${INSTALL_MAN} ${WRKSRC}/spamd-setup/spamd-setup.8 ${PREFIX}/man/man8
 	${INSTALL_MAN} ${WRKSRC}/spamdb/spamdb.8 ${PREFIX}/man/man8
+.if !defined(WITH_IPFW)
 	${INSTALL_MAN} ${WRKSRC}/spamlogd/spamlogd.8 ${PREFIX}/man/man8
-	@if [ ! -f ${SAMPLE_SPAMD_CONF} ]; then			\
-		${ECHO_MSG} "Installing ${SAMPLE_SPAMD_CONF} file."; \
-		${INSTALL_DATA} ${WRKSRC}/doc/spamd.conf	\
-		${SAMPLE_SPAMD_CONF};				\
-	fi
+.endif
+	${INSTALL_DIR} ${EXAMPLESDIR}
+	${INSTALL_DATA} ${WRKSRC}/doc/spamd.conf ${EXAMPLESDIR}
+	[ -f ${PREFIX}/etc/spamd.conf ] || ${INSTALL_DATA} ${WRKSRC}/doc/spamd.conf ${PREFIX}/etc
+.if defined(WITH_GREYSCANNER)
+	${INSTALL_SCRIPT} ${WRKSRC}/greyscanner ${EXAMPLESDIR}
+	[ -f ${PREFIX}/libexec/greyscanner ] || ${INSTALL_SCRIPT} ${WRKSRC}/greyscanner ${PREFIX}/libexec
+.endif
 
 .include <bsd.port.post.mk>
diff -u -ruN spamd~/distinfo spamd/distinfo
--- spamd~/distinfo	Mon Jan 23 03:37:18 2006
+++ spamd/distinfo	Tue Nov  7 20:54:03 2006
@@ -1,3 +1,5 @@
 MD5 (spamd_3.7.tar.bz2) = e1d96b9d7b1d4189dca510ff0000383f
 SHA256 (spamd_3.7.tar.bz2) = a06ad07ead38240f13ea01c5d0315179e7089ed8fb8fe6544b1860bd8cfdc355
 SIZE (spamd_3.7.tar.bz2) = 28066
+MD5 (greyscanner) = IGNORE
+SHA256 (greyscanner) = IGNORE
diff -u -ruN spamd~/files/greyscanner.sh.in spamd/files/greyscanner.sh.in
--- spamd~/files/greyscanner.sh.in	Wed Dec 31 19:00:00 1969
+++ spamd/files/greyscanner.sh.in	Tue Nov  7 19:28:24 2006
@@ -0,0 +1,45 @@
+#!/bin/sh
+#
+# $FreeBSD: $
+#
+
+# PROVIDE: greyscanner
+# REQUIRE: LOGIN pfspamd
+# KEYWORD: shutdown
+
+#
+# Define these greyscanner_* variables in one of these files:
+#       /etc/rc.conf
+#       /etc/rc.conf.local
+#       /etc/rc.conf.d/greyscanner
+#
+# greyscanner_enable="YES"	# Run the greyscanner daemon (YES/NO).
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+greyscanner_enable=${greyscanner_enable:-"NO"}
+
+. %%RC_SUBR%%
+
+name="greyscanner"
+rcvar=`set_rcvar`
+
+command="%%PREFIX%%/libexec/${name}"
+command_interpreter="%%PERL%%"
+
+stop_cmd="greyscanner_stop"
+
+greyscanner_stop()
+{
+	pids=`check_process ${command} ${command_interpreter}`
+	if [ -z "${pids}" ]; then
+		echo "${name} not running?"
+	else
+		echo "Stopping ${name}."
+		kill ${sig_stop} ${pids}
+		wait_for_pids ${pids}
+	fi
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff -u -ruN spamd~/files/pfspamd.sh.in spamd/files/pfspamd.sh.in
--- spamd~/files/pfspamd.sh.in	Tue May  2 04:54:50 2006
+++ spamd/files/pfspamd.sh.in	Tue Nov  7 11:15:45 2006
@@ -4,16 +4,23 @@
 #
 
 # PROVIDE: pfspamd
-# REQUIRE: NETWORKING
-# BEFORE:  mail
+# REQUIRE: NETWORKING SERVERS
+# BEFORE:  DAEMON
 # KEYWORD: shutdown
 
 #
-# Add the following lines to /etc/rc.conf to enable spamd:
-# pfspamd_enable (bool):	Set to "NO" by default.
-#				Set it to "YES" to enable spamd
-# pfspamd_flags (str):		Set to "" by default.
-#				Extra flags passed to start command.
+# Define these pfspamd_* variables in one of these files:
+#       /etc/rc.conf
+#       /etc/rc.conf.local
+#       /etc/rc.conf.d/pfspamd
+#
+# pfspamd_enable="YES"			# Run the spamd(8) daemon (YES/NO).
+# pfspamd_flags="-g -r 451 -w 1"	# Extra flags for spamd(8) (if enabled).
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+pfspamd_enable=${pfspamd_enable:-"NO"}
+pfspamd_flags=${pfspamd_flags:-"-r 451 -w 1"}
 
 . %%RC_SUBR%%
 
@@ -24,16 +31,12 @@
 start_postcmd="pfspamd_postcmd"
 restart_postcmd="pfspamd_postcmd"
 
-[ -z "$pfspamd_enable" ]	&& pfspamd_enable="NO"
-[ -z "$pfspamd_flags" ]		&& pfspamd_flags=""
-
-load_rc_config $name
-
 pfspamd_postcmd() 
 {
 	if [ -x %%PREFIX%%/sbin/spamd-setup ]; then
-		%%PREFIX%%/sbin/spamd-setup
+		%%PREFIX%%/sbin/spamd-setup &
 	fi
 }
 
+load_rc_config $name
 run_rc_command "$1"
diff -u -ruN spamd~/files/pfspamlogd.sh.in spamd/files/pfspamlogd.sh.in
--- spamd~/files/pfspamlogd.sh.in	Wed Dec 31 19:00:00 1969
+++ spamd/files/pfspamlogd.sh.in	Tue Nov  7 11:13:42 2006
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# $FreeBSD:  $
+#
+
+# PROVIDE: pfspamlogd
+# REQUIRE: NETWORKING SERVERS pfspamd
+# BEFORE:  DAEMON
+# KEYWORD: shutdown
+
+#
+# Define these pfspamlogd_* variables in one of these files:
+#       /etc/rc.conf
+#       /etc/rc.conf.local
+#       /etc/rc.conf.d/pfspamlogd
+#
+# pfspamlogd_enable="YES"	# Run the spamlogd(8) daemon (YES/NO).
+# pfspamlogd_flags=""		# Extra flags for spamlogd(8) (if enabled).
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+pfspamlogd_enable=${pfspamlogd_enable:-"NO"}
+pfspamlogd_flags=${pfspamlogd_flags:-""}
+
+. %%RC_SUBR%%
+
+name="pfspamlogd"
+rcvar=`set_rcvar`
+
+command="%%PREFIX%%/libexec/spamlogd"
+
+load_rc_config $name
+run_rc_command "$1"
diff -u -ruN spamd~/pkg-descr spamd/pkg-descr
--- spamd~/pkg-descr	Mon Sep 29 19:01:21 2003
+++ spamd/pkg-descr	Tue Nov  7 19:31:54 2006
@@ -12,6 +12,6 @@
 delay his entire queue handling for several minutes each time he connects to
 the tarpit. And many spammers use badly configured open relays
 
-WWW: http://www.benzedrine.cx/relaydb.html
+WWW: http://www.OpenBSD.org/spamd/
 
 -Max <max@love2party.net>
diff -u -ruN spamd~/pkg-plist spamd/pkg-plist
--- spamd~/pkg-plist	Wed May  3 03:31:44 2006
+++ spamd/pkg-plist	Tue Nov  7 18:33:03 2006
@@ -1,5 +1,11 @@
 libexec/spamd
-libexec/spamlogd
+%%PFLOG%%libexec/spamlogd
 sbin/spamd-setup
 sbin/spamdb
-etc/spamd.conf.sample
+@unexec if cmp -s %D/etc/spamd.conf %D/%%EXAMPLESDIR%%/spamd.conf; then rm -f %D/etc/spamd.conf; fi
+%%EXAMPLESDIR%%/spamd.conf
+@exec [ -f %D/etc/spamd.conf ] || cp %D/%%EXAMPLESDIR%%/spamd.conf %D/etc/spamd.conf
+%%TRAPPER%%@unexec if cmp -s %D/libexec/greyscanner %D/%%EXAMPLESDIR%%/greyscanner; then rm -f %D/libexec/greyscanner; fi
+%%TRAPPER%%%%EXAMPLESDIR%%/greyscanner
+%%TRAPPER%%@exec [ -f %D/libexec/greyscanner ] || cp %D/%%EXAMPLESDIR%%/greyscanner %D/libexec/greyscanner
+@dirrm %%EXAMPLESDIR%%
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?courier.45514E74.000132A3>