Bug 264350 - mail/opendkim: 2.10.3_16 fails to start without PidFile specified in opendkim.conf or UserId specified with [:group]
Summary: mail/opendkim: 2.10.3_16 fails to start without PidFile specified in opendkim...
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords: needs-patch, needs-qa
Depends on:
Blocks:
 
Reported: 2022-05-30 14:27 UTC by Andrei Charypov
Modified: 2023-05-29 05:59 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (freebsd-ports)
koobs: merge-quarterly?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrei Charypov 2022-05-30 14:27:19 UTC
opndkim-2.10.3_16 does not start without PidFile parameter in opendkim.conf and with UserId parameter with group included:
=======================================================
##  Change to user "userid" before starting normal operation?  May include
##  a group ID as well, separated from the userid by a colon.

# UserID		userid
UserID			mailnull:mailnull
=======================================================

Without colon

=======================================================
UserID			mailnull
=======================================================

works fine.

This is a result of erroneous return of function get_pidfile_from_conf from /etc/rc.subr

Test script:
=======================================================
#!/bin/sh

#
# get_pidfile_from_conf string file
#
#       Takes a string to search for in the specified file.
#       Ignores lines with traditional comment characters.
#
# Example:
#
# if get_pidfile_from_conf string file; then
#       pidfile="$_pidfile_from_conf"
# else
#       pidfile='appropriate default'
# fi
#
get_pidfile_from_conf()
{
        if [ -z "$1" -o -z "$2" ]; then
                err 3 "USAGE: get_pidfile_from_conf string file ($name)"
        fi

        local string file line

        string="$1" ; file="$2"

        if [ ! -s "$file" ]; then
                err 3 "get_pidfile_from_conf: $file does not exist ($name)"
        fi

        while read line; do
                case "$line" in
                *[#\;]*${string}*)      continue ;;
                *${string}*)            break ;;
                esac
        done < $file

        if [ -n "$line" ]; then
                line=${line#*/}
                _pidfile_from_conf="/${line%%[\"\;]*}"
        else
                return 1
        fi
}

    if get_pidfile_from_conf PidFile /usr/local/etc/mail/opendkim.conf; then
        pidfile="$_pidfile_from_conf"
        echo $pidfile
    else
        pidfile="/var/run/milteropendkim/${profile:-pid}"
    fi
=======================================================
Result with colon (UserID			mailnull:mailnull):
/UserID mailnull:mailnull

Result without colon (UserID			mailnull) - empty.
Comment 1 takefu 2023-05-29 05:59:19 UTC
(In reply to Andrei Charypov from comment #0)

Prefer descriptions in /etc/rc.conf[.local]
ex.
milteropendkim_uid=nobody
milteropendkim_gid=nogroup

If there is no description, mailnull:mailnull is set by /usr/local/etc/rc.d/milter-opendkim processing, so Entries in /usr/local/etc/mail/opendkim.conf are ignored.
Therefore the test script does not work as expected.