mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-25 04:43:33 +00:00
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/ PR: ports/135393 Submitted by: Hirohisa Yamaguchi <umq at ueo.co.jp>
This commit is contained in:
parent
c8e4c9c972
commit
d5eb61d262
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=235839
@ -25,6 +25,7 @@
|
||||
SUBDIR += autosig
|
||||
SUBDIR += avenger
|
||||
SUBDIR += balsa
|
||||
SUBDIR += batv-milter
|
||||
SUBDIR += bayespam
|
||||
SUBDIR += bbmail
|
||||
SUBDIR += biabam
|
||||
|
58
mail/batv-milter/Makefile
Normal file
58
mail/batv-milter/Makefile
Normal file
@ -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>
|
3
mail/batv-milter/distinfo
Normal file
3
mail/batv-milter/distinfo
Normal file
@ -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
|
169
mail/batv-milter/files/milter-batv.sh.in
Normal file
169
mail/batv-milter/files/milter-batv.sh.in
Normal file
@ -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"
|
19
mail/batv-milter/files/patch-batv-filter_Makefile.m4
Normal file
19
mail/batv-milter/files/patch-batv-filter_Makefile.m4
Normal file
@ -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')
|
30
mail/batv-milter/files/patch-batv-filter_batv-filter.c
Normal file
30
mail/batv-milter/files/patch-batv-filter_batv-filter.c
Normal file
@ -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)
|
16
mail/batv-milter/files/patch-batv-filter_config.c
Normal file
16
mail/batv-milter/files/patch-batv-filter_config.c
Normal file
@ -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"
|
17
mail/batv-milter/files/patch-batv-filter_util.c
Normal file
17
mail/batv-milter/files/patch-batv-filter_util.c
Normal file
@ -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"
|
11
mail/batv-milter/files/site.config.m4
Normal file
11
mail/batv-milter/files/site.config.m4
Normal file
@ -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')
|
6
mail/batv-milter/pkg-descr
Normal file
6
mail/batv-milter/pkg-descr
Normal file
@ -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/
|
Loading…
Reference in New Issue
Block a user