From owner-freebsd-ports-bugs@FreeBSD.ORG Tue Jan 17 03:00:20 2006 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7A4BB16A41F for ; Tue, 17 Jan 2006 03:00:20 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id E0BDE43D46 for ; Tue, 17 Jan 2006 03:00:19 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k0H30J9e055167 for ; Tue, 17 Jan 2006 03:00:19 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k0H30JQ0055166; Tue, 17 Jan 2006 03:00:19 GMT (envelope-from gnats) Resent-Date: Tue, 17 Jan 2006 03:00:19 GMT Resent-Message-Id: <200601170300.k0H30JQ0055166@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Hirohisa Yamaguchi Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8425516A41F for ; Tue, 17 Jan 2006 02:57:01 +0000 (GMT) (envelope-from umq@ueo.co.jp) Received: from mvs2.plala.or.jp (c158130.vh.plala.or.jp [210.150.158.130]) by mx1.FreeBSD.org (Postfix) with ESMTP id A797E43D49 for ; Tue, 17 Jan 2006 02:57:00 +0000 (GMT) (envelope-from umq@ueo.co.jp) Received: from eupheme.kaumoge.org ([58.93.18.28]) by mvs2.plala.or.jp with ESMTP id <20060117025659.WHDI16182.mvs2.plala.or.jp@eupheme.kaumoge.org> for ; Tue, 17 Jan 2006 11:56:59 +0900 Received: from calliope.kaumoge.org (calliope.kaumoge.org [192.168.233.120]) by eupheme.kaumoge.org (8.12.11/8.12.11/20030713) with ESMTP id k0H2vKmG083505 for ; Tue, 17 Jan 2006 11:57:20 +0900 (JST) (envelope-from umq@ueo.co.jp) Message-Id: <86bqyb5zph.wl%umq@ueo.co.jp> Date: Tue, 17 Jan 2006 11:56:58 +0900 From: Hirohisa Yamaguchi To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/91895: [patch] mail/dk-milter startup script to run multiple instances X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Hirohisa Yamaguchi List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jan 2006 03:00:20 -0000 >Number: 91895 >Category: ports >Synopsis: [patch] mail/dk-milter startup script to run multiple instances >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Jan 17 03:00:19 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Hirohisa Yamaguchi >Release: FreeBSD 7.0-CURRENT amd64 >Organization: >Environment: System: FreeBSD calliope.kaumoge.org 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Mon Nov 7 17:32:33 JST 2005 root@calliope.kaumoge.org:/usr/obj/usr/src/sys/CALLIOPE64 amd64 >Description: In some cases, several instances of a milter with different configuration run simultaneously; e.g. different key with different selector, or domain for dk-milter. This patch enables multiple instantiation. # almost the same as ports/91894 >How-To-Repeat: >Fix: the patch follows: diff -rpu ports.orig/mail/dk-milter/files/milter-dk.sh.in ports/mail/dk-milter/files/milter-dk.sh.in --- ports.orig/mail/dk-milter/files/milter-dk.sh.in Sun Jan 15 18:11:04 2006 +++ ports/mail/dk-milter/files/milter-dk.sh.in Tue Jan 17 11:16:54 2006 @@ -3,9 +3,9 @@ # $FreeBSD: ports/mail/dk-milter/files/milter-dk.sh.in,v 1.2 2006/01/15 09:11:04 pav Exp $ # -# PROVIDE: milterdk +# PROVIDE: milter-dk # REQUIRE: DAEMON -# BEFORE: sendmail +# BEFORE: mail # KEYWORD: shutdown # Define these milterdk_* variables in one of these files: @@ -13,28 +13,83 @@ # /etc/rc.conf.local # /etc/rc.conf.d/milterdk # +# milterdk_enable (bool): Set to "NO" by default. +# Set it to "YES" to enable dk-milter +# milterdk_profiles (list): Set to "" by default. +# Define your profiles here. +# milterdk_socket (str): Path to the milter socket. +# milterdk_domain (str): Domainpart of From: in mails to sign. +# milterdk_key (str): Path to the private key file to sign with. +# milterdk_flags (str): Flags passed to start command. +# +# milterdk_${profile}_* : Variables per profile. +# Sockets must be different from each other. +# # DO NOT CHANGE THESE DEFAULT VALUES HERE # milterdk_enable=${milterdk_enable:-"NO"} +milterdk_profiles=${milterdk_profiles:-} milterdk_socket=${milterdk_socket:-"local:/var/run/dk-filter"} -milterdk_pid=${milterdk_pid:-"/var/run/dk-filter.pid"} milterdk_domain=${milterdk_domain:-"example.com"} milterdk_key=${milterdk_key:-"/var/db/domainkeys/default.key.pem"} -milterdk_flags=${milterdk_flags:-"-d ${milterdk_domain} -c nofws -H -m MSA \ --s ${milterdk_key} -S default"} +## milterdk_flags expands escaped variables later. +milterdk_flags=${milterdk_flags:-"-d \${milterdk_domain\} -c nofws -H -m MSA \ +-s \${milterdk_key\} -S default"} . %%RC_SUBR%% name="milterdk" -pidfile=${milterdk_pid} rcvar=`set_rcvar` + +start_precmd="dk_prepcmd" +stop_postcmd="dk_prepcmd" command="%%PREFIX%%/libexec/dk-filter" -command_args="-l -p ${milterdk_socket} -P ${milterdk_pid}" -stop_postcmd="dk_postcmd" +_pidprefix="/var/run/dk-filter" +pidfile="${_pidprefix}.pid" load_rc_config $name -dk_postcmd () +if [ -n "$2" ]; then + profile="$2" + if [ "x${milterdk_profiles}" != "x" ]; then + pidfile="${_pidprefix}.${profile}.pid" + eval milterdk_enable="\${milterdk_${profile}_enable:-${milterdk_enable}}" + eval milterdk_socket="\${milterdk_${profile}_socket:-}" + if [ "x${milterdk_socket}" = "x" ];then + echo "You must define a socket (milterdk_${profile}_socket)" + exit 1 + fi + eval milterdk_domain="\${milterdk_${profile}_domain:-${milterdk_domain}}" + eval milterdk_key="\${milterdk_${profile}_key:-${milterdk_key}}" + eval milterdk_flags="\${milterdk_${profile}_flags:-${milterdk_flags}}" + command_args="-l -p ${milterdk_socket} -P ${pidfile}" + else + echo "$0: extra argument ignored" + fi +else + if [ "x${milterdk_profiles}" != "x" -a "x$1" != "x" ]; then + if [ "x$1" != "xrestart" ]; then + for profile in ${milterdk_profiles}; do + echo "===> milterdk profile: ${profile}" + %%PREFIX%%/etc/rc.d/milter-dk.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 + milterdk_flags=${milterdk_flags} + command_args="-l -p ${milterdk_socket} -P ${pidfile}" + fi +fi + +dk_prepcmd () { if [ -S ${milterdk_socket##local:} ] ; then rm -f ${milterdk_socket##local:} diff -rpu ports.orig/mail/dk-milter/pkg-message ports/mail/dk-milter/pkg-message --- ports.orig/mail/dk-milter/pkg-message Sun May 22 22:39:11 2005 +++ ports/mail/dk-milter/pkg-message Tue Jan 17 11:22:32 2006 @@ -8,4 +8,8 @@ INPUT_MAIL_FILTER(`dk-filter', `S=unix:/ define(`confMILTER_MACROS_CONNECT', `j, {daemon_name}') define(`confMILTER_MACROS_ENVFROM', `i, {auth_type}') +And to run the milter from startup, add milterdk_enable="YES" in +your /etc/rc.conf. +Extra options can be found in startup script. + ************************************************************************ >Release-Note: >Audit-Trail: >Unformatted: