Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Jul 2009 22:44:45 +0200 (CEST)
From:      olli hauer <ohauer@gmx.de>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        olli hauer <ohauer@gmx.de>
Subject:   ports/136912: [patch] update port mail/spamd to spamd-4.5.0 and request maintainership
Message-ID:  <20090719204445.EDE0E2613F@u18-124.dsl.vianetworks.de>
Resent-Message-ID: <200907192050.n6JKo0gC091955@freefall.freebsd.org>

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

>Number:         136912
>Category:       ports
>Synopsis:       [patch] update port mail/spamd to spamd-4.5.0 and request maintainership
>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:   Sun Jul 19 20:50:00 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     olli hauer <ohauer@gmx.de>
>Release:        FreeBSD 7.2-RELEASE-p2 i386
>Organization:
>Environment:
System: FreeBSD 7.2-RELEASE-p2 FreeBSD 7.2-RELEASE-p2 #0: Thu Jun 25 19:46:29 CEST 2009 i386

>Description:
I found the time to release spamd-4.5.0.
Code is based on OpenBSD current + some additions I send to tech@OpenBSD long time ago.
The code runs now for a long time stable in production on my machines.

Additional I like to become maintainer of the port mail/spamd

Important changes:
 - sync protocol is not compatible with old version

Features added:
 - whiteexp time for spamlogd, PR-134347 (can be closed now)
 - whiteexp time for spamdb 
 - sync support for spamd
 - add build option CPANEL to Makefile, this installes the spamd binary as obspamd
   and adjust the rc script. (protect the process from kill -TERM spamd)

New release is tested at the following platforms.
 - 6.2/6.4       (i386/amd64)
 - 7.0/7.1/7.2   (i386/amd64)
 - 7.1/7.2       (sparc)
 - 8 beta        (i386/amd64)

Please add the following Note to ports/UPDATING:

 AFFECTS: users of mail/spamd

 The sync protocol has changed for versions > 4.1.x
 If you have spamd installed in distributed environment
 with sync enabled stop sync between the nodes until every
 node is updated

 - sync for spamdb is now implemented (parameter -Y)
 - if you use cPanel build the port with -DCPANEL,
 spamd binary will be installed as obspamd to protect
 the process from a kill -HUP from cPanel


>How-To-Repeat:

>Fix:

Apply diff to port or use the shar file to extract the updated port.

removed files:
 - files/patch-makefile
 - files/patch-spamd__grey.c
 - files/patch-spamlogd


