aboutsummaryrefslogtreecommitdiff
path: root/mail/batv-milter
diff options
context:
space:
mode:
authorMartin Wilke <miwi@FreeBSD.org>2009-06-15 06:53:02 +0000
committerMartin Wilke <miwi@FreeBSD.org>2009-06-15 06:53:02 +0000
commitd5eb61d262647fc64307307e44b8b09c75993472 (patch)
tree027affd0efac7dcf41a354814a218a2162b26b9c /mail/batv-milter
parentc8e4c9c972286e9ef9ef2cd19a766ec8737aa7ad (diff)
downloadports-d5eb61d262647fc64307307e44b8b09c75993472.tar.gz
ports-d5eb61d262647fc64307307e44b8b09c75993472.zip
Notes
Diffstat (limited to 'mail/batv-milter')
-rw-r--r--mail/batv-milter/Makefile58
-rw-r--r--mail/batv-milter/distinfo3
-rw-r--r--mail/batv-milter/files/milter-batv.sh.in169
-rw-r--r--mail/batv-milter/files/patch-batv-filter_Makefile.m419
-rw-r--r--mail/batv-milter/files/patch-batv-filter_batv-filter.c30
-rw-r--r--mail/batv-milter/files/patch-batv-filter_config.c16
-rw-r--r--mail/batv-milter/files/patch-batv-filter_util.c17
-rw-r--r--mail/batv-milter/files/site.config.m411
-rw-r--r--mail/batv-milter/pkg-descr6
9 files changed, 329 insertions, 0 deletions
diff --git a/mail/batv-milter/Makefile b/mail/batv-milter/Makefile
new file mode 100644
index 000000000000..038c53e88dfe
--- /dev/null
+++ b/mail/batv-milter/Makefile
@@ -0,0 +1,58 @@
+# New ports collection makefile for: batv-milter
+# Date created: 2009-06-04
+# Whom: Hirohisa Yamaguchi <umq@ueo.co.jp>
+#
+# $FreeBSD$
+#
+
+PORTNAME= batv-milter
+PORTVERSION= 0.5.0
+CATEGORIES= mail
+MASTER_SITES= SF
+
+MAINTAINER= umq@ueo.co.jp
+COMMENT= A milter for BATV (Bounce Address Tag Validation)
+
+USE_RC_SUBR= milter-batv.sh
+USE_OPENSSL= TRUE
+
+SUB_FILES= milter-batv.sh
+WCONF= ${WRKSRC}/devtools/Site
+MAN8= batv-filter.8
+PLIST_FILES= bin/batv-filter
+PORTDOCS= INSTALL KNOWNBUGS LICENSE README RELEASE_NOTES \
+ draft-levine-smtp-batv-01.txt
+
+SITE= ${FILESDIR}/site.config.m4
+SITE_SUB= -e "s|%%PREFIX%%|${PREFIX}|g" \
+ -e "s|%%LOCALBASE%%|${LOCALBASE}|g" \
+ -e "s|%%OPENSSLINC%%|${OPENSSLINC}|g" \
+ -e "s|%%OPENSSLLIB%%|${OPENSSLLIB}|g"
+
+.include <bsd.port.pre.mk>
+.include "${PORTSDIR}/mail/sendmail/bsd.milter.mk"
+
+.if defined(WITH_DEBUG)
+SITE_SUB+= -e '\|confOPTIMIZE.*-g|s/^dnl //g'
+.endif
+
+pre-configure:
+ ${SED} ${SITE_SUB} -e '\|^dnl |d' -e '/^dnl$$/d' \
+ ${SITE} > ${WCONF}/site.config.m4
+
+post-install:
+.if !defined(WITH_DEBUG)
+ @${STRIP_CMD} ${PREFIX}/bin/batv-filter
+.endif
+.for i in ${MAN8}
+ @${RM} -f ${MANPREFIX}/man/cat8/${i} ${MANPREFIX}/man/cat8/${i}.gz
+ ${INSTALL_MAN} ${WRKSRC}/*/${i} ${MANPREFIX}/man/man8/
+.endfor
+.if !defined(NOPORTDOCS)
+ ${MKDIR} ${DOCSDIR}
+.for f in ${PORTDOCS}
+ ${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR}
+.endfor
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/mail/batv-milter/distinfo b/mail/batv-milter/distinfo
new file mode 100644
index 000000000000..dd4bb49cc723
--- /dev/null
+++ b/mail/batv-milter/distinfo
@@ -0,0 +1,3 @@
+MD5 (batv-milter-0.5.0.tar.gz) = 644528b24a2e394472f8b96110e817e2
+SHA256 (batv-milter-0.5.0.tar.gz) = 1a40129d2585a4fe108401bfa577a8d9e2b7e295b2b0aa11e7f43dac7c601d3b
+SIZE (batv-milter-0.5.0.tar.gz) = 275862
diff --git a/mail/batv-milter/files/milter-batv.sh.in b/mail/batv-milter/files/milter-batv.sh.in
new file mode 100644
index 000000000000..feb81e986357
--- /dev/null
+++ b/mail/batv-milter/files/milter-batv.sh.in
@@ -0,0 +1,169 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: milter-batv
+# REQUIRE: DAEMON
+# BEFORE: mail
+# KEYWORD: shutdown
+
+# Define these milterbatv_* variables in one of these files:
+# /etc/rc.conf
+# /etc/rc.conf.local
+# /etc/rc.conf.d/milterbatv
+#
+# milterbatv_enable (bool): Set to "NO" by default.
+# Set it to "YES" to enable batv-milter
+# milterbatv_uid (str): Set username to run milter.
+# milterbatv_profiles (list): Set to "" by default.
+# Define your profiles here.
+# milterbatv_cfgfile (str): Configuration file.
+#
+# milterbatv_${profile}_* : Variables per profile.
+# Sockets must be different from each other.
+#
+# all parameters below can be set in batv-filter.conf(5).
+# milterbatv_socket (str): Path to the milter socket.
+# milterbatv_domain (str): Domainpart of From: in mails to sign.
+# milterbatv_allowlist (str): Path to the allow list file.
+# milterbatv_key (str): Path to the private key file to sign with.
+# milterbatv_flags (str): Flags passed to start command.
+
+. %%RC_SUBR%%
+
+name="milterbatv"
+rcvar=`set_rcvar`
+
+start_precmd="batv_prepcmd"
+stop_postcmd="batv_postcmd"
+command="%%PREFIX%%/bin/batv-filter"
+_piddir="/var/run/milterbatv"
+pidfile="${_piddir}/pid"
+
+load_rc_config $name
+
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+: ${milterbatv_enable="NO"}
+: ${milterbatv_uid="mailnull"}
+: ${milterbatv_profiles=""}
+: ${milterbatv_cfgfile="%%PREFIX%%/etc/mail/batv-filter.conf"}
+
+: ${milterbatv_socket=""}
+: ${milterbatv_domain=""}
+: ${milterbatv_allowlist=""}
+: ${milterbatv_key=""}
+# Options other than above can be set with $milterbatv_flags.
+# see batv-milter documentation for detail.
+: ${milterbatv_flags=""}
+
+if [ -n "$2" ]; then
+ profile="$2"
+ if [ "x${milterbatv_profiles}" != "x" ]; then
+ pidfile="${_piddir}/${profile}.pid"
+ eval milterbatv_enable="\${milterbatv_${profile}_enable:-${milterbatv_enable}}"
+ eval milterbatv_socket="\${milterbatv_${profile}_socket:-}"
+ if [ "x${milterbatv_socket}" = "x" ];then
+ echo "You must define a socket (milterbatv_${profile}_socket)"
+ exit 1
+ fi
+ eval milterbatv_cfgfile="\${milterbatv_${profile}_cfgfile:-${milterbatv_cfgfile}}"
+ eval milterbatv_domain="\${milterbatv_${profile}_domain:-${milterbatv_domain}}"
+ eval milterbatv_allowlist="\${milterbatv_${profile}_allowlist:-${milterbatv_allowlist}}"
+ eval milterbatv_key="\${milterbatv_${profile}_key:-${milterbatv_key}}"
+ eval milterbatv_flags="\${milterbatv_${profile}_flags:-${milterbatv_flags}}"
+ if [ -f "${milterbatv_cfgfile}" ];then
+ milterbatv_cfgfile="-x ${milterbatv_cfgfile}"
+ else
+ milterbatv_cfgfile=""
+ fi
+ if [ "x${milterbatv_socket}" != "x" ];then
+ _socket_prefix="-p"
+ fi
+ if [ "x${milterbatv_uid}" != "x" ];then
+ _uid_prefix="-u"
+ fi
+ if [ "x${milterbatv_domain}" != "x" ];then
+ milterbatv_domain="-d ${milterbatv_domain}"
+ fi
+ if [ "x${milterbatv_allowlist}" != "x" ];then
+ milterbatv_allowlist="-a ${milterbatv_allowlist}"
+ fi
+ if [ "x${milterbatv_key}" != "x" ];then
+ milterbatv_key="-k ${milterbatv_key}"
+ fi
+ command_args="-l ${_socket_prefix} ${milterbatv_socket} ${_uid_prefix} ${milterbatv_uid} -P ${pidfile} ${milterbatv_cfgfile} ${milterbatv_domain} ${milterbatv_allowlist} ${milterbatv_key}"
+ else
+ echo "$0: extra argument ignored"
+ fi
+else
+ if [ "x${milterbatv_profiles}" != "x" -a "x$1" != "x" ]; then
+ if [ "x$1" != "xrestart" ]; then
+ for profile in ${milterbatv_profiles}; do
+ echo "===> milterbatv profile: ${profile}"
+ %%RC_SCRIPT%% $1 ${profile}
+ retcode="$?"
+ if [ "0${retcode}" -ne 0 ]; then
+ failed="${profile} (${retcode}) ${failed:-}"
+ else
+ success="${profile} ${success:-}"
+ fi
+ done
+ exit 0
+ else
+ restart_precmd=""
+ fi
+ else
+ if [ -f "${milterbatv_cfgfile}" ];then
+ milterbatv_cfgfile="-x ${milterbatv_cfgfile}"
+ else
+ milterbatv_cfgfile=""
+ fi
+ if [ "x${milterbatv_socket}" != "x" ];then
+ _socket_prefix="-p"
+ fi
+ if [ "x${milterbatv_uid}" != "x" ];then
+ _uid_prefix="-u"
+ fi
+ if [ "x${milterbatv_domain}" != "x" ];then
+ milterbatv_domain="-d ${milterbatv_domain}"
+ fi
+ if [ "x${milterbatv_allowlist}" != "x" ];then
+ milterbatv_allowlist="-a ${milterbatv_allowlist}"
+ fi
+ if [ "x${milterbatv_key}" != "x" ];then
+ milterbatv_key="-k ${milterbatv_key}"
+ fi
+ command_args="-l ${_socket_prefix} ${milterbatv_socket} ${_uid_prefix} ${milterbatv_uid} -P ${pidfile} ${milterbatv_cfgfile} ${milterbatv_domain} ${milterbatv_allowlist} ${milterbatv_key}"
+ fi
+fi
+
+batv_prepcmd ()
+{
+ if [ -S ${milterbatv_socket##local:} ] ; then
+ rm -f ${milterbatv_socket##local:}
+ elif [ -S ${milterbatv_socket##unix:} ] ; then
+ rm -f ${milterbatv_socket##unix:}
+ fi
+ if [ ! -d ${_piddir} ] ; then
+ mkdir -p ${_piddir}
+ fi
+ if [ -n "${milterbatv_uid}" ] ; then
+ chown ${milterbatv_uid} ${_piddir}
+ fi
+}
+
+batv_postcmd()
+{
+ if [ -S ${milterbatv_socket##local:} ] ; then
+ rm -f ${milterbatv_socket##local:}
+ elif [ -S ${milterbatv_socket##unix:} ] ; then
+ rm -f ${milterbatv_socket##unix:}
+ fi
+ # just if the directory is empty
+ rmdir ${_piddir} > /dev/null 2>&1
+}
+
+run_rc_command "$1"
diff --git a/mail/batv-milter/files/patch-batv-filter_Makefile.m4 b/mail/batv-milter/files/patch-batv-filter_Makefile.m4
new file mode 100644
index 000000000000..22b913081b79
--- /dev/null
+++ b/mail/batv-milter/files/patch-batv-filter_Makefile.m4
@@ -0,0 +1,19 @@
+--- ./batv-filter/Makefile.m4.orig 2009-04-24 06:11:09.000000000 +0900
++++ ./batv-filter/Makefile.m4 2009-06-04 07:30:43.000000000 +0900
+@@ -3,6 +3,7 @@
+
+ define(`confMT', `TRUE')
+ define(`confREQUIRE_LIBSM', `true')
++define(`confENVDEF', `-DWITHOUT_SMSTRING ')
+
+ APPENDDEF(`confLIBS', `-lssl -lcrypto')
+ dnl Enable and edit these paths as needed:
+@@ -20,7 +21,7 @@
+ bldPRODUCT_START(`executable', `batv-filter')
+ define(`bldSOURCES', `batv-filter.c config.c util.c ')
+ dnl PREPENDDEF(`confLIBS', ifelse(index(confENVDEF, `-DCOMMERCIAL'), -1, `-lmilter ', `../libmilter/libmilter.a '))
+-PREPENDDEF(`confLIBS', `../libmilter/libmilter.a ')
++PREPENDDEF(`confLIBS', `-lmilter ')
+ bldPRODUCT_END
+
+ bldPRODUCT_START(`manpage', `batv-filter')
diff --git a/mail/batv-milter/files/patch-batv-filter_batv-filter.c b/mail/batv-milter/files/patch-batv-filter_batv-filter.c
new file mode 100644
index 000000000000..8afed626e162
--- /dev/null
+++ b/mail/batv-milter/files/patch-batv-filter_batv-filter.c
@@ -0,0 +1,30 @@
+--- ./batv-filter/batv-filter.c.orig 2009-05-28 01:16:45.000000000 +0900
++++ ./batv-filter/batv-filter.c 2009-06-04 07:30:43.000000000 +0900
+@@ -53,7 +53,12 @@
+ #include <openssl/sha.h>
+
+ /* libsm includes */
+-#include <sm/string.h>
++#ifdef WITHOUT_SMSTRING
++# define sm_strlcat strlcat
++# define sm_strlcpy strlcpy
++#else /* WITHOUT_SMSTRING */
++# include <sm/string.h>
++#endif /* WITHOUT_SMSTRING */
+
+ /* libmilter includes */
+ #ifndef DEBUG
+@@ -3461,10 +3466,11 @@
+ pw = getpwnam(user);
+ if (pw == NULL)
+ {
++ char *q;
+ uid_t uid;
+
+- uid = atoi(user);
+- if (uid != 0 && uid != LONG_MIN && uid != LONG_MAX)
++ uid = (uid_t) strtol(user, &q, 10);
++ if (*q == '\0')
+ pw = getpwuid(uid);
+
+ if (pw == NULL)
diff --git a/mail/batv-milter/files/patch-batv-filter_config.c b/mail/batv-milter/files/patch-batv-filter_config.c
new file mode 100644
index 000000000000..70a5301dde20
--- /dev/null
+++ b/mail/batv-milter/files/patch-batv-filter_config.c
@@ -0,0 +1,16 @@
+--- ./batv-filter/config.c.orig 2009-04-22 02:43:48.000000000 +0900
++++ ./batv-filter/config.c 2009-06-04 07:30:43.000000000 +0900
+@@ -17,7 +17,12 @@
+ #include <assert.h>
+
+ /* libsm includes */
+-#include <sm/string.h>
++#ifdef WITHOUT_SMSTRING
++# define sm_strlcat strlcat
++# define sm_strlcpy strlcpy
++#else /* WITHOUT_SMSTRING */
++# include <sm/string.h>
++#endif /* WITHOUT_SMSTRING */
+
+ /* dkim-filter includes */
+ #include "config.h"
diff --git a/mail/batv-milter/files/patch-batv-filter_util.c b/mail/batv-milter/files/patch-batv-filter_util.c
new file mode 100644
index 000000000000..53636fcb3a15
--- /dev/null
+++ b/mail/batv-milter/files/patch-batv-filter_util.c
@@ -0,0 +1,17 @@
+--- ./batv-filter/util.c.orig 2009-05-28 01:16:45.000000000 +0900
++++ ./batv-filter/util.c 2009-06-04 07:31:03.000000000 +0900
+@@ -25,7 +25,13 @@
+ #include <ctype.h>
+
+ /* libsm includes */
+-#include <sm/string.h>
++#ifdef WITHOUT_SMSTRING
++# define sm_strlcat strlcat
++# define sm_strlcpy strlcpy
++# include <sm/gen.h>
++#else /* WITHOUT_SMSTRING */
++# include <sm/string.h>
++#endif /* WITHOUT_SMSTRING */
+
+ /* batv-filter includes */
+ #include "batv-filter.h"
diff --git a/mail/batv-milter/files/site.config.m4 b/mail/batv-milter/files/site.config.m4
new file mode 100644
index 000000000000..654d3ef7bec6
--- /dev/null
+++ b/mail/batv-milter/files/site.config.m4
@@ -0,0 +1,11 @@
+define(`confEBINDIR',`%%PREFIX%%/libexec')
+define(`confMANROOT',`%%PREFIX%%/man/man')
+define(`confMANROOTMAN',`%%PREFIX%%/man/man')
+define(`confUBINDIR',`%%PREFIX%%/bin')
+define(`confINCLUDEDIR',`%%PREFIX%%/include')
+define(`confLIBDIR',`%%PREFIX%%/lib')
+define(`confSHAREDLIBDIR',`%%PREFIX%%/lib')
+define(`confDONT_INSTALL_CATMAN',`True')
+APPENDDEF(`confLIBDIRS', `-L%%OPENSSLLIB%% ')
+APPENDDEF(`confINCDIRS', `-I%%OPENSSLINC%% ')
+dnl define(`confOPTIMIZE', `-g')
diff --git a/mail/batv-milter/pkg-descr b/mail/batv-milter/pkg-descr
new file mode 100644
index 000000000000..7249ee4524cb
--- /dev/null
+++ b/mail/batv-milter/pkg-descr
@@ -0,0 +1,6 @@
+This package is an implementation of BATV (Bounce Address Tag Validation),
+a draft proposal for detecting and messages making fraudulent use of a sender
+address. The filter is written as a plugin to Sendmail or other filters using
+the milter API.
+
+WWW: https://sourceforge.net/projects/batv-milter/