[Bug 258011] mail/opendkim does not restart properly with "service -R"

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 31 Aug 2021 15:31:30 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258011

--- Comment #1 from ml@netfence.it ---
After some more investigation:

1) opendkim does not start if called from /root:
I.e.
# cd /root
# mkdir /var/run/milteropendkim
# chown mailnull:mailnull /var/run/milteropendkim/
# chmod 755 /var/run/milteropendkim/
#/usr/local/sbin/opendkim -l -u mailnull:mailnull -P
/var/run/milteropendkim/pid -x /usr/local/etc/mail/opendkim.conf -f
opendkim: socket cleanup failed: Permission denied
# cd /any_other_dir
#/usr/local/sbin/opendkim -l -u mailnull:mailnull -P
/var/run/milteropendkim/pid -x /usr/local/etc/mail/opendkim.conf -f
(works)

I don't underestand why; possibly it's a bug upstream? I have not looked into
this.



2) As a consequence, "/usr/local/etc/rc.d/milter-opendkim start" does NOT work
if called from /root, but does if called from any other directory.



3) "service -R" does not set current dir (bug???), so the above still applies:
if launched from /root it will fail to start milter-opendkim, while succeeding
if run from any other directory.
("service milter-opendkim start" always works as /usr/sbin/service does "cd /"
before calling any rc script in this case).




A simple workaround would be to put "cd /" as the second-last line of
${PREFIX}/etc/rc.d/milter-opendkim (just before 'run_rc_command "$1"').

-- 
You are receiving this mail because:
You are the assignee for the bug.