Add smtptrapd, a tool/trap to keep spammers who try to abuse MX with the

highest PRI away.
This commit is contained in:
Anders Nordby 2005-03-20 21:35:13 +00:00
parent 1a8f4e6d2d
commit 6e86014633
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=131789
7 changed files with 118 additions and 0 deletions

View file

@ -441,6 +441,7 @@
SUBDIR += smtpmail
SUBDIR += smtpproxy
SUBDIR += smtprc
SUBDIR += smtptrapd
SUBDIR += solidpop3d
SUBDIR += sortmail
SUBDIR += spamass-milter

40
mail/smtptrapd/Makefile Normal file
View file

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

2
mail/smtptrapd/distinfo Normal file
View file

@ -0,0 +1,2 @@
MD5 (smtptrapd-1.1.tar.gz) = 737d5ba5d21b97df902803b36a2ac424
SIZE (smtptrapd-1.1.tar.gz) = 23383

View file

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

View file

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

6
mail/smtptrapd/pkg-descr Normal file
View file

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

View file

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