From b1770230b29c6e2203751fcf8b5420086d69a81d Mon Sep 17 00:00:00 2001 From: Pav Lucistnik Date: Thu, 27 May 2004 21:12:08 +0000 Subject: [PATCH] Add milter-greylist, a milter for sendmail written in C that implements grey listing. Grey listing is a spam filtering technique, which uses a behavior trick: spammers never resend a message when they get a temporary error, whereas real MTA do. The idea is to refuse any mail on first attempt, and accept it after some time has elapsed. PR: ports/67252 Submitted by: Cyril Guibourg --- mail/Makefile | 1 + mail/milter-greylist/Makefile | 46 +++++++++++++++ mail/milter-greylist/distinfo | 2 + mail/milter-greylist/files/milter-greylist.in | 32 +++++++++++ mail/milter-greylist/files/milter-greylist.sh | 32 +++++++++++ mail/milter-greylist/files/patch-Makefile.in | 57 +++++++++++++++++++ mail/milter-greylist/files/patch-dump.c | 10 ++++ mail/milter-greylist/files/patch-dump.h | 11 ++++ mail/milter-greylist/files/patch-spf.c | 12 ++++ mail/milter-greylist/files/pkg-message.in | 10 ++++ mail/milter-greylist/pkg-descr | 11 ++++ mail/milter-greylist/pkg-message | 10 ++++ mail/milter-greylist/pkg-plist | 13 +++++ 13 files changed, 247 insertions(+) create mode 100644 mail/milter-greylist/Makefile create mode 100644 mail/milter-greylist/distinfo create mode 100644 mail/milter-greylist/files/milter-greylist.in create mode 100644 mail/milter-greylist/files/milter-greylist.sh create mode 100644 mail/milter-greylist/files/patch-Makefile.in create mode 100644 mail/milter-greylist/files/patch-dump.c create mode 100644 mail/milter-greylist/files/patch-dump.h create mode 100644 mail/milter-greylist/files/patch-spf.c create mode 100644 mail/milter-greylist/files/pkg-message.in create mode 100644 mail/milter-greylist/pkg-descr create mode 100644 mail/milter-greylist/pkg-message create mode 100644 mail/milter-greylist/pkg-plist diff --git a/mail/Makefile b/mail/Makefile index 91373c92b3f2..b1e5eaf0ca6f 100644 --- a/mail/Makefile +++ b/mail/Makefile @@ -179,6 +179,7 @@ SUBDIR += mew3 SUBDIR += mew3-emacs20 SUBDIR += mew3-xemacs21-mule + SUBDIR += milter-greylist SUBDIR += milter-regex SUBDIR += milter-sender SUBDIR += mimedefang diff --git a/mail/milter-greylist/Makefile b/mail/milter-greylist/Makefile new file mode 100644 index 000000000000..663f73c8edbb --- /dev/null +++ b/mail/milter-greylist/Makefile @@ -0,0 +1,46 @@ +# New ports collection makefile for: milter-greylist +# Date created: 27 Apr 2004 +# Whom: Cyril Guibourg +# +# $FreeBSD$ +# + +PORTNAME= milter-greylist +PORTVERSION= 1.2.2 +CATEGORIES= mail +MASTER_SITES= ftp://ftp.espci.fr/pub/milter-greylist/ +EXTRACT_SUFX= .tgz + +MAINTAINER= aragorn+ports@teaser.fr +COMMENT= Easy-to-use greylist milter for sendmail + +MAN5= greylist.conf.5 +MAN8= milter-greylist.8 + +GNU_CONFIGURE= yes +CONFIGURE_TARGET= --build=${MACHINE_ARCH}-portbld-freebsd${OSREL} +CONFIGURE_ARGS+= --with-user=smmsp + +ALL_TARGET= milter-greylist + +USE_RC_SUBR= yes +RC_SCRIPTS_SUB= PREFIX=${PREFIX} RC_SUBR=${RC_SUBR} + +post-extract: + @${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ + ${FILESDIR}/milter-greylist.sh > ${WRKSRC}/milter-greylist.sh + +post-install: + ${MKDIR} /var/milter-greylist /var/db/milter-greylist + ${CHOWN} smmsp /var/milter-greylist /var/db/milter-greylist + ${MKDIR} ${PREFIX}/etc/rc.d + ${INSTALL_SCRIPT} ${WRKSRC}/milter-greylist.sh ${PREFIX}/etc/rc.d/ +.if !defined(NOPORTDOCS) + ${MKDIR} ${DOCSDIR} + ${MKDIR} ${EXAMPLESDIR} + ${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR} + ${INSTALL_DATA} ${WRKSRC}/greylist.conf ${EXAMPLESDIR} +.endif + @${CAT} ${PKGMESSAGE} + +.include diff --git a/mail/milter-greylist/distinfo b/mail/milter-greylist/distinfo new file mode 100644 index 000000000000..cc9a4c92433f --- /dev/null +++ b/mail/milter-greylist/distinfo @@ -0,0 +1,2 @@ +MD5 (milter-greylist-1.2.2.tgz) = 7c313a482cec2b4e406eefe121c1e5e7 +SIZE (milter-greylist-1.2.2.tgz) = 88297 diff --git a/mail/milter-greylist/files/milter-greylist.in b/mail/milter-greylist/files/milter-greylist.in new file mode 100644 index 000000000000..45cda90666d2 --- /dev/null +++ b/mail/milter-greylist/files/milter-greylist.in @@ -0,0 +1,32 @@ +#!/bin/sh +# $FreeBSD$ + +# PROVIDE: miltergreylist +# REQUIRE: LOGIN +# BEFORE: sendmail +# KEYWORD: milter-greylist + +# Define these miltergreylist_* variables in one of these files: +# /etc/rc.conf +# /etc/rc.conf.miltergreylist +# /etc/rc.conf.d/miltergreylist +# +# DO NOT CHANGE THESE DEFAULT VALUES HERE +# +miltergreylist_enable="NO" +miltergreylist_runas="smmsp" +miltergreylist_pidfile="/var/run/milter-greylist.pid" +miltergreylist_sockfile="/var/milter-greylist/milter-greylist.sock" +miltergreylist_cfgfile="%%PREFIX%%/etc/mail/greylist.conf" +miltergreylist_flags="-P $miltergreylist_pidfile -f $miltergreylist_cfgfile + -p $miltergreylist_sockfile -u $miltergreylist_runas" + +. %%RC_SUBR%% + +name="miltergreylist" +rcvar=`set_rcvar` +command="%%PREFIX%%/bin/milter-greylist" + +load_rc_config $name + +run_rc_command "$1" diff --git a/mail/milter-greylist/files/milter-greylist.sh b/mail/milter-greylist/files/milter-greylist.sh new file mode 100644 index 000000000000..45cda90666d2 --- /dev/null +++ b/mail/milter-greylist/files/milter-greylist.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# $FreeBSD$ + +# PROVIDE: miltergreylist +# REQUIRE: LOGIN +# BEFORE: sendmail +# KEYWORD: milter-greylist + +# Define these miltergreylist_* variables in one of these files: +# /etc/rc.conf +# /etc/rc.conf.miltergreylist +# /etc/rc.conf.d/miltergreylist +# +# DO NOT CHANGE THESE DEFAULT VALUES HERE +# +miltergreylist_enable="NO" +miltergreylist_runas="smmsp" +miltergreylist_pidfile="/var/run/milter-greylist.pid" +miltergreylist_sockfile="/var/milter-greylist/milter-greylist.sock" +miltergreylist_cfgfile="%%PREFIX%%/etc/mail/greylist.conf" +miltergreylist_flags="-P $miltergreylist_pidfile -f $miltergreylist_cfgfile + -p $miltergreylist_sockfile -u $miltergreylist_runas" + +. %%RC_SUBR%% + +name="miltergreylist" +rcvar=`set_rcvar` +command="%%PREFIX%%/bin/milter-greylist" + +load_rc_config $name + +run_rc_command "$1" diff --git a/mail/milter-greylist/files/patch-Makefile.in b/mail/milter-greylist/files/patch-Makefile.in new file mode 100644 index 000000000000..3b39b70628a9 --- /dev/null +++ b/mail/milter-greylist/files/patch-Makefile.in @@ -0,0 +1,57 @@ +--- Makefile.in.orig Sat Apr 3 11:26:11 2004 ++++ Makefile.in Tue May 25 23:04:47 2004 +@@ -29,9 +29,9 @@ + # OF THE POSSIBILITY OF SUCH DAMAGE. + # + +-CFLAGS= @CFLAGS@ -D_BSD_SOURCE -Wall -ansi +-LDFLAGS= @LDFLAGS@ +-LIBS= @LIBS@ ++CFLAGS= @CFLAGS@ -D_BSD_SOURCE -Wall -ansi -pthread ++LDFLAGS= @LDFLAGS@ -pthread ++LIBS= -lmilter + prefix= @prefix@ + exec_prefix= @exec_prefix@ + SYSCONFDIR= @sysconfdir@ +@@ -66,34 +66,20 @@ + dump_yacc.o: dump_yacc.c dump_lex.c + + rc-bsd.sh: rc-bsd.sh.in +- ${SED} "s|@BINDIR@|${BINDIR}|g" rc-bsd.sh.in > rc-bsd.sh ++ ${SED} -e "s|@BINDIR@|${BINDIR}|g" \ ++ -e "s|@SYSCONFDIR@|${SYSCONFDIR}|g" rc-bsd.sh.in > rc-bsd.sh + rc-linux.sh: rc-linux.sh.in + ${SED} "s|@BINDIR@|${BINDIR}|g" rc-linux.sh.in > rc-linux.sh + + install: milter-greylist +- ${INSTALL} -d 755 ${BINDIR} +- ${INSTALL} -d 755 ${MANDIR}/man8 +- ${INSTALL} -d 755 ${MANDIR}/man5 ++ ${INSTALL} -d -m 755 ${BINDIR} ++ ${INSTALL} -d -m 755 ${SYSCONFDIR}/mail ++ ${INSTALL} -d -m 755 ${MANDIR}/man8 ++ ${INSTALL} -d -m 755 ${MANDIR}/man5 + ${INSTALL} -m 755 milter-greylist ${BINDIR} + ${INSTALL} -m 644 milter-greylist.8 ${MANDIR}/man8 + ${INSTALL} -m 644 greylist.conf.5 ${MANDIR}/man5 +- ${TEST} -f /etc/mail/greylist.conf -o -f /etc/mail/greylist.except || \ +- ${INSTALL} -m 644 greylist.conf /etc/mail +- ${INSTALL} -d -m 755 -o ${USER} /var/milter-greylist +- @${TEST} -f /var/db/greylist.db && ( \ +- echo " ================================================"; \ +- echo " WARNING: the dump file location has changed, "; \ +- echo " Please move /var/db/greylist.db, the default "; \ +- echo " location is now in /var/milter-greylist/ "; \ +- echo " ================================================"; \ +- ) || ${TRUE} +- @${TEST} -f /etc/mail/greylist.except && ( \ +- echo " ================================================"; \ +- echo " WARNING: the config file name has changed, "; \ +- echo " Please rename /etc/mail/greylist.except, the "; \ +- echo " default name is now in /etc/mail/greylist.conf "; \ +- echo " ================================================"; \ +- ) || ${TRUE} ++ ${INSTALL} -m 644 greylist.conf ${SYSCONFDIR}/mail/greylist.conf.sample + + depend: + ${MKDEP} ${CFLAGS} ${SRC} diff --git a/mail/milter-greylist/files/patch-dump.c b/mail/milter-greylist/files/patch-dump.c new file mode 100644 index 000000000000..41c6e5f900a0 --- /dev/null +++ b/mail/milter-greylist/files/patch-dump.c @@ -0,0 +1,10 @@ +--- dump.c.orig Wed Mar 31 19:02:08 2004 ++++ dump.c Thu Apr 29 15:12:53 2004 +@@ -53,6 +53,7 @@ + #include + #include + #include ++#include + + #include + #include diff --git a/mail/milter-greylist/files/patch-dump.h b/mail/milter-greylist/files/patch-dump.h new file mode 100644 index 000000000000..d3593f7cb2a6 --- /dev/null +++ b/mail/milter-greylist/files/patch-dump.h @@ -0,0 +1,11 @@ +--- dump.h.orig Thu May 6 15:54:01 2004 ++++ dump.h Tue May 25 22:48:33 2004 +@@ -46,7 +46,7 @@ + #include + + #ifndef DUMPFILE +-#define DUMPFILE "/var/milter-greylist/greylist.db" ++#define DUMPFILE "/var/db/milter-greylist/greylist.db" + #endif + + #define DATELEN 40 diff --git a/mail/milter-greylist/files/patch-spf.c b/mail/milter-greylist/files/patch-spf.c new file mode 100644 index 000000000000..36b24d0b131a --- /dev/null +++ b/mail/milter-greylist/files/patch-spf.c @@ -0,0 +1,12 @@ +--- spf.c.orig Wed Apr 14 10:46:14 2004 ++++ spf.c Thu Apr 29 15:19:01 2004 +@@ -45,8 +45,8 @@ + #include + #include + #include +-#include + #include ++#include + + #include "conf.h" + #include "spf.h" diff --git a/mail/milter-greylist/files/pkg-message.in b/mail/milter-greylist/files/pkg-message.in new file mode 100644 index 000000000000..398094ce4230 --- /dev/null +++ b/mail/milter-greylist/files/pkg-message.in @@ -0,0 +1,10 @@ +===> IMPORTANT NOTE + + A sample configuration file has been installed in ${PREFIX}/etc/mail + directory. Copy and edit it to suit your needs before launching + milter-greylist. + + To run milter-greylist from startup, add miltergreylist_enable="YES" + in your /etc/rc.conf or your /etc/rc.conf.local + + See ${DOCSDIR}/README for operation details. diff --git a/mail/milter-greylist/pkg-descr b/mail/milter-greylist/pkg-descr new file mode 100644 index 000000000000..b5154e12e91f --- /dev/null +++ b/mail/milter-greylist/pkg-descr @@ -0,0 +1,11 @@ +This is a port of Emmanuel Dreyfus' milter-greylist. + +Grey listing is a wonderful spam filtering technique, which uses a behavior +trick: spammers never resend a message when they get a temporary error, +whereas real MTA do. The idea is to refuse any mail on first attempt, and +accept it after some time has elapsed. + +milter-greylist is a stand-alone milter written in C that implement grey +listing. + +WWW: http://hcpnet.free.fr/milter-greylist/ diff --git a/mail/milter-greylist/pkg-message b/mail/milter-greylist/pkg-message new file mode 100644 index 000000000000..398094ce4230 --- /dev/null +++ b/mail/milter-greylist/pkg-message @@ -0,0 +1,10 @@ +===> IMPORTANT NOTE + + A sample configuration file has been installed in ${PREFIX}/etc/mail + directory. Copy and edit it to suit your needs before launching + milter-greylist. + + To run milter-greylist from startup, add miltergreylist_enable="YES" + in your /etc/rc.conf or your /etc/rc.conf.local + + See ${DOCSDIR}/README for operation details. diff --git a/mail/milter-greylist/pkg-plist b/mail/milter-greylist/pkg-plist new file mode 100644 index 000000000000..c56623f1d02d --- /dev/null +++ b/mail/milter-greylist/pkg-plist @@ -0,0 +1,13 @@ +bin/milter-greylist +etc/mail/greylist.conf.sample +etc/rc.d/milter-greylist.sh +%%PORTDOCS%%%%DOCSDIR%%/README +%%PORTDOCS%%%%EXAMPLESDIR%%/greylist.conf +@exec /bin/mkdir -p /var/milter-greylist +@exec /bin/mkdir -p /var/db/milter-greylist +@exec /usr/sbin/chown smmsp /var/milter-greylist /var/db/milter-greylist +%%PORTDOCS%%@dirrm %%DOCSDIR%% +%%PORTDOCS%%@dirrm %%EXAMPLESDIR%% +@dirrm etc/mail +@unexec /bin/rmdir /var/milter-greylist 2>/dev/null || true +@unexec [ -f /var/db/milter-greylist/greylist.db ] || /bin/rmdir /var/db/milter-greylist || true