diff options
author | miwi <miwi@FreeBSD.org> | 2007-06-07 00:38:53 +0800 |
---|---|---|
committer | miwi <miwi@FreeBSD.org> | 2007-06-07 00:38:53 +0800 |
commit | efc23c3163a8569cca2232583c73be538a0f61f1 (patch) | |
tree | fe634cec9922daa92148c5e4789a566225331421 /mail/spamd | |
parent | 73c589bd6113c6c88c44da625cf3dd98fb942236 (diff) | |
download | freebsd-ports-gnome-efc23c3163a8569cca2232583c73be538a0f61f1.tar.gz freebsd-ports-gnome-efc23c3163a8569cca2232583c73be538a0f61f1.tar.zst freebsd-ports-gnome-efc23c3163a8569cca2232583c73be538a0f61f1.zip |
- Update to 4.1.2
PR: 113293
Submitted by: Alex Samorukov <samm@os2.kiev.ua> (maintainer)
Diffstat (limited to 'mail/spamd')
-rw-r--r-- | mail/spamd/Makefile | 85 | ||||
-rw-r--r-- | mail/spamd/distinfo | 6 | ||||
-rw-r--r-- | mail/spamd/files/obspamd.in | 64 | ||||
-rw-r--r-- | mail/spamd/files/obspamlogd.in | 49 | ||||
-rw-r--r-- | mail/spamd/files/patch-greyc | 131 | ||||
-rw-r--r-- | mail/spamd/files/patch-greyh | 10 | ||||
-rw-r--r-- | mail/spamd/files/patch-spamd | 48 | ||||
-rw-r--r-- | mail/spamd/files/patch-spamd-setup | 110 | ||||
-rw-r--r-- | mail/spamd/files/patch-spamdm | 89 | ||||
-rw-r--r-- | mail/spamd/files/pfspamd.sh.in | 49 | ||||
-rw-r--r-- | mail/spamd/files/pkg-deinstall.in | 21 | ||||
-rw-r--r-- | mail/spamd/files/pkg-install.in | 125 | ||||
-rw-r--r-- | mail/spamd/files/pkg-message.in | 42 | ||||
-rw-r--r-- | mail/spamd/pkg-descr | 30 | ||||
-rw-r--r-- | mail/spamd/pkg-install | 84 | ||||
-rw-r--r-- | mail/spamd/pkg-message | 9 | ||||
-rw-r--r-- | mail/spamd/pkg-plist | 5 |
17 files changed, 371 insertions, 586 deletions
diff --git a/mail/spamd/Makefile b/mail/spamd/Makefile index 74c14dcaf930..1dd212439d18 100644 --- a/mail/spamd/Makefile +++ b/mail/spamd/Makefile @@ -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 <max@love2party.net> # # $FreeBSD$ # PORTNAME= spamd -PORTVERSION= 3.7 -PORTREVISION= 3 +PORTVERSION= 4.1.2 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 <bsd.port.pre.mk> -.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 -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 +CONFIG_DIR= ${PREFIX}/etc/spamd +SAMPLE_SPAMD_CONF= ${CONFIG_DIR}/spamd.conf.sample -pre-su-install: -.if !defined(BATCH) && !defined(PACKAGE_BUILDING) - @${SETENV} PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL -.endif +PLIST_SUB= SPAMDDIR=${SPAMDDIR} \ + SPAMDUSER=${SPAMDUSER} \ + SPAMDGROUP=${SPAMDGROUP} \ + SPAMDUID=${SPAMDUID} \ + SPAMDGID=${SPAMDGID} + +SUB_FILES= pkg-install \ + pkg-deinstall \ + pkg-message + +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 <bsd.port.post.mk> diff --git a/mail/spamd/distinfo b/mail/spamd/distinfo index 5dae30e01729..c07a67cbba24 100644 --- a/mail/spamd/distinfo +++ b/mail/spamd/distinfo @@ -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.2.tar.gz) = 0a207e997840359bde85ec4039e0d6a8 +SHA256 (spamd-4.1.2.tar.gz) = 49defbee42fe30c5f218351cc664e11328799b9893abe4528a17594d3ec97231 +SIZE (spamd-4.1.2.tar.gz) = 50199 diff --git a/mail/spamd/files/obspamd.in b/mail/spamd/files/obspamd.in new file mode 100644 index 000000000000..cfda57c84756 --- /dev/null +++ b/mail/spamd/files/obspamd.in @@ -0,0 +1,64 @@ +#!/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" +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 +} + +load_rc_config $name +run_rc_command "$1" diff --git a/mail/spamd/files/obspamlogd.in b/mail/spamd/files/obspamlogd.in new file mode 100644 index 000000000000..53fb60a3be99 --- /dev/null +++ b/mail/spamd/files/obspamlogd.in @@ -0,0 +1,49 @@ +#!/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="${name}_precmd" + +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} +} + +load_rc_config $name +run_rc_command "$1" diff --git a/mail/spamd/files/patch-greyc b/mail/spamd/files/patch-greyc deleted file mode 100644 index 0a626e9f1737..000000000000 --- a/mail/spamd/files/patch-greyc +++ /dev/null @@ -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 <unistd.h> - #include <netdb.h> - -+#ifdef IPFW -+#include <netinet/ip_fw.h> -+#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 <spamd-white> update)"); -+#else -+ setproctitle("(ipfw white table update)"); -+#endif - greyscanner(); - /* NOTREACHED */ - exit(1); diff --git a/mail/spamd/files/patch-greyh b/mail/spamd/files/patch-greyh deleted file mode 100644 index 5f9d5c9b5833..000000000000 --- a/mail/spamd/files/patch-greyh +++ /dev/null @@ -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 --git a/mail/spamd/files/patch-spamd b/mail/spamd/files/patch-spamd deleted file mode 100644 index 6aea088d3922..000000000000 --- a/mail/spamd/files/patch-spamd +++ /dev/null @@ -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 --git a/mail/spamd/files/patch-spamd-setup b/mail/spamd/files/patch-spamd-setup deleted file mode 100644 index 6b517f056209..000000000000 --- a/mail/spamd/files/patch-spamd-setup +++ /dev/null @@ -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 <netdb.h> - #include <zlib.h> - -+#ifdef IPFW -+#include <net/if.h> -+#include <netinet/ip_fw.h> -+#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 --git a/mail/spamd/files/patch-spamdm b/mail/spamd/files/patch-spamdm deleted file mode 100644 index 9b83f8a3dc63..000000000000 --- a/mail/spamd/files/patch-spamdm +++ /dev/null @@ -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 <spamd> - 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 --git a/mail/spamd/files/pfspamd.sh.in b/mail/spamd/files/pfspamd.sh.in deleted file mode 100644 index e2e2e52ad0a7..000000000000 --- a/mail/spamd/files/pfspamd.sh.in +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -# -# $FreeBSD$ -# - -# 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 --git a/mail/spamd/files/pkg-deinstall.in b/mail/spamd/files/pkg-deinstall.in new file mode 100644 index 000000000000..e3951f0366f6 --- /dev/null +++ b/mail/spamd/files/pkg-deinstall.in @@ -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 --git a/mail/spamd/files/pkg-install.in b/mail/spamd/files/pkg-install.in new file mode 100644 index 000000000000..337b1f86aa60 --- /dev/null +++ b/mail/spamd/files/pkg-install.in @@ -0,0 +1,125 @@ +#!/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_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 + 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." + 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 + else + echo "Please create the \"${SPAMDUSER}\" user manually and try again." + exit 1 + fi + 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 --git a/mail/spamd/files/pkg-message.in b/mail/spamd/files/pkg-message.in new file mode 100644 index 000000000000..e3c286dbe50a --- /dev/null +++ b/mail/spamd/files/pkg-message.in @@ -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 <spamd-white> persist + no rdr inet proto tcp from <spamd-white> 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 --git a/mail/spamd/pkg-descr b/mail/spamd/pkg-descr index 2ebca3696464..9fecd40f903f 100644 --- a/mail/spamd/pkg-descr +++ b/mail/spamd/pkg-descr @@ -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 <max@love2party.net> diff --git a/mail/spamd/pkg-install b/mail/spamd/pkg-install deleted file mode 100644 index 04735528070e..000000000000 --- a/mail/spamd/pkg-install +++ /dev/null @@ -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 --git a/mail/spamd/pkg-message b/mail/spamd/pkg-message deleted file mode 100644 index 893c9b635fb1..000000000000 --- a/mail/spamd/pkg-message +++ /dev/null @@ -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 --git a/mail/spamd/pkg-plist b/mail/spamd/pkg-plist deleted file mode 100644 index 0980cae16d32..000000000000 --- a/mail/spamd/pkg-plist +++ /dev/null @@ -1,5 +0,0 @@ -libexec/spamd -libexec/spamlogd -sbin/spamd-setup -sbin/spamdb -etc/spamd.conf.sample |