1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-11 07:22:22 +00:00

- Update to 4.5.0

- Pass maintainer to submitter
- Add CPANEL support so it doesn't clobber spamd (see comments in Makefile)
- Fixes to RC script to support CPANEL option and general cleanup.

PR:		ports/136912
Submitted by:	olli hauer <ohauer@gmx.de>
Approved by:	Alex Samorukov <samm@os2.kiev.ua> (old maintainer)
This commit is contained in:
Wesley Shields 2009-07-23 12:52:44 +00:00
parent d80c737e25
commit 910a3cec56
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=238238
10 changed files with 142 additions and 152 deletions

View File

@ -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 @@ SPAMDGID= ${SPAMDUID}
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 @@ PLIST_SUB= SPAMDDIR=${SPAMDDIR} \
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_FILES= pkg-install \
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 @@ post-install:
@${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 @@ do-install:
.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>

View File

@ -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

View File

@ -25,16 +25,20 @@ obspamd_enable=${obspamd_enable:-"NO"}
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 @@ obspamd_postcmd()
{
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"

View File

@ -26,7 +26,9 @@ name="obspamlogd"
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 @@ obspamlogd_precmd()
return ${_rc}
}
obspamlogd_cleanup()
{
/bin/rm -f ${pidfile}
}
load_rc_config $name
run_rc_command "$1"

View File

@ -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}

View File

@ -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);

View File

@ -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);
}

View File

@ -16,6 +16,8 @@ if [ "$2" = "POST-DEINSTALL" ]; then
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

View File

@ -41,56 +41,95 @@ yesno() {
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 [ "$2" = "PRE-INSTALL" ]; then
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 @@ if [ "$2" = "PRE-INSTALL" ]; then
-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

View File

@ -20,23 +20,22 @@ To enable spamd you need:
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 -- !!!!!!!!!!!!!!!!!
**********************************************************************