diff -ruN mail/opendkim/files/milter-opendkim.in mail/opendkim.new/files/milter-opendkim.in --- mail/opendkim/files/milter-opendkim.in 2014-01-24 01:14:07.000000000 +0100 +++ mail/opendkim.new/files/milter-opendkim.in 2016-03-16 12:30:14.468011512 +0100 @@ -38,6 +38,7 @@ extra_commands="reload" start_precmd="dkim_prepcmd" +start_postcmd="dkim_start_postcmd" stop_postcmd="dkim_postcmd" command="%%PREFIX%%/sbin/opendkim" _piddir="/var/run/milteropendkim" @@ -51,6 +52,7 @@ # : ${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. @@ -157,6 +159,21 @@ if [ -n "${milteropendkim_uid}" ] ; then chown ${milteropendkim_uid} ${_piddir} fi + if [ -n "${milteropendkim_gid}" ] ; then + chgrp ${milteropendkim_gid} ${_piddir} + fi + chmod 0775 ${_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 0775 ${milteropendkim_socket##local:} + elif [ -S ${milteropendkim_socket##unix:} ] ; then + chmod 0775 ${milteropendkim_socket##unix:} + fi } dkim_postcmd()