aboutsummaryrefslogtreecommitdiff
path: root/mail/smtptrapd
diff options
context:
space:
mode:
authorAnders Nordby <anders@FreeBSD.org>2005-03-20 21:35:13 +0000
committerAnders Nordby <anders@FreeBSD.org>2005-03-20 21:35:13 +0000
commit6e86014633f5c824341d88e9d116988c2e059e4d (patch)
tree7456e54690c8e401bc149de74e3c7a38033d5553 /mail/smtptrapd
parent1a8f4e6d2dd62ce42fba7ad3f92c1b57bd47649a (diff)
downloadports-6e86014633f5c824341d88e9d116988c2e059e4d.tar.gz
ports-6e86014633f5c824341d88e9d116988c2e059e4d.zip
Add smtptrapd, a tool/trap to keep spammers who try to abuse MX with the
highest PRI away.
Notes
Notes: svn path=/head/; revision=131789
Diffstat (limited to 'mail/smtptrapd')
-rw-r--r--mail/smtptrapd/Makefile40
-rw-r--r--mail/smtptrapd/distinfo2
-rw-r--r--mail/smtptrapd/files/patch-smtptrapd.c25
-rw-r--r--mail/smtptrapd/files/smtptrapd.sh30
-rw-r--r--mail/smtptrapd/pkg-descr6
-rw-r--r--mail/smtptrapd/pkg-install14
6 files changed, 117 insertions, 0 deletions
diff --git a/mail/smtptrapd/Makefile b/mail/smtptrapd/Makefile
new file mode 100644
index 000000000000..a27a7c4b885a
--- /dev/null
+++ b/mail/smtptrapd/Makefile
@@ -0,0 +1,40 @@
+# Ports collection makefile for: smtptrapd
+# Date created: 19 March 2005
+# Whom: Anders Nordby <anders@FreeBSD.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= smtptrapd
+PORTVERSION= 1.1
+CATEGORIES= mail
+MASTER_SITES= http://smtptrapd.inodes.org/
+
+MAINTAINER= anders@FreeBSD.org
+COMMENT= RFC 2821 compliant SMTP service that always returns a 4xx soft error
+
+USE_RC_SUBR= yes
+SED_SCRIPT= -e 's|%%PREFIX%%|${PREFIX}|g;s|%%RC_SUBR%%|${RC_SUBR}|g'
+
+PLIST_FILES= bin/smtptrapd
+
+.include <bsd.port.pre.mk>
+
+.if ${OSVERSION} < 500000
+LIB_DEPENDS+= lthread.2:${PORTSDIR}/devel/linuxthreads
+
+CFLAGS+= ${PTHREAD_CFLAGS} -L${LOCALBASE}/lib -I${LOCALBASE}/include/pthread/linuxthreads -llthread -llgcc_r
+.else
+CFLAGS+= ${PTHREAD_CFLAGS} ${PTHREAD_LIBS}
+.endif
+
+do-build:
+ (cd ${WRKSRC} && ${CC} ${CFLAGS} -o smtptrapd smtptrapd.c)
+ ${SED} ${SED_SCRIPT} ${FILESDIR}/smtptrapd.sh >${WRKSRC}/smtptrapd.sh
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/smtptrapd ${PREFIX}/bin/
+ ${INSTALL_SCRIPT} ${WRKSRC}/smtptrapd.sh ${PREFIX}/etc/rc.d/smtptrapd.sh
+ @${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
+
+.include <bsd.port.post.mk>
diff --git a/mail/smtptrapd/distinfo b/mail/smtptrapd/distinfo
new file mode 100644
index 000000000000..ffd6a885b478
--- /dev/null
+++ b/mail/smtptrapd/distinfo
@@ -0,0 +1,2 @@
+MD5 (smtptrapd-1.1.tar.gz) = 737d5ba5d21b97df902803b36a2ac424
+SIZE (smtptrapd-1.1.tar.gz) = 23383
diff --git a/mail/smtptrapd/files/patch-smtptrapd.c b/mail/smtptrapd/files/patch-smtptrapd.c
new file mode 100644
index 000000000000..0ba2820481db
--- /dev/null
+++ b/mail/smtptrapd/files/patch-smtptrapd.c
@@ -0,0 +1,25 @@
+--- smtptrapd.c.orig Sun Mar 20 00:01:06 2005
++++ smtptrapd.c Sun Mar 20 00:01:36 2005
+@@ -27,9 +27,9 @@
+ #include <sys/time.h>
+ #include <sys/types.h>
+ #include <unistd.h>
++#include <netinet/in.h>
+ #include <arpa/inet.h>
+ #include <sys/socket.h>
+-#include <netinet/in.h>
+ #include <errno.h>
+ #include <string.h>
+ #include <sysexits.h>
+@@ -491,7 +491,11 @@
+ /* background the process */
+ if (fork()) exit(0);
+ if (fork()) exit(0);
++#ifdef __FreeBSD__
++ setpgrp(0, 0);
++#else
+ setpgrp();
++#endif
+
+ openlog("smtptrapd", LOG_PID, LOG_MAIL);
+
diff --git a/mail/smtptrapd/files/smtptrapd.sh b/mail/smtptrapd/files/smtptrapd.sh
new file mode 100644
index 000000000000..44b2f6dec8e4
--- /dev/null
+++ b/mail/smtptrapd/files/smtptrapd.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: smtptrapd
+# REQUIRE: LOGIN
+# BEFORE: mail
+# KEYWORD: FreeBSD shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable smtptrapd:
+#
+#smtptrapd_enable="YES"
+#
+# Run smtptrapd -h for flags
+#
+
+. %%RC_SUBR%%
+
+name=smtptrapd
+rcvar=`set_rcvar`
+
+command=%%PREFIX%%/bin/smtptrapd
+
+smtptrapd_enable=${smtptrapd_enable:-"NO"}
+smtptrapd_flags=${smtptrapd_flags:-"-c /var/run/smtptrapd-root"}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/mail/smtptrapd/pkg-descr b/mail/smtptrapd/pkg-descr
new file mode 100644
index 000000000000..88da7ab0a78e
--- /dev/null
+++ b/mail/smtptrapd/pkg-descr
@@ -0,0 +1,6 @@
+The smtptrapd program is a multi-threaded daemon that provides a RFC 2821
+compliant SMTP service that always returns a 4xx soft error to the RCPT TO
+verb. Use it to keep spammers who try to exploit the MX with highest PRI
+away.
+
+WWW: http://smtptrapd.inodes.org/
diff --git a/mail/smtptrapd/pkg-install b/mail/smtptrapd/pkg-install
new file mode 100644
index 000000000000..7de34583ea65
--- /dev/null
+++ b/mail/smtptrapd/pkg-install
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+case $2 in
+ PRE-INSTALL)
+ ;;
+ POST-INSTALL)
+ install -d -m 0755 /var/run/smtptrapd-root
+ ;;
+ *)
+ echo "Unexpected Argument $2."
+ exit 1
+ ;;
+esac
+exit 0