--- spamd-4.5.0.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:
#
#	spamd
#	spamd/files
#	spamd/files/pkg-deinstall.in
#	spamd/files/pkg-message.in
#	spamd/files/obspamd.in
#	spamd/files/pkg-install.in
#	spamd/files/obspamlogd.in
#	spamd/distinfo
#	spamd/pkg-descr
#	spamd/Makefile
#
echo c - spamd
mkdir -p spamd > /dev/null 2>&1
echo c - spamd/files
mkdir -p spamd/files > /dev/null 2>&1
echo x - spamd/files/pkg-deinstall.in
sed 's/^X//' >spamd/files/pkg-deinstall.in << '596302288a1c7396704762e73c9eb3ac'
X#!/bin/sh
X#
X#
X
XSPAMDDIR=%%SPAMDDIR%%
XSPAMDUSER=%%SPAMDUSER%%
XSPAMDGROUP=%%SPAMDGROUP%%
X
Xif [ "$2" = "POST-DEINSTALL" ]; then
X  if /usr/sbin/pw group show "${SPAMDGROUP}" 2>&1 >/dev/null; then
X    echo "You should manually remove the \"${SPAMDGROUP}\" group."
X  fi
X
X  if /usr/sbin/pw user show "${SPAMDUSER}" 2>&1 >/dev/null; then
X    echo "You should manually remove the \"${SPAMDUSER}\" user."
X  fi
X
X  if [ -e "${SPAMDDIR}" ]; then
X    if [ "${SPAMDDIR}" != "/var/empty" ]; then
X       echo "You should manually remove the \"${SPAMDDIR}\" directory."
X    fi
X  fi
Xfi
596302288a1c7396704762e73c9eb3ac
echo x - spamd/files/pkg-message.in
sed 's/^X//' >spamd/files/pkg-message.in << 'a49e29b24bc75611658944b7fa7eed6c'
X**********************************************************************
XTo enable spamd you need:
X
X1) Enable spamd in /etc/rc.conf with the following line:
X   obspamd_enable="YES"
X   obspamlogd_enable="YES"
X
X2) Configuration template is available in %%PREFIX%%/etc/spamd as
X   spamd.conf.sample file.  Copy then to spamd.conf file and
X   edit to suit your needs.
X
X3) mount fdescfs to /dev/fd with the following line in /etc/fstab
X	fdescfs  	/dev/fd  	fdescfs rw 	0 	0
X
X4) Add following lines to the pf.conf(5)
X
X  table <spamd-white> persist
X  no rdr inet proto tcp from <spamd-white> to any \
X      port smtp
X  rdr pass inet proto tcp from any to any \
X      port smtp -> 127.0.0.1 port spamd
X
XNew features:
X  - sync for spamdb is now implemented (parameter -Y)
X    See %%PREFIX%%/%%DOCSDIR%%/ for usage manual.
X  - spamdb and spamlogd whiteexp times can now adjusted
X    with parameter -W
X
X
X !!!!!!!!!!!! --  I M P O T A N T  -  N O T E S  -- !!!!!!!!!!!!!!!!!
X
X  **** UPGRADE WARNING:  SYNC PROTOCOL CHANGED ****
X
X    The sync protocol has changed for versions > 4.1.x
X
X    If spamd is installed in distributed environment and sync is 
X    enabled, stop sync at every node until they are updated.
X  
X !!!!!!!!!!!! --  I M P O T A N T  -  N O T E S  -- !!!!!!!!!!!!!!!!!
X
X**********************************************************************
a49e29b24bc75611658944b7fa7eed6c
echo x - spamd/files/obspamd.in
sed 's/^X//' >spamd/files/obspamd.in << '530fbaf8736b1c1d86b61d65af13300d'
X#!/bin/sh
X#
X# $FreeBSD$
X#
X
X# PROVIDE: obspamd
X# REQUIRE: NETWORKING SERVERS syslogd named
X# BEFORE:  DAEMON
X# KEYWORD: shutdown
X
X#
X# Define these spamd_* variables in one of these files:
X#       /etc/rc.conf
X#       /etc/rc.conf.local
X#
X# obspamd_enable="YES"	# Run the spamd(8) daemon (YES/NO).
X# obspamd_flags=""	# Extra flags for spamd(8) (if enabled).
X#
X# DO NOT CHANGE THESE DEFAULT VALUES HERE
X#
Xobspamd_enable=${obspamd_enable:-"NO"}
X
X. %%RC_SUBR%%
X
Xname="obspamd"
Xrcvar=`set_rcvar`
X
Xcommand="%%PREFIX%%/libexec/%%SPAMDBIN%%"
Xstart_precmd="obspamd_precmd"
Xstart_postcmd="obspamd_postcmd"
Xrestart_postcmd="obspamd_postcmd"
Xstop_postcmd="obspamd_cleanup"
Xpidfile="/var/run/spamd.pid"
X
Xobspamd_precmd()
X{
X	_rc=0
X    # we need the white-space in the grep expr. to limit a failure
X    # in parsing the flags, for example if someone
X    # defined the word 'IP-based' in the banner.
X	echo "${obspamd_flags}" | grep " \-b" 2>&1 > /dev/null
X	if [ $? -eq 1 ]; then
X		/sbin/mount -p | grep 'fdescfs.*/dev/fd.*fdescfs.*rw' 2>&1 > /dev/null
X		_rc=${?}
X		if [ ${_rc} -ne 0 ]; then
X			echo "Unable to start spamd in greylisting mode"
X			echo ""
X			echo "Please mount fdescfs with the following line in /etc/fstab"
X			echo ""
X			echo "  fdescfs /dev/fd fdescfs rw 0 0"
X			echo ""
X		fi
X		return ${_rc}
X	fi
X}
X
Xobspamd_postcmd()
X{
X	if [ -x %%PREFIX%%/sbin/spamd-setup ]; then
X		if [ -r %%PREFIX%%/etc/spamd/spamd.conf ]; then
X			%%PREFIX%%/sbin/spamd-setup -D
X		fi
X	fi
X}
X
Xobspamd_cleanup()
X{
X	/bin/rm -f ${pidfile}
X}
X
Xload_rc_config $name
Xrun_rc_command "$1"
530fbaf8736b1c1d86b61d65af13300d
echo x - spamd/files/pkg-install.in
sed 's/^X//' >spamd/files/pkg-install.in << '5dca51c5dc7fbf26b542e9b2961d85ed'
X#!/bin/sh
X#
X#
X
XSPAMDDIR=%%SPAMDDIR%%
XSPAMDUSER=%%SPAMDUSER%%
XSPAMDGROUP=%%SPAMDGROUP%%
XSPAMDUID=%%SPAMDUID%%
XSPAMDGID=%%SPAMDGID%%
X
Xask() {
X  local question default answer
X
X  question=$1
X  default=$2
X  if [ -z "${PACKAGE_BUILDING}" ]; then
X    read -p "${question} [${default}]? " answer
X  fi
X  if [ "x${answer}" = "x" ]; then
X    answer=${default}
X  fi
X  echo ${answer}
X}
X
Xyesno() {
X  local default question answer
X
X  question=$1
X  default=$2
X  while :; do
X    answer=$(ask "${question}" "${default}")
X    case "${answer}" in
X      [Yy][Ee][Ss]|[Yy])
X        return 0
X        ;;
X      [Nn][Oo]|[Nn])
X        return 1
X        ;;
X    esac
X    echo "Please answer yes or no."
X   done
X}
X
Xcheck_db() {
X    DB=/var/db/spamd
X    if [ -f ${DB} ]; then
X        OWN=`ls -l ${DB} | awk '{print $3}'`
X        GRP=`ls -l ${DB} | awk '{print $4}'`
X        if [ "x${OWN}" != "x${SPAMDUSER}" ]; then
X            echo "change ${DB} owner to ${SPAMDUSER}"
X            /usr/sbin/chown ${SPAMDUSER} ${DB}
X        fi
X        if [ "x${GRP}" != "x${SPAMDGROUP}" ]; then
X            echo "change ${DB} group to ${SPAMDGROUP}"
X            /usr/sbin/chown :${SPAMDGROUP} ${DB}
X        fi
X    fi
X}
X
Xcheck_service() {
X    local name number type comment
X
X    name=$1
X    number=$2
X    type=$3
X    comment=$4
X
X    FILE="/etc/services"
X    # check
X    OK=no
X    HAS_SERVICE=no
X    COUNT=1
X    for i in `grep $name $FILE `; do
X    if [ $COUNT = 1 ] && [ X"$i" = X"$name" ]; then
X        HAS_SERVICE=yes
X    elif [ $COUNT = 2 ] && [ $HAS_SERVICE = yes ] && \
X        [ X"$i" = X"$number/$type" ]; then
X        OK=yes
X        break
X    fi
X    COUNT=`expr ${COUNT} + 1`
X    done
X    # add an entry for SERVICE to /etc/services
X    if [ $OK = no ]; then
X    echo "This system has no entry for $name in ${FILE}"
X    if yesno "Would you like to add it automatically?" y; then
X        mv ${FILE} ${FILE}.bak
X        (grep -v $name ${FILE}.bak ; \
X        echo "$name 	$number/$type 	# $comment") \
X        >> ${FILE}
X        rm ${FILE}.bak
X    else
X        echo "Please add '$name $number/$type' into ${FILE}, and try again."
X        return 1
X    fi
X    fi
X    return 0
X}
X
X
X# this msg is for users installing not from source,
X# - show msg about changed sync protocol
Xif [ "$2" = "PRE-INSTALL" ]; then
X echo "
X
X    **** UPGRADE WARNING:  SYNC PROTOCOL CHANGED ****
X
X    If you have spamd in distributed environment stop
X    sync between old (4.1.x) and this new version
X    until every node is updated
X
X    read UPDATING in your PORTSDIR
X
X    **** UPGRADE WARNING:  SYNC PROTOCOL CHANGED ****
X"
X    read -p "Hit ^c now to stop, any key to continue: " -t 5 a || true
X    echo ""
X    echo ""
Xfi
X
Xif [ "$2" = "PRE-INSTALL" ]; then
X  check_dbown=0
X  if /usr/sbin/pw group show "${SPAMDGROUP}" 2>&1 >/dev/null; then
X    echo "You already have a \"${SPAMDGROUP}\" group, so I will use it."
X    check_dbown=1
X  else
X    echo "You need a \"${SPAMDGROUP}\" group."
X    if yesno "Would you like me to create it" "YES"; then
X      /usr/sbin/pw groupadd "${SPAMDGROUP}" -g "${SPAMDGID}" -h - || \
X        /usr/sbin/pw groupadd "${SPAMDGROUP}" -h - || exit
X      echo "Done."
X      check_dbown=1
X    else
X      echo "Please create the \"${SPAMDGROUP}\" group manually and try again."
X      exit 1
X    fi
X  fi
X
X  if /usr/sbin/pw user show "${SPAMDUSER}" 2>&1 >/dev/null; then
X    echo "You already have a \"${SPAMDUSER}\" user, so I will use it."
X    check_dbown=1
X  else
X    echo "You need a \"${SPAMDUSER}\" user."
X    if yesno "Would you like me to create it" "YES"; then
X      /usr/sbin/pw useradd "${SPAMDUSER}" -u "${SPAMDUID}" -g "${SPAMDGROUP}" -h - -d "${SPAMDDIR}" \
X        -s /sbin/nologin -c "spamd pseudo-user" || \
X        /usr/sbin/pw useradd "${SPAMDUSER}" -g "${SPAMDGROUP}" -h - -d "${SPAMDDIR}" \
X        -s /sbin/nologin -c "spamd pseudo-user" || exit
X      check_dbown=1
X    else
X      echo "Please create the \"${SPAMDUSER}\" user manually and try again."
X      exit 1
X    fi
X  fi
X
X  if [ ${check_dbown} -eq 1 ]; then
X    check_db
X  fi
X
X  if ! check_service spamd 8025 tcp "spamd(8)"; then
X    exit 1
X  fi
X  if ! check_service spamd-cfg 8026 tcp "spamd(8) configuration"; then
X    exit 1
X  fi
X  if ! check_service spamd-sync 8025 udp "spamd(8) synchronisation"; then
X    exit 1
X  fi
X
Xfi
5dca51c5dc7fbf26b542e9b2961d85ed
echo x - spamd/files/obspamlogd.in
sed 's/^X//' >spamd/files/obspamlogd.in << '219e6669a896103752ecd16cc32241be'
X#!/bin/sh
X#
X# $FreeBSD$
X#
X
X# PROVIDE: obspamlogd
X# REQUIRE: NETWORKING SERVERS obspamd
X# BEFORE:  DAEMON
X# KEYWORD: shutdown
X
X#
X# Define these obspamlogd_* variables in one of these files:
X#       /etc/rc.conf
X#       /etc/rc.conf.local
X#
X# obspamlogd_enable="YES"	# Run the spamlogd(8) daemon (YES/NO).
X# obspamlogd_flags=""		# Extra flags for spamlogd(8) (if enabled).
X#
X# DO NOT CHANGE THESE DEFAULT VALUES HERE
X#
Xobspamlogd_enable=${obspamlogd_enable:-"NO"}
X
X. %%RC_SUBR%%
X
Xname="obspamlogd"
Xrcvar=`set_rcvar`
X
Xcommand="%%PREFIX%%/libexec/spamlogd"
Xstart_precmd="obspamlogd_precmd"
Xstop_postcmd="obspamlogd_cleanup"
Xpidfile="/var/run/spamlogd.pid"
X
Xobspamlogd_precmd()
X{
X	_rc=0
X	/sbin/mount -p | grep 'fdescfs.*/dev/fd.*fdescfs.*rw' 2>&1 > /dev/null
X	_rc=${?}
X	if [ ${_rc} -ne 0 ]; then
X		echo "Unable to start ${name}"
X		echo ""
X		echo "Please mount fdescfs with the following line in /etc/fstab"
X		echo ""
X		echo "  fdescfs /dev/fd fdescfs rw 0 0"
X		echo ""
X	fi
X	return ${_rc}
X}
X
Xobspamlogd_cleanup()
X{
X	/bin/rm -f ${pidfile}
X}
X
Xload_rc_config $name
Xrun_rc_command "$1"
219e6669a896103752ecd16cc32241be
echo x - spamd/distinfo
sed 's/^X//' >spamd/distinfo << '9b9bbd5c7289c0a89c90236b9040d542'
XMD5 (spamd-4.5.0.tar.gz) = ef501b144a8eadefc6971e53aef08f42
XSHA256 (spamd-4.5.0.tar.gz) = 52a8ae130b838b1b83a1025c5586ab78c6c4e364cd3089892858b83d4d62820f
XSIZE (spamd-4.5.0.tar.gz) = 52127
9b9bbd5c7289c0a89c90236b9040d542
echo x - spamd/pkg-descr
sed 's/^X//' >spamd/pkg-descr << 'e28d79389d8e5c2d2046ff7abea266f9'
XSpamd is a fake sendmail(8)-like daemon which rejects false mail. It is 
Xdesigned to be very efficient so that it does not slow down the receiving
Xmachine.
X
Xspamd considers sending hosts to be of three types:
X
X blacklisted hosts are redirected to spamd and tarpitted i.e. they are 
X communicated with very slowly to consume the sender's resources. Mail is
X rejected with either a 450 or 550 error message. A blacklisted host will not
X be allowed to talk to a real mail server.
X
X whitelisted hosts do not talk to spamd. Their connections are instead sent to
X a real mail server, such as sendmail(8).
X
X greylisted hosts are redirected to spamd, but spamd has not yet decided if
X they are likely spammers. They are given a temporary failure message by spamd
X when they try to deliver mail.
X
XWWW: http://freebsdspamd.berlios.de/
X
X-Alex <samm@os2.kiev.ua>
e28d79389d8e5c2d2046ff7abea266f9
echo x - spamd/Makefile
sed 's/^X//' >spamd/Makefile << 'bc7a9a2b75b1bc9a950e112d8c23a932'
X# New ports collection makefile for:    spamd
X# Date created:         04 April 2007
X# Whom:			Max Laier <max@love2party.net>
X#
X# $FreeBSD$
X#
X
XPORTNAME=	spamd
XPORTVERSION=	4.5.0
XCATEGORIES=	mail
XMASTER_SITES=	BERLIOS
XMASTER_SITE_SUBDIR=freebsdspamd
XDISTNAME=	${PORTNAME}-${PORTVERSION}
X
XMAINTAINER=	ohauer@gmx.de
XCOMMENT=	Traps spammers with a very slow smtp-login and return 4xx error
X
XUSE_RC_SUBR?=	obspamd obspamlogd
X
XSPAMDUSER?=	_spamd
XSPAMDGROUP?=	_spamd
XSPAMDDIR?=	/var/empty
X
XSPAMDUID=	132
XSPAMDGID=	${SPAMDUID}
X
XMAN5=		spamd.conf.5
XMAN8=		spamd.8 spamd-setup.8 spamdb.8 spamlogd.8
XPORTDOCS=	ipfw-spamd.txt spamdb.txt
X
XPLIST_DIRS=	etc/spamd
XPLIST_FILES=	libexec/spamlogd \
X		sbin/spamd-setup \
X		sbin/spamdb \
X		etc/spamd/spamd.conf.sample
X
XCONFIG_DIR=		${PREFIX}/etc/spamd
XSAMPLE_SPAMD_CONF=	${CONFIG_DIR}/spamd.conf.sample
X
XPLIST_SUB=	SPAMDDIR=${SPAMDDIR} \
X		SPAMDUSER=${SPAMDUSER} \
X		SPAMDGROUP=${SPAMDGROUP} \
X		SPAMDUID=${SPAMDUID} \
X		SPAMDGID=${SPAMDGID}
X
X# If you are a CPANEL user the this option is for you!
X# CPANEL sends periodic a 'kill -TERM spamd' to the SpamAssassin spamd, and
X# this kills also the OpenBSD spamd daemon.
X# With this option spamd will be installed as obspamd, and the rc script will
X# be adjusted. Man page and pid file will not be renamed!
X.if !defined(CPANEL)
XPLIST_FILES+=	libexec/spamd
XPLIST_SUB+=	SPAMDBIN=spamd
X.else
XPLIST_FILES+=	libexec/obspamd
XPLIST_SUB+=	SPAMDBIN=obspamd
X.endif
X
XSUB_FILES=	pkg-install \
X		pkg-deinstall \
X		pkg-message
X
XSUB_LIST=	PREFIX=${PREFIX} \
X		${PLIST_SUB}
X
Xpre-fetch:
X	@${ECHO} ""
X	@${ECHO} " **** UPGRADE WARNING:  SYNC PROTOCOL CHANGED ****"
X	@${ECHO} " If you have spamd in distributed environment stop"
X	@${ECHO} " sync between old (4.1.x) and new version"
X	@${ECHO} " until every node is updated"
X	@${ECHO} ""
X	@read -p "Hit ^c now to stop, any key to continue: " -t 5 a || true
X	@${ECHO} ""
X
Xpre-install:
X	@${SH} ${PKGINSTALL} ${DISTNAME} PRE-INSTALL
X
Xpost-install:
X	@${CAT} ${PKGMESSAGE}
X
Xdo-install:
X.if !defined(CPANEL)
X	${INSTALL_PROGRAM} ${WRKSRC}/spamd/spamd ${PREFIX}/libexec
X.else
X	${INSTALL_PROGRAM} ${WRKSRC}/spamd/spamd ${PREFIX}/libexec/obspamd
X.endif
X	${INSTALL_PROGRAM} ${WRKSRC}/spamlogd/spamlogd ${PREFIX}/libexec
X	${INSTALL_PROGRAM} ${WRKSRC}/spamd-setup/spamd-setup ${PREFIX}/sbin
X	${INSTALL_PROGRAM} ${WRKSRC}/spamdb/spamdb ${PREFIX}/sbin
X	${INSTALL_MAN} ${WRKSRC}/etc/spamd.conf.5 ${PREFIX}/man/man5
X	${INSTALL_MAN} ${WRKSRC}/spamd/spamd.8 ${PREFIX}/man/man8
X	${INSTALL_MAN} ${WRKSRC}/spamd-setup/spamd-setup.8 ${PREFIX}/man/man8
X	${INSTALL_MAN} ${WRKSRC}/spamdb/spamdb.8 ${PREFIX}/man/man8
X	${INSTALL_MAN} ${WRKSRC}/spamlogd/spamlogd.8 ${PREFIX}/man/man8
X	@if [ ! -d ${CONFIG_DIR} ]; then                        \
X		${MKDIR} ${CONFIG_DIR}; \
X	fi
X	@if [ ! -f ${SAMPLE_SPAMD_CONF} ]; then                 \
X		${ECHO_MSG} "Installing ${SAMPLE_SPAMD_CONF} file."; \
X		${ECHO_MSG} "${INSTALL_DATA} -v -p ${WRKSRC}/etc/spamd.conf ${SAMPLE_SPAMD_CONF}";                              \
X		${INSTALL_DATA} -v -p ${WRKSRC}/etc/spamd.conf  \
X		${SAMPLE_SPAMD_CONF};                           \
X	fi
X.if !defined(NOPORTDOCS)
X	@${MKDIR} ${DOCSDIR}
X	@${INSTALL_DATA} ${WRKSRC}/doc/ipfw-spamd.txt ${DOCSDIR}/
X	@${INSTALL_DATA} ${WRKSRC}/doc/spamdb.txt ${DOCSDIR}/
X.endif
X
X.include <bsd.port.mk>
bc7a9a2b75b1bc9a950e112d8c23a932
exit
--- spamd-4.5.0.shar ends here ---

