From owner-freebsd-ports-bugs@FreeBSD.ORG Sun Jun 3 17:00:19 2007 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C7FE316A421 for ; Sun, 3 Jun 2007 17:00:19 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id 7D6A813C458 for ; Sun, 3 Jun 2007 17:00:19 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l53H0JE1003999 for ; Sun, 3 Jun 2007 17:00:19 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l53H0J2q003997; Sun, 3 Jun 2007 17:00:19 GMT (envelope-from gnats) Date: Sun, 3 Jun 2007 17:00:19 GMT Message-Id: <200706031700.l53H0J2q003997@freefall.freebsd.org> To: freebsd-ports-bugs@FreeBSD.org From: Alex Samorukov Cc: Subject: Re: ports/113293: [MAINTAINER] mail/spamd: update to 4.1.1 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Alex Samorukov List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jun 2007 17:00:19 -0000 The following reply was made to PR ports/113293; it has been noted by GNATS. From: Alex Samorukov To: bug-followup@FreeBSD.org, samm@os2.kiev.ua Cc: Subject: Re: ports/113293: [MAINTAINER] mail/spamd: update to 4.1.1 Date: Sun, 03 Jun 2007 19:24:55 +0300 This is a multi-part message in MIME format. --------------000201060000070301060405 Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit updated diff, withot "work" directory trash -- Best regards, Alex Samorukov, SAMM1-RIPE Zend Certified PHP Engineer --------------000201060000070301060405 Content-Type: text/plain; name="diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diff" diff -urN /usr/ports/mail/spamd/Makefile /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/Makefile --- /usr/ports/mail/spamd/Makefile Tue Mar 20 17:16:44 2007 +++ /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/Makefile Sun Jun 3 18:49:28 2007 @@ -1,75 +1,90 @@ -# New ports collection makefile for: spamd -# Date created: 23 June 2003 +# New ports collection makefile for: spamd +# Date created: 04 April 2007 # Whom: Max Laier # -# $FreeBSD: ports/mail/spamd/Makefile,v 1.12 2007/03/20 15:16:44 delphij Exp $ +# $FreeBSD$ # PORTNAME= spamd -PORTVERSION= 3.7 -PORTREVISION= 3 +PORTVERSION= 4.1.1 CATEGORIES= mail -MASTER_SITES= ${MASTER_SITE_LOCAL} -MASTER_SITE_SUBDIR= delphij -DISTNAME= ${PORTNAME}_${PORTVERSION} +MASTER_SITES= BERLIOS +MASTER_SITE_SUBDIR=freebsdspamd +DISTNAME= ${PORTNAME}-${PORTVERSION} MAINTAINER= samm@os2.kiev.ua COMMENT= Traps spammers with a very slow smtp-login and return 4xx error -USE_BZIP2= yes - .include -.if defined(WITH_IPFW) -CFLAGS+= -DIPFW -.if ${OSVERSION} < 490000 -BROKEN= IPFW with Tables is required for this port to function properly -.endif -.else .if ${OSVERSION} < 502117 BROKEN= OpenBSD 3.5 pf/pfctl is necessary for this port to function properly. .else LOCAL_PFCTL= /sbin/pfctl .endif -.endif -USE_RC_SUBR= pfspamd.sh +USE_RC_SUBR?= obspamd obspamlogd -.if !defined(BATCH) && !defined(PACKAGE_BUILDING) -IS_INTERACTIVE= yes -.endif +SPAMDUSER?= _spamd +SPAMDGROUP?= _spamd +SPAMDDIR?= /var/empty + +SPAMDUID= 132 +SPAMDGID= ${SPAMDUID} MAN5= spamd.conf.5 MAN8= spamd.8 spamd-setup.8 spamdb.8 spamlogd.8 +PORTDOCS= ipfw-spamd.txt -SAMPLE_SPAMD_CONF= ${PREFIX}/etc/spamd.conf.sample +PLIST_DIRS= etc/spamd +PLIST_FILES= libexec/spamd libexec/spamlogd \ + sbin/spamd-setup sbin/spamdb \ + etc/spamd/spamd.conf.sample + +CONFIG_DIR= ${PREFIX}/etc/spamd +SAMPLE_SPAMD_CONF= ${CONFIG_DIR}/spamd.conf.sample + +PLIST_SUB= SPAMDDIR=${SPAMDDIR} \ + SPAMDUSER=${SPAMDUSER} \ + SPAMDGROUP=${SPAMDGROUP} \ + SPAMDUID=${SPAMDUID} \ + SPAMDGID=${SPAMDGID} + +SUB_FILES= pkg-install \ + pkg-deinstall \ + pkg-message -post-patch: - @${REINPLACE_CMD} -e 's|%%LOCAL_PFCTL%%|${LOCAL_PFCTL}|; \ - s|%%LOCAL_SPAMD_CONF%%|${PREFIX}/etc/spamd.conf|' \ - ${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 - -pre-su-install: -.if !defined(BATCH) && !defined(PACKAGE_BUILDING) - @${SETENV} PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL -.endif +SUB_LIST= PREFIX=${PREFIX} \ + ${PLIST_SUB} + +pre-install: + @${SH} ${PKGINSTALL} ${DISTNAME} PRE-INSTALL + +post-install: + @${CAT} ${PKGMESSAGE} do-install: ${INSTALL_PROGRAM} ${WRKSRC}/spamd/spamd ${PREFIX}/libexec ${INSTALL_PROGRAM} ${WRKSRC}/spamlogd/spamlogd ${PREFIX}/libexec ${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}/etc/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 ${INSTALL_MAN} ${WRKSRC}/spamlogd/spamlogd.8 ${PREFIX}/man/man8 - @if [ ! -f ${SAMPLE_SPAMD_CONF} ]; then \ + @if [ ! -d ${CONFIG_DIR} ]; then \ + ${MKDIR} ${CONFIG_DIR}; \ + fi + @if [ ! -f ${SAMPLE_SPAMD_CONF} ]; then \ ${ECHO_MSG} "Installing ${SAMPLE_SPAMD_CONF} file."; \ - ${INSTALL_DATA} ${WRKSRC}/doc/spamd.conf \ - ${SAMPLE_SPAMD_CONF}; \ + ${ECHO_MSG} "${INSTALL_DATA} -v -p ${WRKSRC}/etc/spamd.conf ${SAMPLE_SPAMD_CONF}"; \ + ${INSTALL_DATA} -v -p ${WRKSRC}/etc/spamd.conf \ + ${SAMPLE_SPAMD_CONF}; \ fi +.if !defined(NOPORTDOCS) + @${MKDIR} ${DOCSDIR} + @${INSTALL_DATA} ${WRKSRC}/doc/ipfw-spamd.txt ${DOCSDIR}/ +.endif .include diff -urN /usr/ports/mail/spamd/distinfo /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/distinfo --- /usr/ports/mail/spamd/distinfo Sun Jan 22 14:50:50 2006 +++ /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/distinfo Sun Jun 3 18:49:28 2007 @@ -1,3 +1,3 @@ -MD5 (spamd_3.7.tar.bz2) = e1d96b9d7b1d4189dca510ff0000383f -SHA256 (spamd_3.7.tar.bz2) = a06ad07ead38240f13ea01c5d0315179e7089ed8fb8fe6544b1860bd8cfdc355 -SIZE (spamd_3.7.tar.bz2) = 28066 +MD5 (spamd-4.1.1.tar.gz) = 6cf6a92b709e1907162fd1c59af7943a +SHA256 (spamd-4.1.1.tar.gz) = b6e8b00ec0b3ff5ff3e73de2fab3f3bbbd3d95807ef1a946a6302666d17c503a +SIZE (spamd-4.1.1.tar.gz) = 50179 diff -urN /usr/ports/mail/spamd/files/obspamd.in /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/files/obspamd.in --- /usr/ports/mail/spamd/files/obspamd.in Thu Jan 1 03:00:00 1970 +++ /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/files/obspamd.in Mon Apr 23 18:33:35 2007 @@ -0,0 +1,70 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: obspamd +# REQUIRE: NETWORKING SERVERS +# BEFORE: DAEMON +# KEYWORD: shutdown + +# +# Define these spamd_* variables in one of these files: +# /etc/rc.conf +# /etc/rc.conf.local +# +# obspamd_enable="YES" # Run the spamd(8) daemon (YES/NO). +# obspamd_flags="" # Extra flags for spamd(8) (if enabled). +# +# DO NOT CHANGE THESE DEFAULT VALUES HERE +# +obspamd_enable=${obspamd_enable:-"NO"} +obspamd_flags=${obspamd_flags:-""} + +. %%RC_SUBR%% + +name="obspamd" +rcvar=`set_rcvar` + +command="%%PREFIX%%/libexec/spamd" +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 + if [ $? -eq 1 ]; then + /sbin/mount -p | grep 'fdescfs.*/dev/fd.*fdescfs.*rw' 2>&1 > /dev/null + _rc=${?} + if [ ${_rc} -ne 0 ]; then + echo "Unable to start spamd in greylisting mode" + echo "" + echo "Please mount fdescfs with the following line in /etc/fstab" + echo "" + echo " fdescfs /dev/fd fdescfs rw 0 0" + echo "" + fi + return ${_rc} + fi +} + +obspamd_postcmd() +{ + if [ -x %%PREFIX%%/sbin/spamd-setup ]; then + if [ -r %%PREFIX%%/etc/spamd/spamd.conf ]; then + %%PREFIX%%/sbin/spamd-setup & + fi + fi +} + +obspamd_cleanup() +{ + /bin/rm -f ${pidfile} +} + +load_rc_config $name +run_rc_command "$1" diff -urN /usr/ports/mail/spamd/files/obspamlogd.in /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/files/obspamlogd.in --- /usr/ports/mail/spamd/files/obspamlogd.in Thu Jan 1 03:00:00 1970 +++ /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/files/obspamlogd.in Mon Apr 23 18:33:35 2007 @@ -0,0 +1,56 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: obspamlogd +# REQUIRE: NETWORKING SERVERS obspamd +# BEFORE: DAEMON +# KEYWORD: shutdown + +# +# Define these obspamlogd_* variables in one of these files: +# /etc/rc.conf +# /etc/rc.conf.local +# +# obspamlogd_enable="YES" # Run the spamlogd(8) daemon (YES/NO). +# obspamlogd_flags="" # Extra flags for spamlogd(8) (if enabled). +# +# DO NOT CHANGE THESE DEFAULT VALUES HERE +# +obspamlogd_enable=${obspamlogd_enable:-"NO"} +obspamlogd_flags=${obspamlogd_flags:-""} + +. %%RC_SUBR%% + +name="obspamlogd" +rcvar=`set_rcvar` + +command="%%PREFIX%%/libexec/spamlogd" +start_precmd="obspamlogd_precmd" +stop_postcmd="obspamlogd_cleanup" +pidfile="/var/run/spamlogd.pid" + +obspamlogd_precmd() +{ + _rc=0 + /sbin/mount -p | grep 'fdescfs.*/dev/fd.*fdescfs.*rw' 2>&1 > /dev/null + _rc=${?} + if [ ${_rc} -ne 0 ]; then + echo "Unable to start ${name}" + echo "" + echo "Please mount fdescfs with the following line in /etc/fstab" + echo "" + echo " fdescfs /dev/fd fdescfs rw 0 0" + echo "" + fi + return ${_rc} +} + +obspamlogd_cleanup() +{ + /bin/rm -f ${pidfile} +} + +load_rc_config $name +run_rc_command "$1" diff -urN /usr/ports/mail/spamd/files/patch-greyc /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/files/patch-greyc --- /usr/ports/mail/spamd/files/patch-greyc Tue May 2 11:54:50 2006 +++ /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/files/patch-greyc Thu Jan 1 03:00:00 1970 @@ -1,131 +0,0 @@ ---- spamd/grey.c Wed Apr 13 03:22:17 2005 -+++ spamd/grey.c Mon Mar 20 15:26:18 2006 -@@ -39,6 +39,10 @@ - #include - #include - -+#ifdef IPFW -+#include -+#endif -+ - #include "grey.h" - - extern time_t passtime, greyexp, whiteexp, trapexp; -@@ -65,13 +69,17 @@ - char *traplist_msg = "\"Your address %A has mailed to spamtraps here\\n\""; - - pid_t db_pid = -1; --int pfdev; - int spamdconf; - -+#ifdef IPFW -+extern int tabno; -+#else -+int pfdev; - static char *pargv[11]= { - "pfctl", "-p", "/dev/pf", "-q", "-t", - "spamd-white", "-T", "replace", "-f" "-", NULL - }; -+#endif - - /* If the parent gets a signal, kill off the children and exit */ - /* ARGSUSED */ -@@ -104,6 +112,7 @@ - return(0); - } - -+#ifndef IPFW - int - configure_pf(char **addrs, int count) - { -@@ -166,11 +175,54 @@ - for (i = 0; i < count; i++) - if (addrs[i] != NULL) - fprintf(pf, "%s/32\n", addrs[i]); -+ - fclose(pf); - waitpid(pid, NULL, 0); - sigaction(SIGCHLD, &sa, NULL); - return(0); - } -+#else -+int -+configure_pf(char **addrs, int count) -+{ -+ static int s = -1; -+ ipfw_table_entry ent; -+ int i; -+ -+ if (s == -1) -+ s = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); -+ if (s < 0) -+ { -+ syslog_r(LOG_INFO, &sdata, "IPFW socket unavailable (%m)"); -+ return(-1); -+ } -+ -+ /* flush the table */ -+ ent.tbl = tabno; -+ if (setsockopt(s, IPPROTO_IP, IP_FW_TABLE_FLUSH, &ent.tbl, sizeof(ent.tbl)) < 0) -+ { -+ syslog_r(LOG_INFO, &sdata, "IPFW setsockopt(IP_FW_TABLE_FLUSH) (%m)"); -+ return(-1); -+ } -+ -+ for (i = 0; i < count; i++) -+ if (addrs[i] != NULL) -+ { -+ /* add addrs[i] to tabno */ -+ ent.tbl = tabno; -+ ent.masklen = 32; -+ ent.value = 0; -+ inet_aton(addrs[i], (struct in_addr *)&ent.addr); -+ if (setsockopt(s, IPPROTO_IP, IP_FW_TABLE_ADD, &ent, sizeof(ent)) < 0) -+ { -+ syslog_r(LOG_INFO, &sdata, "IPFW setsockopt(IP_FW_TABLE_ADD) (%m)"); -+ return(-1); -+ } -+ } -+ -+ return(0); -+} -+#endif - - void - freeaddrlists(void) -@@ -590,11 +642,13 @@ - int i; - struct sigaction sa; - -+#ifndef IPFW - pfdev = open("/dev/pf", O_RDWR); - if (pfdev == -1) { - syslog_r(LOG_ERR, &sdata, "open of /dev/pf failed (%m)"); - exit(1); - } -+#endif - - /* check to see if /var/db/spamd exists, if not, create it */ - if ((i = open(PATH_SPAMD_DB, O_RDWR, 0)) == -1 && errno == ENOENT) { -@@ -636,7 +690,9 @@ - * child, talks to jailed spamd over greypipe, - * updates db. has no access to pf. - */ -+#ifndef IPFW - close(pfdev); -+#endif - setproctitle("(%s update)", PATH_SPAMD_DB); - greyreader(); - /* NOTREACHED */ -@@ -655,7 +711,11 @@ - sigaction(SIGCHLD, &sa, NULL); - sigaction(SIGINT, &sa, NULL); - -+#ifndef IPFW - setproctitle("(pf update)"); -+#else -+ setproctitle("(ipfw white table update)"); -+#endif - greyscanner(); - /* NOTREACHED */ - exit(1); diff -urN /usr/ports/mail/spamd/files/patch-greyh /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/files/patch-greyh --- /usr/ports/mail/spamd/files/patch-greyh Tue May 2 11:54:50 2006 +++ /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/files/patch-greyh Thu Jan 1 03:00:00 1970 @@ -1,10 +0,0 @@ ---- spamd/grey.h Thu Mar 16 19:55:33 2006 -+++ spamd/grey.h Thu Mar 16 19:55:56 2006 -@@ -22,6 +22,7 @@ - #define WHITEEXP (60 * 60 * 24 * 36) /* remove white entries after 36 days */ - #define TRAPEXP (60 * 60 * 24) /* hitting a spamtrap blacklists for a day */ - #define PATH_PFCTL "/sbin/pfctl" -+#define PATH_IPFW "/sbin/ipfw" - #define DB_SCAN_INTERVAL 60 - #define PATH_SPAMD_DB "/var/db/spamd" - diff -urN /usr/ports/mail/spamd/files/patch-spamd /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/files/patch-spamd --- /usr/ports/mail/spamd/files/patch-spamd Tue May 2 11:54:50 2006 +++ /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/files/patch-spamd Thu Jan 1 03:00:00 1970 @@ -1,48 +0,0 @@ ---- spamd/spamd.c Thu Mar 16 20:56:45 2006 -+++ spamd/spamd.c Thu Mar 16 21:07:11 2006 -@@ -123,6 +123,10 @@ - pid_t jail_pid = -1; - u_short cfg_port; - -+#ifdef IPFW -+int tabno=1; -+#endif -+ - extern struct sdlist *blacklists; - - int conffd = -1; -@@ -153,6 +157,10 @@ - " [-G mins:hours:hours] [-n name] [-p port]\n"); - fprintf(stderr, - " [-r reply] [-s secs] [-w window]\n"); -+#ifdef IPFW -+ fprintf(stderr, -+ " [-t table_no]\n"); -+#endif - exit(1); - } - -@@ -958,7 +966,11 @@ - if (gethostname(hostname, sizeof hostname) == -1) - err(1, "gethostname"); - -+#ifdef IPFW -+ while ((ch = getopt(argc, argv, "45b:c:B:p:dgG:r:s:n:vw:t:")) != -1) { -+#else - while ((ch = getopt(argc, argv, "45b:c:B:p:dgG:r:s:n:vw:")) != -1) { -+#endif - switch (ch) { - case '4': - nreply = "450"; -@@ -1015,6 +1027,11 @@ - case 'v': - verbose = 1; - break; -+#ifdef IPFW -+ case 't': -+ tabno = atoi(optarg); -+ break; -+#endif - case 'w': - window = atoi(optarg); - if (window <= 0) diff -urN /usr/ports/mail/spamd/files/patch-spamd-setup /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/files/patch-spamd-setup --- /usr/ports/mail/spamd/files/patch-spamd-setup Sun Mar 25 20:24:07 2007 +++ /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/files/patch-spamd-setup Thu Jan 1 03:00:00 1970 @@ -1,110 +0,0 @@ ---- spamd-setup/spamd-setup.c.orig Wed Apr 13 01:18:59 2005 -+++ spamd-setup/spamd-setup.c Wed May 10 01:55:13 2006 -@@ -41,6 +41,11 @@ - #include - #include - -+#ifdef IPFW -+#include -+#include -+#endif -+ - #define PATH_FTP "/usr/bin/ftp" - #define PATH_PFCTL "%%LOCAL_PFCTL%%" - #define PATH_SPAMD_CONF "%%LOCAL_SPAMD_CONF%%" -@@ -93,6 +98,11 @@ - int debug; - int dryrun; - -+#ifdef IPFW -+int tabno=2; -+#endif -+ -+ - u_int32_t - imask(u_int8_t b) - { -@@ -630,6 +640,7 @@ - } - - -+#ifndef IPFW - int - configure_pf(struct cidr **blacklists) - { -@@ -676,6 +687,51 @@ - } - return(0); - } -+#else -+int -+configure_pf(struct cidr **blacklists) -+{ -+ static int s = -1; -+ ipfw_table_entry ent; -+ -+ if (s == -1) -+ s = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); -+ if (s < 0) -+ { -+ err(1, "IPFW socket unavailable"); -+ return(-1); -+ } -+ -+ /* flush the table */ -+ ent.tbl = tabno; -+ if (setsockopt(s, IPPROTO_IP, IP_FW_TABLE_FLUSH, &ent.tbl, sizeof(ent.tbl)) < 0) -+ { -+ err(1, "IPFW setsockopt(IP_FW_TABLE_FLUSH)"); -+ return(-1); -+ } -+ -+ while (*blacklists != NULL) { -+ struct cidr *b = *blacklists; -+ -+ while (b->addr != 0) { -+ /* add b to tabno */ -+ ent.tbl = tabno; -+ ent.masklen = b->bits; -+ ent.value = 0; -+ inet_aton(atop(b->addr), (struct in_addr *)&ent.addr); -+ if (setsockopt(s, IPPROTO_IP, IP_FW_TABLE_ADD, &ent, sizeof(ent)) < 0) -+ { -+ err(1, "IPFW setsockopt(IP_FW_TABLE_ADD)"); -+ return(-1); -+ } -+ b++; -+ } -+ blacklists++; -+ } -+ -+ return(0); -+} -+#endif - - int - getlist(char ** db_array, char *name, struct blacklist *blist, -@@ -773,7 +829,11 @@ - struct servent *ent; - int i, ch; - -+#ifndef IPFW - while ((ch = getopt(argc, argv, "nd")) != -1) { -+#else -+ while ((ch = getopt(argc, argv, "ndt:")) != -1) { -+#endif - switch (ch) { - case 'n': - dryrun = 1; -@@ -781,6 +841,11 @@ - case 'd': - debug = 1; - break; -+#ifdef IPFW -+ case 't': -+ tabno = atoi(optarg); -+ break; -+#endif - default: - break; - } diff -urN /usr/ports/mail/spamd/files/patch-spamdm /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/files/patch-spamdm --- /usr/ports/mail/spamd/files/patch-spamdm Tue May 2 11:54:50 2006 +++ /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/files/patch-spamdm Thu Jan 1 03:00:00 1970 @@ -1,89 +0,0 @@ ---- spamd/spamd.8 Wed Apr 13 03:21:48 2005 -+++ spamd/spamd.8 Mon Mar 20 15:12:10 2006 -@@ -49,6 +49,8 @@ - daemon which rejects false mail. - If the - .Xr pf 4 -+or -+.Xr ipfw 4 - packet filter is configured to redirect port 25 (SMTP) to this daemon, - it will attempt to waste the time and resources of the spam sender. - .Pp -@@ -151,11 +153,15 @@ - which processes a list of spammers' addresses, and applies appropriate - .Xr pfctl 8 - .Em rdr -+or -+.Xr ipfw 8 -+.Em fwd - rules. - .Xr spamd-setup 8 - is run from - .Xr cron 8 . - .Sh REDIRECTING SMTP CONNECTIONS -+.Ss "When using PF" - With - .Xr pf 4 , - connections to port 25 (SMTP) can be redirected to another host or port, -@@ -189,6 +195,8 @@ - can also be used to load addresses into the - .Em - table. -+ -+ - .Xr spamd-setup 8 - also has the added benefit of being able to remove addresses from - blacklists, and will connect to -@@ -203,6 +211,52 @@ - This is important as it allows legitimate mail - senders to pressure spam sources into behaving properly so that they - may be removed from the relevant blacklists. -+ -+.Ss "If compiled with IPFW" -+With -+.Xr ipfw 4 , -+the syntax for redirection of TCP sessions is quite different -+from that of -+.Xr pf 4 . -+The -+.Em fwd -+rule used for this purpose are described in -+.Xr ipfw 8 . -+The rules should be added to the ruleset called by /etc/rc.firewall -+to be present at boot time. -+.Bd -literal -offset 4n -+fwd 127.0.0.1,8025 tcp from table(2) to me 25 in -+allow tcp from table(1) to me 25 in -+fwd 127.0.0.1,8025 tcp from any to me 25 in -+.Ed -+.Pp -+Any addresses in the blacklist table -+.Em 2 -+and not in the whitelist table -+.Em 1 -+are then redirected to -+.Nm -+running on port 8025. -+Addresses can be loaded into the blacklist -+.Em table , -+like: -+.Bd -literal -offset 4n -+# ipfw table 1 add a.b.c.d/x -+.Ed -+.Pp -+.Xr spamd-setup 8 -+can also be used to load addresses into the blacklist table -+.Em 2 . -+.Pp -+The -+.Op Fl t Ar table_no -+option to -+.Em spamd -+and -+.Em spamd-setup -+can be used to change the default table -+numbers. -+ - .Sh CONFIGURATION CONNECTIONS - .Nm - listens for configuration connections on the port identified by the diff -urN /usr/ports/mail/spamd/files/pfspamd.sh.in /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/files/pfspamd.sh.in --- /usr/ports/mail/spamd/files/pfspamd.sh.in Tue Mar 20 17:16:44 2007 +++ /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/files/pfspamd.sh.in Thu Jan 1 03:00:00 1970 @@ -1,49 +0,0 @@ -#!/bin/sh -# -# $FreeBSD: ports/mail/spamd/files/pfspamd.sh.in,v 1.2 2007/03/20 15:16:44 delphij Exp $ -# - -# PROVIDE: pfspamd -# REQUIRE: NETWORKING -# BEFORE: mail -# 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. -# pfspamd_setup_flags (str): Set to "" by default. -# Extra flags passed to spamd-setup command. - -. %%RC_SUBR%% - -name="pfspamd" -rcvar=`set_rcvar` - -command="%%PREFIX%%/libexec/spamd" -start_postcmd="pfspamd_postcmd" -restart_postcmd="pfspamd_postcmd" - -[ -z "$pfspamd_enable" ] && pfspamd_enable="NO" -[ -z "$pfspamd_flags" ] && pfspamd_flags="" -[ -z "$pfspamd_setup_flags" ] && pfspamd_setup_flags="" - -load_rc_config $name - -# we override check_process to avoid conflict with the spamd from sa-spamd -check_process() -{ - ps ax -o pid,command | grep "libexec/spamd" | grep -v grep | awk '{print $1}' -} - - -pfspamd_postcmd() -{ - if [ -x %%PREFIX%%/sbin/spamd-setup ]; then - %%PREFIX%%/sbin/spamd-setup $pfspamd_setup_flags - fi -} - -run_rc_command "$1" diff -urN /usr/ports/mail/spamd/files/pkg-deinstall.in /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/files/pkg-deinstall.in --- /usr/ports/mail/spamd/files/pkg-deinstall.in Thu Jan 1 03:00:00 1970 +++ /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/files/pkg-deinstall.in Tue Apr 10 18:49:02 2007 @@ -0,0 +1,21 @@ +#!/bin/sh +# +# + +SPAMDDIR=%%SPAMDDIR%% +SPAMDUSER=%%SPAMDUSER%% +SPAMDGROUP=%%SPAMDGROUP%% + +if [ "$2" = "POST-DEINSTALL" ]; then + if /usr/sbin/pw group show "${SPAMDGROUP}" 2>&1 >/dev/null; then + echo "You should manually remove the \"${SPAMDGROUP}\" group." + fi + + if /usr/sbin/pw user show "${SPAMDUSER}" 2>&1 >/dev/null; then + echo "You should manually remove the \"${SPAMDUSER}\" user." + fi + + if [ -e "${SPAMDDIR}" ]; then + echo "You should manually remove the \"${SPAMDDIR}\" directory." + fi +fi diff -urN /usr/ports/mail/spamd/files/pkg-install.in /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/files/pkg-install.in --- /usr/ports/mail/spamd/files/pkg-install.in Thu Jan 1 03:00:00 1970 +++ /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/files/pkg-install.in Wed Apr 18 15:58:31 2007 @@ -0,0 +1,148 @@ +#!/bin/sh +# +# + +SPAMDDIR=%%SPAMDDIR%% +SPAMDUSER=%%SPAMDUSER%% +SPAMDGROUP=%%SPAMDGROUP%% +SPAMDUID=%%SPAMDUID%% +SPAMDGID=%%SPAMDGID%% + +ask() { + local question default answer + + question=$1 + default=$2 + if [ -z "${PACKAGE_BUILDING}" ]; then + read -p "${question} [${default}]? " answer + fi + if [ "x${answer}" = "x" ]; then + answer=${default} + fi + echo ${answer} +} + +yesno() { + local default question answer + + question=$1 + default=$2 + while :; do + answer=$(ask "${question}" "${default}") + case "${answer}" in + [Yy][Ee][Ss]|[Yy]) + return 0 + ;; + [Nn][Oo]|[Nn]) + return 1 + ;; + esac + echo "Please answer yes or no." + 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}'` + fi + if [ "x${OWN}" != "x${SPAMDUSER}" ]; then + echo "change ${BD} owner to ${SPAMDUSER}:" + /usr/sbin/chown ${SPAMDUSER} ${DB} + fi + if [ "x${GRP}" != "x${SPAMDGROUP}" ]; then + echo "change ${BD} owner to :${SPAMDUSER}" + /usr/sbin/chown :${SPAMDGROUP} ${DB} + 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` + 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 + fi + return 0 +} + + +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." + 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 + fi + fi + + if /usr/sbin/pw user show "${SPAMDUSER}" 2>&1 >/dev/null; then + echo "You already have a \"${SPAMDUSER}\" user, so I will use it." + else + echo "You need a \"${SPAMDUSER}\" user." + if yesno "Would you like me to create it" "YES"; then + /usr/sbin/pw useradd "${SPAMDUSER}" -u "${SPAMDUID}" -g "${SPAMDGROUP}" -h - -d "${SPAMDDIR}" \ + -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 + if ! check_service spamd-cfg 8026 tcp "spamd(8) configuration"; then + exit 1 + fi + if ! check_service spamd-sync 8025 udp "spamd(8) synchronisation"; then + exit 1 + fi + +fi diff -urN /usr/ports/mail/spamd/files/pkg-message.in /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/files/pkg-message.in --- /usr/ports/mail/spamd/files/pkg-message.in Thu Jan 1 03:00:00 1970 +++ /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/files/pkg-message.in Sun Jun 3 18:49:28 2007 @@ -0,0 +1,42 @@ +********************************************************************** +To enable spamd you need: + +1) Enable spamd in /etc/rc.conf with the following line: + obspamd_enable="YES" + obspamlogd_enable="YES" + +2) Configuration template is available in %%PREFIX%%/etc/spamd as + spamd.conf.sample file. Copy then to spamd.conf file and + edit to suit your needs. + +3) mount fdescfs to /dev/fd with the following line in /etc/fstab + fdescfs /dev/fd fdescfs rw 0 0 + +4) Add following lines to the pf.conf(5) + + table persist + no rdr inet proto tcp from to any \ + port smtp + rdr pass inet proto tcp from any to any \ + port smtp -> 127.0.0.1 port spamd + + !!!!!!!!!!!! -- 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. + ! + !!!!!!!!!!!! -- I M P O T A N T - N O T E S -- !!!!!!!!!!!!!!!!! + +********************************************************************** diff -urN /usr/ports/mail/spamd/pkg-descr /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/pkg-descr --- /usr/ports/mail/spamd/pkg-descr Wed Nov 8 06:03:20 2006 +++ /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/pkg-descr Tue Apr 10 11:41:43 2007 @@ -1,17 +1,21 @@ -Tarpits like spamd are fake SMTP servers, which accept connections but don't -deliver mail. Instead, they keep the connections open and reply very slowly. -If the peer is patient enough to actually complete the SMTP dialogue (which -will take ten minutes or more), the tarpit returns a 'temporary error' code -(4xx), which indicates that the mail could not be delivered successfully and -that the sender should keep the mail in his queue and retry again later. If -he does, the same procedure repeats. Until, after several attempts, wasting -both his queue space and socket handles for several days, he gives up. The -resources I have to waste to do this are minimal. +Spamd is a fake sendmail(8)-like daemon which rejects false mail. It is +designed to be very efficient so that it does not slow down the receiving +machine. -If the sender is badly configured, an uncooperative recipient might actually -delay his entire queue handling for several minutes each time he connects to -the tarpit. And many spammers use badly configured open relays +spamd considers sending hosts to be of three types: -WWW: http://www.OpenBSD.org/spamd/ + blacklisted hosts are redirected to spamd and tarpitted i.e. they are + communicated with very slowly to consume the sender's resources. Mail is + rejected with either a 450 or 550 error message. A blacklisted host will not + be allowed to talk to a real mail server. + + whitelisted hosts do not talk to spamd. Their connections are instead sent to + a real mail server, such as sendmail(8). + + greylisted hosts are redirected to spamd, but spamd has not yet decided if + they are likely spammers. They are given a temporary failure message by spamd + when they try to deliver mail. + +WWW: http://freebsdspamd.berlios.de/ -Max diff -urN /usr/ports/mail/spamd/pkg-install /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/pkg-install --- /usr/ports/mail/spamd/pkg-install Tue Sep 30 02:01:21 2003 +++ /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/pkg-install Thu Jan 1 03:00:00 1970 @@ -1,84 +0,0 @@ -#!/bin/sh -# an installation script for spamd copied from pf_freebsd - -ask() { - local question default answer - - question=$1 - default=$2 - if [ -z "${PACKAGE_BUILDING}" ]; then - read -p "${question} (y/n) [${default}]? " answer - fi - if [ x${answer} = x ]; then - answer=${default} - fi - echo ${answer} -} - -yesno() { - local dflt question answer - - question=$1 - dflt=$2 - while :; do - answer=$(ask "${question}" "${dflt}") - case "${answer}" in - [Yy]*) return 0;; - [Nn]*) return 1;; - esac - echo "Please answer yes or no." - done -} - -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` - 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 - fi - return 0 -} - -case $2 in -PRE-INSTALL) - - if ! check_service spamd 8025 tcp "# spamd(8)"; then - exit 1 - fi - if ! check_service spamd-cfg 8026 tcp "# spamd(8) configuration"; then - exit 1 - fi - ;; - -esac diff -urN /usr/ports/mail/spamd/pkg-message /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/pkg-message --- /usr/ports/mail/spamd/pkg-message Thu Jan 13 04:54:46 2005 +++ /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/pkg-message Thu Jan 1 03:00:00 1970 @@ -1,9 +0,0 @@ -++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -In order to use spamd greylisting feature you have to have a mounted fdescfs(5) -at /dev/fd. This is done by adding: - - fdescfs /dev/fd fdescfs rw 0 0 - -to /etc/fstab. You may need either a customised kernel, or kldload the fdescfs -kernel module. -++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ diff -urN /usr/ports/mail/spamd/pkg-plist /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/pkg-plist --- /usr/ports/mail/spamd/pkg-plist Tue May 2 11:54:50 2006 +++ /home/samm/src/bsdspamd-orig/freebsdspamd/port/spamd/pkg-plist Thu Jan 1 03:00:00 1970 @@ -1,5 +0,0 @@ -libexec/spamd -libexec/spamlogd -sbin/spamd-setup -sbin/spamdb -etc/spamd.conf.sample --------------000201060000070301060405--