svn commit: r448274 - in head/mail/opendkim: . files

Steve Wills swills at FreeBSD.org
Fri Aug 18 20:49:18 UTC 2017


Author: swills
Date: Fri Aug 18 20:49:16 2017
New Revision: 448274
URL: https://svnweb.freebsd.org/changeset/ports/448274

Log:
  mail/opendkim: Add GID support to the rc script
  
  PR:		208056
  Submitted by:	Krzysztof <ports at bsdserwis.com>
  Approved by:	Daniel Austin <freebsd-ports at dan.me.uk> (maintainer)

Modified:
  head/mail/opendkim/Makefile
  head/mail/opendkim/files/milter-opendkim.in

Modified: head/mail/opendkim/Makefile
==============================================================================
--- head/mail/opendkim/Makefile	Fri Aug 18 20:34:25 2017	(r448273)
+++ head/mail/opendkim/Makefile	Fri Aug 18 20:49:16 2017	(r448274)
@@ -3,7 +3,7 @@
 
 PORTNAME=		opendkim
 PORTVERSION=		2.10.3
-PORTREVISION=		6
+PORTREVISION=		7
 CATEGORIES=		mail security
 MASTER_SITES=		SF/${PORTNAME} \
 			SF/${PORTNAME}/Previous%20Releases \

Modified: head/mail/opendkim/files/milter-opendkim.in
==============================================================================
--- head/mail/opendkim/files/milter-opendkim.in	Fri Aug 18 20:34:25 2017	(r448273)
+++ head/mail/opendkim/files/milter-opendkim.in	Fri Aug 18 20:49:16 2017	(r448274)
@@ -16,6 +16,7 @@
 # milteropendkim_enable (bool):   Set to "NO" by default.
 #                             Set it to "YES" to enable dkim-milter
 # milteropendkim_uid (str):       Set username to run milter.
+# milteropendkim_gid (str):       Set group to run milter.
 # milteropendkim_profiles (list): Set to "" by default.
 #                             Define your profiles here.
 # milteropendkim_cfgfile (str):   Configuration file. See opendkim.conf(5)
@@ -38,9 +39,11 @@ rcvar=milteropendkim_enable
 
 extra_commands="reload"
 start_precmd="dkim_prepcmd"
+start_postcmd="dkim_start_postcmd"
 stop_postcmd="dkim_postcmd"
 command="%%PREFIX%%/sbin/opendkim"
 _piddir="/var/run/milteropendkim"
+_piddir_perms="0755"
 pidfile="${_piddir}/pid"
 sig_reload="USR1"
 
@@ -51,6 +54,7 @@ load_rc_config $name
 #
 : ${milteropendkim_enable="NO"}
 : ${milteropendkim_uid="mailnull"}
+: ${milteropendkim_gid="mailnull"}
 : ${milteropendkim_cfgfile="%%PREFIX%%/etc/mail/opendkim.conf"}
 
 # Options other than above can be set with $milteropendkim_flags.
@@ -82,6 +86,9 @@ if [ -n "$2" ]; then
 	fi
 	if [ "x${milteropendkim_uid}" != "x" ];then
 	    _uid_prefix="-u"
+	    if [ "x${milteropendkim_gid}" != "x" ];then
+		milteropendkim_uid=${milteropendkim_uid}:${milteropendkim_gid}
+	    fi
 	fi
 	if [ "x${milteropendkim_domain}" != "x" ];then
 	    milteropendkim_domain="-d ${milteropendkim_domain}"
@@ -127,6 +134,9 @@ else
 	fi
 	if [ "x${milteropendkim_uid}" != "x" ];then
 	    _uid_prefix="-u"
+	    if [ "x${milteropendkim_gid}" != "x" ];then
+		milteropendkim_uid=${milteropendkim_uid}:${milteropendkim_gid}
+	    fi
 	fi
 	if [ "x${milteropendkim_domain}" != "x" ];then
 	    milteropendkim_domain="-d ${milteropendkim_domain}"
@@ -156,6 +166,22 @@ dkim_prepcmd ()
     fi
     if [ -n "${milteropendkim_uid}" ] ; then
 	chown ${milteropendkim_uid} ${_piddir}
+    fi
+    if [ -n "${milteropendkim_gid}" ] ; then
+       chgrp ${milteropendkim_gid} ${_piddir}
+       _piddir_perms="0775"
+    fi
+    chmod ${_piddir_perms} ${_piddir}
+}
+
+dkim_start_postcmd ()
+{
+    # postcmd is executed too fast and socket is not created before checking...
+    sleep 1
+    if [ -S ${milteropendkim_socket##local:} ] ; then
+        chmod ${_piddir_perms} ${milteropendkim_socket##local:}
+    elif [ -S ${milteropendkim_socket##unix:} ] ; then
+        chmod ${_piddir_perms} ${milteropendkim_socket##unix:}
     fi
 }
 


More information about the svn-ports-all mailing list