--- patch_port_mail_spamd begins here ---
diff -Nru --exclude=.svn spamd.old/Makefile spamd/Makefile
--- spamd.old/Makefile
+++ spamd/Makefile
@@ -6,20 +6,15 @@
 #
 
 PORTNAME=	spamd
-PORTVERSION=	4.1.2
-PORTREVISION=	1
+PORTVERSION=	4.5.0
 CATEGORIES=	mail
 MASTER_SITES=	BERLIOS
 MASTER_SITE_SUBDIR=freebsdspamd
 DISTNAME=	${PORTNAME}-${PORTVERSION}
 
-MAINTAINER=	samm@os2.kiev.ua
+MAINTAINER=	ohauer@gmx.de
 COMMENT=	Traps spammers with a very slow smtp-login and return 4xx error
 
-.include <bsd.port.pre.mk>
-
-LOCAL_PFCTL=	/sbin/pfctl
-
 USE_RC_SUBR?=	obspamd obspamlogd
 
 SPAMDUSER?=	_spamd
@@ -31,11 +26,12 @@
 
 MAN5=		spamd.conf.5
 MAN8=		spamd.8 spamd-setup.8 spamdb.8 spamlogd.8
-PORTDOCS=	ipfw-spamd.txt
+PORTDOCS=	ipfw-spamd.txt spamdb.txt
 
 PLIST_DIRS=	etc/spamd
