[__opendkim] add debian support

This commit is contained in:
fnux 2024-05-21 15:12:54 +02:00
parent b7ba43553b
commit d97fb9a434
No known key found for this signature in database
GPG key ID: 4502C902C00A1E12
4 changed files with 47 additions and 3 deletions

View file

@ -3,6 +3,9 @@
echo "# Managed remotely, manual changes will be lost."
# Used for OS-specific configuration.
os=$(cat "${__global:?}/explorer/os")
# Optional chdir(2)
if [ "$BASEDIR" ];
then
@ -63,3 +66,8 @@ if [ "$USERID" ];
then
printf "UserID %s\n" "$USERID"
fi
if [ "$PIDFILE" ];
then
printf "PidFile %s\n" "$PIDFILE"
fi

View file

@ -14,8 +14,8 @@ installation and basic configuration of an instance of OpenDKIM.
Note that this type does not generate or ensure that a key is present: use
`cdist-type__opendkim-genkey(7)` for that.
Note that this type is currently only implemented for Alpine Linux and FreeBSD.
Please contribute an implementation if you can.
Note that this type is currently only implemented for Debian, Alpine Linux and
FreeBSD. Please contribute an implementation if you can.
REQUIRED PARAMETERS
@ -45,6 +45,9 @@ custom-config
The string following this parameter is appended as-is in the configuration, to
enable more complex configurations.
pidfile
Specifies the path to a file that should be created at process start
containing the process ID.
BOOLEAN PARAMETERS
------------------

View file

@ -21,13 +21,20 @@
os=$(cat "${__global:?}/explorer/os")
CFG_DIR="/etc/opendkim"
CFG_FILE="$CFG_DIR/opendkim.conf"
service="opendkim"
case "$os" in
'alpine')
:
;;
'debian')
CFG_DIR="/etc/dkimkeys"
CFG_FILE="/etc/opendkim.conf"
;;
'freebsd')
CFG_DIR="/usr/local/etc/mail"
CFG_FILE="$CFG_DIR/opendkim.conf"
service="milter-opendkim"
;;
*)
@ -70,12 +77,37 @@ if [ -f "${__object:?}/parameter/userid" ]; then
export USERID
fi
if [ -f "${__object:?}/parameter/pidfile" ]; then
PIDFILE="$(cat "${__object:?}/parameter/pidfile")"
export PIDFILE
fi
# Debian: set configuration specific to debian packaging if no explicit value
# is requested.
if [ "$os" = "debian" ]; then
# In Debian, opendkim runs as user "opendkim". A umask of 007 is required when
# using a local socket with MTAs that access the socket as a non-privileged
# user (for example, Postfix). You may need to add user "postfix" to group
# "opendkim" in that case.
if [ -z "$USERID" ]; then
export USERID="opendkim"
fi
if [ -z "$UMASK" ]; then
export UMASK="007"
fi
if [ -z "$PIDFILE" ]; then
export PIDFILE="/run/opendkim/opendkim.pid"
fi
fi
# Boolean parameters
[ -f "${__object:?}/parameter/syslog" ] && export SYSLOG=yes
# Generate and deploy configuration file.
source_file="${__object:?}/files/opendkim.conf"
target_file="${CFG_DIR}/opendkim.conf"
target_file="${CFG_FILE}"
mkdir -p "${__object:?}/files"

View file

@ -4,3 +4,4 @@ subdomains
umask
userid
custom-config
pidfile