summaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authoranray <anray@FreeBSD.org>2006-01-17 13:55:55 +0000
committeranray <anray@FreeBSD.org>2006-01-17 13:55:55 +0000
commitd1972c56811982d8ef844e29219d3b1f375c3f77 (patch)
tree49db115fc54c97bb12ed14886cefaf434b27c260 /mail
parent82f35384a0d413d170752b96c6a75792f60a94e3 (diff)
downloadFreeBSD-ports-d1972c56811982d8ef844e29219d3b1f375c3f77.zip
FreeBSD-ports-d1972c56811982d8ef844e29219d3b1f375c3f77.tar.gz
In some cases, several instances of a milter with different
configuration run simultaneously; e.g. different key with different selector, or domain for dkim-milter. This update enables multiple instantiation. PR: ports/91894 Submitted by: Hirohisa Yamaguchi (maintainer)
Diffstat (limited to 'mail')
-rw-r--r--mail/dkim-milter/Makefile1
-rw-r--r--mail/dkim-milter/files/milter-dkim.sh.in73
-rw-r--r--mail/dkim-milter/pkg-message4
3 files changed, 69 insertions, 9 deletions
diff --git a/mail/dkim-milter/Makefile b/mail/dkim-milter/Makefile
index f49543e..ccca131 100644
--- a/mail/dkim-milter/Makefile
+++ b/mail/dkim-milter/Makefile
@@ -7,6 +7,7 @@
PORTNAME= dkim-milter
PORTVERSION= 0.2.1
+PORTREVISION= 1
CATEGORIES= mail
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}
diff --git a/mail/dkim-milter/files/milter-dkim.sh.in b/mail/dkim-milter/files/milter-dkim.sh.in
index c667758..048c606 100644
--- a/mail/dkim-milter/files/milter-dkim.sh.in
+++ b/mail/dkim-milter/files/milter-dkim.sh.in
@@ -3,9 +3,9 @@
# $FreeBSD$
#
-# PROVIDE: milterdkim
+# PROVIDE: milter-dkim
# REQUIRE: DAEMON
-# BEFORE: sendmail
+# BEFORE: mail
# KEYWORD: shutdown
# Define these milterdkim_* variables in one of these files:
@@ -13,28 +13,83 @@
# /etc/rc.conf.local
# /etc/rc.conf.d/milterdkim
#
+# milterdkim_enable (bool): Set to "NO" by default.
+# Set it to "YES" to enable dkim-milter
+# milterdkim_profiles (list): Set to "" by default.
+# Define your profiles here.
+# milterdkim_socket (str): Path to the milter socket.
+# milterdkim_domain (str): Domainpart of From: in mails to sign.
+# milterdkim_key (str): Path to the private key file to sign with.
+# milterdkim_flags (str): Flags passed to start command.
+#
+# milterdkim_${profile}_* : Variables per profile.
+# Sockets must be different from each other.
+#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
#
milterdkim_enable=${milterdkim_enable:-"NO"}
+milterdkim_profiles=${milterdkim_profiles:-}
milterdkim_socket=${milterdkim_socket:-"local:/var/run/dkim-filter"}
-milterdkim_pid=${milterdkim_pid:-"/var/run/dkim-filter.pid"}
milterdkim_domain=${milterdkim_domain:-"example.com"}
milterdkim_key=${milterdkim_key:-"/var/db/domainkeys/default.key.pem"}
-milterdkim_flags=${milterdkim_flags:-"-d ${milterdkim_domain} -c nowsp -m MSA \
--s ${milterdkim_key} -S default"}
+## milterdkim_flags expands escaped variables later.
+milterdkim_flags=${milterdkim_flags:-"-d \${milterdkim_domain\} -c nowsp -m MSA \
+-s \${milterdkim_key\} -S default"}
. %%RC_SUBR%%
name="milterdkim"
-pidfile=${milterdkim_pid}
rcvar=`set_rcvar`
+
+start_precmd="dkim_prepcmd"
+stop_postcmd="dkim_prepcmd"
command="%%PREFIX%%/libexec/dkim-filter"
-command_args="-l -p ${milterdkim_socket} -P ${milterdkim_pid}"
-stop_postcmd="dkim_postcmd"
+_pidprefix="/var/run/dkim-filter"
+pidfile="${_pidprefix}.pid"
load_rc_config $name
-dkim_postcmd ()
+if [ -n "$2" ]; then
+ profile="$2"
+ if [ "x${milterdkim_profiles}" != "x" ]; then
+ pidfile="${_pidprefix}.${profile}.pid"
+ eval milterdkim_enable="\${milterdkim_${profile}_enable:-${milterdkim_enable}}"
+ eval milterdkim_socket="\${milterdkim_${profile}_socket:-}"
+ if [ "x${milterdkim_socket}" = "x" ];then
+ echo "You must define a socket (milterdkim_${profile}_socket)"
+ exit 1
+ fi
+ eval milterdkim_domain="\${milterdkim_${profile}_domain:-${milterdkim_domain}}"
+ eval milterdkim_key="\${milterdkim_${profile}_key:-${milterdkim_key}}"
+ eval milterdkim_flags="\${milterdkim_${profile}_flags:-${milterdkim_flags}}"
+ command_args="-l -p ${milterdkim_socket} -P ${pidfile}"
+ else
+ echo "$0: extra argument ignored"
+ fi
+else
+ if [ "x${milterdkim_profiles}" != "x" -a "x$1" != "x" ]; then
+ if [ "x$1" != "xrestart" ]; then
+ for profile in ${milterdkim_profiles}; do
+ echo "===> milterdkim profile: ${profile}"
+ %%PREFIX%%/etc/rc.d/milter-dkim.sh $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
+ milterdkim_flags=${milterdkim_flags}
+ command_args="-l -p ${milterdkim_socket} -P ${pidfile}"
+ fi
+fi
+
+dkim_prepcmd ()
{
if [ -S ${milterdkim_socket##local:} ] ; then
rm -f ${milterdkim_socket##local:}
diff --git a/mail/dkim-milter/pkg-message b/mail/dkim-milter/pkg-message
index 90324af..52b3029 100644
--- a/mail/dkim-milter/pkg-message
+++ b/mail/dkim-milter/pkg-message
@@ -8,4 +8,8 @@ INPUT_MAIL_FILTER(`dkim-filter', `S=unix:/var/run/dkim-filter, F=T, T=R:2m')
define(`confMILTER_MACROS_CONNECT', `j, {daemon_name}')
define(`confMILTER_MACROS_ENVFROM', `i, {auth_type}')
+And to run the milter from startup, add milterdkim_enable="YES" in
+your /etc/rc.conf.
+Extra options can be found in startup script.
+
************************************************************************
OpenPOWER on IntegriCloud