-PLIST_FILES=	libexec/spamd libexec/spamlogd \
-		sbin/spamd-setup sbin/spamdb \
+PLIST_FILES=	libexec/spamlogd \
+		sbin/spamd-setup \
+		sbin/spamdb \
 		etc/spamd/spamd.conf.sample
 
 CONFIG_DIR=		${PREFIX}/etc/spamd
@@ -47,6 +43,19 @@
 		SPAMDUID=${SPAMDUID} \
 		SPAMDGID=${SPAMDGID}
 
+# If you are a CPANEL user the this option is for you!
+# CPANEL sends periodic a 'kill -TERM spamd' to the SpamAssassin spamd, and
+# this kills also the OpenBSD spamd daemon.
+# With this option spamd will be installed as obspamd, and the rc script will
+# be adjusted. Man page and pid file will not be renamed!
+.if !defined(CPANEL)
+PLIST_FILES+=	libexec/spamd
+PLIST_SUB+=	SPAMDBIN=spamd
+.else
+PLIST_FILES+=	libexec/obspamd
+PLIST_SUB+=	SPAMDBIN=obspamd
+.endif
+
 SUB_FILES=	pkg-install \
 		pkg-deinstall \
 		pkg-message
@@ -54,6 +63,16 @@
 SUB_LIST=	PREFIX=${PREFIX} \
 		${PLIST_SUB}
 
+pre-fetch:
+	@${ECHO} ""
+	@${ECHO} " **** UPGRADE WARNING:  SYNC PROTOCOL CHANGED ****"
+	@${ECHO} " If you have spamd in distributed environment stop"
+	@${ECHO} " sync between old (4.1.x) and new version"
+	@${ECHO} " until every node is updated"
+	@${ECHO} ""
+	@read -p "Hit ^c now to stop, any key to continue: " -t 5 a || true
+	@${ECHO} ""
+
 pre-install:
 	@${SH} ${PKGINSTALL} ${DISTNAME} PRE-INSTALL
 
@@ -61,7 +80,11 @@
 	@${CAT} ${PKGMESSAGE}
 
 do-install:
+.if !defined(CPANEL)
 	${INSTALL_PROGRAM} ${WRKSRC}/spamd/spamd ${PREFIX}/libexec
+.else
+	${INSTALL_PROGRAM} ${WRKSRC}/spamd/spamd ${PREFIX}/libexec/obspamd
+.endif
 	${INSTALL_PROGRAM} ${WRKSRC}/spamlogd/spamlogd ${PREFIX}/libexec
 	${INSTALL_PROGRAM} ${WRKSRC}/spamd-setup/spamd-setup ${PREFIX}/sbin
 	${INSTALL_PROGRAM} ${WRKSRC}/spamdb/spamdb ${PREFIX}/sbin
@@ -82,6 +105,7 @@
 .if !defined(NOPORTDOCS)
 	@${MKDIR} ${DOCSDIR}
 	@${INSTALL_DATA} ${WRKSRC}/doc/ipfw-spamd.txt ${DOCSDIR}/
+	@${INSTALL_DATA} ${WRKSRC}/doc/spamdb.txt ${DOCSDIR}/
 .endif
 
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff -Nru --exclude=.svn spamd.old/distinfo spamd/distinfo
--- spamd.old/distinfo
+++ spamd/distinfo
@@ -1,3 +1,3 @@
-MD5 (spamd-4.1.2.tar.gz) = 0a207e997840359bde85ec4039e0d6a8
-SHA256 (spamd-4.1.2.tar.gz) = 49defbee42fe30c5f218351cc664e11328799b9893abe4528a17594d3ec97231
-SIZE (spamd-4.1.2.tar.gz) = 50199
+MD5 (spamd-4.5.0.tar.gz) = ef501b144a8eadefc6971e53aef08f42
+SHA256 (spamd-4.5.0.tar.gz) = 52a8ae130b838b1b83a1025c5586ab78c6c4e364cd3089892858b83d4d62820f
+SIZE (spamd-4.5.0.tar.gz) = 52127
diff -Nru --exclude=.svn spamd.old/files/obspamd.in spamd/files/obspamd.in
--- spamd.old/files/obspamd.in
+++ spamd/files/obspamd.in
@@ -25,16 +25,20 @@
 name="obspamd"
 rcvar=`set_rcvar`
 
-command="%%PREFIX%%/libexec/spamd"
+command="%%PREFIX%%/libexec/%%SPAMDBIN%%"
 start_precmd="obspamd_precmd"
 start_postcmd="obspamd_postcmd"
 restart_postcmd="obspamd_postcmd"
+stop_postcmd="obspamd_cleanup"
 pidfile="/var/run/spamd.pid"
 
 obspamd_precmd()
 {
 	_rc=0
-	echo "${obspamd_flags}" | grep "\-b" 2>&1 > /dev/null
+    # we need the white-space in the grep expr. to limit a failure
+    # in parsing the flags, for example if someone
+    # defined the word 'IP-based' in the banner.
+	echo "${obspamd_flags}" | grep " \-b" 2>&1 > /dev/null
 	if [ $? -eq 1 ]; then
 		/sbin/mount -p | grep 'fdescfs.*/dev/fd.*fdescfs.*rw' 2>&1 > /dev/null
 		_rc=${?}
@@ -54,10 +58,15 @@
 {
 	if [ -x %%PREFIX%%/sbin/spamd-setup ]; then
 		if [ -r %%PREFIX%%/etc/spamd/spamd.conf ]; then
-			%%PREFIX%%/sbin/spamd-setup &
+			%%PREFIX%%/sbin/spamd-setup -D
 		fi
 	fi
 }
 
+obspamd_cleanup()
+{
+	/bin/rm -f ${pidfile}
+}
+
 load_rc_config $name
 run_rc_command "$1"
diff -Nru --exclude=.svn spamd.old/files/obspamlogd.in spamd/files/obspamlogd.in
--- spamd.old/files/obspamlogd.in
+++ spamd/files/obspamlogd.in
@@ -26,7 +26,9 @@
 rcvar=`set_rcvar`
 
 command="%%PREFIX%%/libexec/spamlogd"
-start_precmd="${name}_precmd"
+start_precmd="obspamlogd_precmd"
+stop_postcmd="obspamlogd_cleanup"
+pidfile="/var/run/spamlogd.pid"
 
 obspamlogd_precmd()
 {
@@ -44,5 +46,10 @@
 	return ${_rc}
 }
 
+obspamlogd_cleanup()
+{
+	/bin/rm -f ${pidfile}
+}
+
 load_rc_config $name
 run_rc_command "$1"
diff -Nru --exclude=.svn spamd.old/files/patch-makefile spamd/files/patch-makefile
--- spamd.old/files/patch-makefile
+++ spamd/files/patch-makefile
@@ -1,13 +0,0 @@
---- spamlogd/Makefile.old	Mon Apr  2 01:33:46 2007
-+++ spamlogd/Makefile	Sat Jun 23 15:29:03 2007
-@@ -4,6 +4,10 @@
- SRCS=	spamlogd.c sync.c
- MAN=	spamlogd.8
- 
-+.if ${OSVERSION} < 601000
-+SRCS+=	../spamd/strtonum.c
-+.endif
-+
- CFLAGS+= -Wall -Wstrict-prototypes -I${.CURDIR}/../spamd
- LDADD+= -lpcap -lcrypto -lmd
- DPADD+= ${LIBPCAP} ${LIBMD}
diff -Nru --exclude=.svn spamd.old/files/patch-spamd__grey.c spamd/files/patch-spamd__grey.c
--- spamd.old/files/patch-spamd__grey.c
+++ spamd/files/patch-spamd__grey.c
@@ -1,68 +0,0 @@
---- spamd/grey.c.orig	2009-02-26 13:27:35.159368721 -0500
-+++ spamd/grey.c	2009-02-26 13:31:07.469474893 -0500
-@@ -376,7 +376,7 @@
- 	static char buf[MAX_MAIL];
- 	char *cp;
- 
--	if (*addr == '<');
-+	if (*addr == '<')
- 		addr++;
- 	(void) strlcpy(buf, addr, sizeof(buf));
- 	cp = strrchr(buf, '>');
-@@ -398,8 +398,11 @@
- 	size_t len;
- 	struct mail_addr *m;
- 
--	while (!SLIST_EMPTY(&match_suffix))
-+	while (!SLIST_EMPTY(&match_suffix)) {
-+		m = SLIST_FIRST(&match_suffix);
- 		SLIST_REMOVE_HEAD(&match_suffix, entry);
-+		free(m);
-+	}
- 	if ((fp = fopen(alloweddomains_file, "r")) != NULL) {
- 		while ((buf = fgetln(fp, &len))) {
- #ifdef __FreeBSD__
-@@ -410,11 +413,11 @@
- 				buf++;
- 				len--;
- 			}
-+			if (len == 0)
-+				continue;
- 			/* jump over comments and blank lines */
- 			if (*buf == '#' || *buf == '\n')
- 				continue;
--			if (len == 0)
--				continue;
- #endif
- 			if (buf[len-1] == '\n')
- 				len--;
-@@ -434,8 +437,11 @@
- 	}
- 	return;
- bad:
--	while (!SLIST_EMPTY(&match_suffix))
-+	while (!SLIST_EMPTY(&match_suffix)) {
-+		m = SLIST_FIRST(&match_suffix);
- 		SLIST_REMOVE_HEAD(&match_suffix, entry);
-+		free(m);
-+	}
- }
- 
- void
-@@ -609,6 +615,7 @@
- 		dbc->act = 0;
- 		dbc->dsiz = 0;
- 		SLIST_REMOVE_HEAD(&db_changes, entry);
-+		free(dbc);
- 
- 	}
- 	return(ret);
-@@ -795,7 +802,7 @@
- 
- 	now = time(NULL);
- 	/* expiry times have to be in the future */
--	expire = strtonum(expires, now, UINT_MAX, NULL);
-+	expire = strtonum(expires, now, INT_MAX, NULL);
- 	if (expire == 0)
- 		return(-1);
- 
diff -Nru --exclude=.svn spamd.old/files/patch-spamlogd spamd/files/patch-spamlogd
--- spamd.old/files/patch-spamlogd
+++ spamd/files/patch-spamlogd
@@ -1,15 +0,0 @@
---- spamlogd/spamlogd.c.orig	Sat Jun 23 15:28:14 2007
-+++ spamlogd/spamlogd.c	Sat Jun 23 15:28:27 2007
-@@ -158,10 +158,12 @@
- 
- 	pcap_freecode(&bpfp);
- 
-+#ifdef BIOCLOCK
- 	if (ioctl(pcap_fileno(hpcap), BIOCLOCK) < 0) {
- 		logmsg(LOG_ERR, "BIOCLOCK: %s", strerror(errno));
- 		return (-1);
- 	}
-+#endif
- 
- 	return (0);
- }
diff -Nru --exclude=.svn spamd.old/files/pkg-deinstall.in spamd/files/pkg-deinstall.in
--- spamd.old/files/pkg-deinstall.in
+++ spamd/files/pkg-deinstall.in
@@ -16,6 +16,8 @@
   fi
 
   if [ -e "${SPAMDDIR}" ]; then
-    echo "You should manually remove the \"${SPAMDDIR}\" directory."
+    if [ "${SPAMDDIR}" != "/var/empty" ]; then
+       echo "You should manually remove the \"${SPAMDDIR}\" directory."
+    fi
   fi
 fi
diff -Nru --exclude=.svn spamd.old/files/pkg-install.in spamd/files/pkg-install.in
--- spamd.old/files/pkg-install.in
+++ spamd/files/pkg-install.in
@@ -41,56 +41,95 @@
    done
 }
 
+check_db() {
+    DB=/var/db/spamd
+    if [ -f ${DB} ]; then
+        OWN=`ls -l ${DB} | awk '{print $3}'`
+        GRP=`ls -l ${DB} | awk '{print $4}'`
+        if [ "x${OWN}" != "x${SPAMDUSER}" ]; then
+            echo "change ${DB} owner to ${SPAMDUSER}"
+            /usr/sbin/chown ${SPAMDUSER} ${DB}
+        fi
+        if [ "x${GRP}" != "x${SPAMDGROUP}" ]; then
+            echo "change ${DB} group to ${SPAMDGROUP}"
+            /usr/sbin/chown :${SPAMDGROUP} ${DB}
+        fi
+    fi
+}
+
 check_service() {
     local name number type comment
-    
+
     name=$1
     number=$2
     type=$3
     comment=$4
-    
+
     FILE="/etc/services"
     # check
     OK=no
     HAS_SERVICE=no
     COUNT=1
     for i in `grep $name $FILE `; do
-	if [ $COUNT = 1 ] && [ X"$i" = X"$name" ]; then
-	    HAS_SERVICE=yes
-	elif [ $COUNT = 2 ] && [ $HAS_SERVICE = yes ] && \
-		[ X"$i" = X"$number/$type" ]; then
-	    OK=yes
-	    break
-	fi
-	COUNT=`expr ${COUNT} + 1`
+    if [ $COUNT = 1 ] && [ X"$i" = X"$name" ]; then
+        HAS_SERVICE=yes
+    elif [ $COUNT = 2 ] && [ $HAS_SERVICE = yes ] && \
+        [ X"$i" = X"$number/$type" ]; then
+        OK=yes
+        break
+    fi
+    COUNT=`expr ${COUNT} + 1`
     done
     # add an entry for SERVICE to /etc/services
     if [ $OK = no ]; then
-	echo "This system has no entry for $name in ${FILE}"
-	if yesno "Would you like to add it automatically?" y; then
-	    mv ${FILE} ${FILE}.bak
-	    (grep -v $name ${FILE}.bak ; \
-		echo "$name	$number/$type	# $comment") \
-		>> ${FILE}
-	    rm ${FILE}.bak
-	else
-	    echo "Please add '$name $number/$type' into ${FILE}, and try again."
-	    return 1
-	fi
+    echo "This system has no entry for $name in ${FILE}"
+    if yesno "Would you like to add it automatically?" y; then
+        mv ${FILE} ${FILE}.bak
+        (grep -v $name ${FILE}.bak ; \
+        echo "$name 	$number/$type 	# $comment") \
+        >> ${FILE}
+        rm ${FILE}.bak
+    else
+        echo "Please add '$name $number/$type' into ${FILE}, and try again."
+        return 1
+    fi
     fi
     return 0
 }
 
 
+# this msg is for users installing not from source,
+# - show msg about changed sync protocol
 if [ "$2" = "PRE-INSTALL" ]; then
+ echo "
+
+    **** UPGRADE WARNING:  SYNC PROTOCOL CHANGED ****
+
+    If you have spamd in distributed environment stop
+    sync between old (4.1.x) and this new version
+    until every node is updated
+
+    read UPDATING in your PORTSDIR
+
+    **** UPGRADE WARNING:  SYNC PROTOCOL CHANGED ****
+"
+    read -p "Hit ^c now to stop, any key to continue: " -t 5 a || true
+    echo ""
+    echo ""
+fi
+
+if [ "$2" = "PRE-INSTALL" ]; then
+  check_dbown=0
   if /usr/sbin/pw group show "${SPAMDGROUP}" 2>&1 >/dev/null; then
     echo "You already have a \"${SPAMDGROUP}\" group, so I will use it."
+    check_dbown=1
   else
     echo "You need a \"${SPAMDGROUP}\" group."
     if yesno "Would you like me to create it" "YES"; then
       /usr/sbin/pw groupadd "${SPAMDGROUP}" -g "${SPAMDGID}" -h - || \
         /usr/sbin/pw groupadd "${SPAMDGROUP}" -h - || exit
       echo "Done."
+      check_dbown=1
     else
       echo "Please create the \"${SPAMDGROUP}\" group manually and try again."
       exit 1
@@ -99,6 +138,7 @@
 
   if /usr/sbin/pw user show "${SPAMDUSER}" 2>&1 >/dev/null; then
     echo "You already have a \"${SPAMDUSER}\" user, so I will use it."
+    check_dbown=1
   else
     echo "You need a \"${SPAMDUSER}\" user."
     if yesno "Would you like me to create it" "YES"; then
@@ -106,12 +146,17 @@
         -s /sbin/nologin -c "spamd pseudo-user" || \
         /usr/sbin/pw useradd "${SPAMDUSER}" -g "${SPAMDGROUP}" -h - -d "${SPAMDDIR}" \
         -s /sbin/nologin -c "spamd pseudo-user" || exit
+      check_dbown=1
     else
       echo "Please create the \"${SPAMDUSER}\" user manually and try again."
       exit 1
     fi
   fi
 
+  if [ ${check_dbown} -eq 1 ]; then
+    check_db
+  fi
+
   if ! check_service spamd 8025 tcp "spamd(8)"; then
     exit 1
   fi
diff -Nru --exclude=.svn spamd.old/files/pkg-message.in spamd/files/pkg-message.in
--- spamd.old/files/pkg-message.in
+++ spamd/files/pkg-message.in
@@ -20,23 +20,22 @@
   rdr pass inet proto tcp from any to any \
       port smtp -> 127.0.0.1 port spamd
 
+New features:
+  - sync for spamdb is now implemented (parameter -Y)
+    See %%PREFIX%%/%%DOCSDIR%%/ for usage manual.
+  - spamdb and spamlogd whiteexp times can now adjusted
+    with parameter -W
+
+
  !!!!!!!!!!!! --  I M P O T A N T  -  N O T E S  -- !!!!!!!!!!!!!!!!!
- !
- ! changes in Ver. 4.1.x:
- !  - UID/GID is reserved to: _spamd:_spamd
- !    check the owner of /var/db/spamd
- !  - greylisting is now the default
- !  - paramer: -b is now blacklist (Ver. < 4.1.x it is bind address)
- !  - paramer: -l is now listen address
- !  - spamdb: format is now HASH, helo/ehlo is also stored in db
- !    convert will be done at the first start of spamd
- !    if you have scripts that use spamdb review this scripts
- !  - config files: new location is %%PREFIX%%/etc/spamd
- !  - spamtrapp addresses: remove the surrounding '< >' signs
- !  - pfspamd.sh was renamed to the obspamd
- !  - IPFW support (beta) added to the sources.
- !    See %%PREFIX%%/%%DOCSDIR%%/spamd-ipfw.txt for usage manual.
- !
+
+  **** UPGRADE WARNING:  SYNC PROTOCOL CHANGED ****
+
+    The sync protocol has changed for versions > 4.1.x
+
+    If spamd is installed in distributed environment and sync is 
+    enabled, stop sync at every node until they are updated.
+  
  !!!!!!!!!!!! --  I M P O T A N T  -  N O T E S  -- !!!!!!!!!!!!!!!!!
 
 **********************************************************************
--- patch_port_mail_spamd ends here ---


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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090719204445.EDE0E2613F>