diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2019-04-05 21:17:31 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2019-04-05 21:17:31 +0100 |
commit | dc7cbdfa65fd814b3b9aa3c56257da201109e807 (patch) | |
tree | c85d72f6f31f21f178069c9d41d41a7c1ff4b362 /mail-filter/opendkim/files | |
parent | 0706fc6986773f4e4d391deff4ad5143c464ea4e (diff) |
gentoo resync : 05.04.2019
Diffstat (limited to 'mail-filter/opendkim/files')
-rw-r--r-- | mail-filter/opendkim/files/opendkim-r3.service | 15 | ||||
-rw-r--r-- | mail-filter/opendkim/files/opendkim.confd | 18 | ||||
-rw-r--r-- | mail-filter/opendkim/files/opendkim.init.r5 | 73 | ||||
-rw-r--r-- | mail-filter/opendkim/files/opendkim.init.r6 | 77 | ||||
-rw-r--r-- | mail-filter/opendkim/files/opendkim.service.conf | 2 | ||||
-rw-r--r-- | mail-filter/opendkim/files/opendkim.service.r4 | 16 |
6 files changed, 201 insertions, 0 deletions
diff --git a/mail-filter/opendkim/files/opendkim-r3.service b/mail-filter/opendkim/files/opendkim-r3.service new file mode 100644 index 000000000000..a102c0a69006 --- /dev/null +++ b/mail-filter/opendkim/files/opendkim-r3.service @@ -0,0 +1,15 @@ +[Unit] +Description=DomainKeys Identified Mail (DKIM) Milter +Documentation=man:opendkim(8) man:opendkim.conf(5) man:opendkim-genkey(8) man:opendkim-genzone(8) man:opendkim-testadsp(8) man:opendkim-testkey http://www.opendkim.org/docs.html +After=network.target nss-lookup.target syslog.target + +[Service] +ExecStart=/usr/sbin/opendkim -f -x /etc/opendkim/opendkim.conf -p $OPENDKIM_SOCKET +ExecReload=/bin/kill -USR1 $MAINPID +RuntimeDirectory=opendkim +RuntimeDirectoryMode=0750 +User=opendkim +Group=opendkim + +[Install] +WantedBy=multi-user.target diff --git a/mail-filter/opendkim/files/opendkim.confd b/mail-filter/opendkim/files/opendkim.confd new file mode 100644 index 000000000000..03bb8d88e2b5 --- /dev/null +++ b/mail-filter/opendkim/files/opendkim.confd @@ -0,0 +1,18 @@ +# This overrides the "Socket" line in your opendkim.conf configuration +# file, and is required (so that we don't have to try to parse the +# configuration file in an init script). The default below listens +# on the network. +# +# If you would rather use a local (UNIX) socket, try the following: +# +# WARNING: The directory containing this socket will have its owner +# changed to "opendkim". +# +#OPENDKIM_SOCKET="local:/run/opendkim/opendkim.sock" +# +# More examples of valid socket syntax can be found in the opendkim(8) +# man page, under the "-p socketspec" option. However -- contrary to +# what that man page says -- if you want to use a local socket, the +# "local:" prefix is not optional here. +# +OPENDKIM_SOCKET="inet:8891@localhost" diff --git a/mail-filter/opendkim/files/opendkim.init.r5 b/mail-filter/opendkim/files/opendkim.init.r5 new file mode 100644 index 000000000000..ad45f420e3c4 --- /dev/null +++ b/mail-filter/opendkim/files/opendkim.init.r5 @@ -0,0 +1,73 @@ +#!/sbin/openrc-run +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +CONFFILE="/etc/opendkim/${RC_SVCNAME}.conf" +required_files="${CONFFILE}" + +command="/usr/sbin/opendkim" +pidfile="/run/${RC_SVCNAME}.pid" +command_args="-P ${pidfile} -x ${CONFFILE} -p ${OPENDKIM_SOCKET}" + +depend() { + use dns logger net + before mta +} + +check_cfg() { + # + # The opendkim.conf man page says, + # + # For parameters that are Boolean in nature, only the first byte + # of the value is processed... For negative values, the following + # are accepted: "F", "f", "N", "n", "0".' + # + if grep --quiet '^[[:space:]]*Background[[:space:]]\+[FfNn0]' \ + "${CONFFILE}"; then + eerror "${RC_SVCNAME} cannot run in the foreground!" + return 1 + fi +} + +start_pre() { + # If this isn't a restart, make sure that the user's config isn't + # busted before we try to start the daemon (this will produce + # better error messages than if we just try to start it blindly). + # + # If, on the other hand, this *is* a restart, then the stop_pre + # action will have ensured that the config is usable and we don't + # need to do that again. + if [ "${RC_CMD}" != "restart" ]; then + check_cfg || return $? + fi + + if [ -S "${OPENDKIM_SOCKET}" ] && ! fuser -s "${OPENDKIM_SOCKET}"; then + # Remove stalled Unix socket if no other process is + # using it + if ! rm "${UNIX_SOCKET}"; then + eerror "failed to remove stale unix socket ${OPENDKIM_SOCKET}" + return 2 + fi + fi + + # This relies on the "local:" prefix being there, but the conf.d + # file explicitly states that it's not optional (contrary to what + # the opendkim(8) man page says). + if [ "${OPENDKIM_SOCKET#local:}" != "${OPENDKIM_SOCKET}" ]; then + # The socket begins with "local:" + OPENDKIM_SOCKET_PATH="${OPENDKIM_SOCKET#local:}" + OPENDKIM_SOCKET_DIR="${OPENDKIM_SOCKET_PATH%/*}" + + # This is dangerous, but there's a big warning about it + # in the conf.d file. + checkpath --directory --owner opendkim "${OPENDKIM_SOCKET_DIR}" + fi +} + +stop_pre() { + # If this is a restart, check to make sure the user's config + # isn't busted before we stop the running daemon. + if [ "${RC_CMD}" = "restart" ]; then + check_cfg || return $? + fi +} diff --git a/mail-filter/opendkim/files/opendkim.init.r6 b/mail-filter/opendkim/files/opendkim.init.r6 new file mode 100644 index 000000000000..95aa971fd88e --- /dev/null +++ b/mail-filter/opendkim/files/opendkim.init.r6 @@ -0,0 +1,77 @@ +#!/sbin/openrc-run +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +CONFFILE="/etc/opendkim/${RC_SVCNAME}.conf" +required_files="${CONFFILE}" + +command="/usr/sbin/opendkim" +pidfile="/run/${RC_SVCNAME}.pid" +command_args="-P ${pidfile} -x ${CONFFILE} -p ${OPENDKIM_SOCKET}" + +depend() { + use dns logger net + before mta +} + +check_cfg() { + # + # The opendkim.conf man page says, + # + # For parameters that are Boolean in nature, only the first byte + # of the value is processed... For negative values, the following + # are accepted: "F", "f", "N", "n", "0".' + # + if grep --quiet '^[[:space:]]*Background[[:space:]]\+[FfNn0]' \ + "${CONFFILE}"; then + eerror "${RC_SVCNAME} cannot run in the foreground!" + return 1 + fi + if ! ${command} -n ${command_args}; then + eerror "Configuration check failed" + return 1 + fi +} + +start_pre() { + # If this isn't a restart, make sure that the user's config isn't + # busted before we try to start the daemon (this will produce + # better error messages than if we just try to start it blindly). + # + # If, on the other hand, this *is* a restart, then the stop_pre + # action will have ensured that the config is usable and we don't + # need to do that again. + if [ "${RC_CMD}" != "restart" ]; then + check_cfg || return $? + fi + + if [ -S "${OPENDKIM_SOCKET}" ] && ! fuser -s "${OPENDKIM_SOCKET}"; then + # Remove stalled Unix socket if no other process is + # using it + if ! rm "${UNIX_SOCKET}"; then + eerror "failed to remove stale unix socket ${OPENDKIM_SOCKET}" + return 2 + fi + fi + + # This relies on the "local:" prefix being there, but the conf.d + # file explicitly states that it's not optional (contrary to what + # the opendkim(8) man page says). + if [ "${OPENDKIM_SOCKET#local:}" != "${OPENDKIM_SOCKET}" ]; then + # The socket begins with "local:" + OPENDKIM_SOCKET_PATH="${OPENDKIM_SOCKET#local:}" + OPENDKIM_SOCKET_DIR="${OPENDKIM_SOCKET_PATH%/*}" + + # This is dangerous, but there's a big warning about it + # in the conf.d file. + checkpath --directory --owner opendkim "${OPENDKIM_SOCKET_DIR}" + fi +} + +stop_pre() { + # If this is a restart, check to make sure the user's config + # isn't busted before we stop the running daemon. + if [ "${RC_CMD}" = "restart" ]; then + check_cfg || return $? + fi +} diff --git a/mail-filter/opendkim/files/opendkim.service.conf b/mail-filter/opendkim/files/opendkim.service.conf new file mode 100644 index 000000000000..380ba22ac941 --- /dev/null +++ b/mail-filter/opendkim/files/opendkim.service.conf @@ -0,0 +1,2 @@ +[Service] +Environment="OPENDKIM_SOCKET=inet:8891@localhost" diff --git a/mail-filter/opendkim/files/opendkim.service.r4 b/mail-filter/opendkim/files/opendkim.service.r4 new file mode 100644 index 000000000000..8c366007c009 --- /dev/null +++ b/mail-filter/opendkim/files/opendkim.service.r4 @@ -0,0 +1,16 @@ +[Unit] +Description=DomainKeys Identified Mail (DKIM) Milter +Documentation=man:opendkim(8) man:opendkim.conf(5) man:opendkim-genkey(8) man:opendkim-genzone(8) man:opendkim-testadsp(8) man:opendkim-testkey http://www.opendkim.org/docs.html +After=network.target nss-lookup.target syslog.target + +[Service] +ExecStartPre=/usr/sbin/opendkim -n -f -x /etc/opendkim/opendkim.conf -p $OPENDKIM_SOCKET +ExecStart=/usr/sbin/opendkim -f -x /etc/opendkim/opendkim.conf -p $OPENDKIM_SOCKET +ExecReload=/bin/kill -USR1 $MAINPID +RuntimeDirectory=opendkim +RuntimeDirectoryMode=0750 +User=opendkim +Group=opendkim + +[Install] +WantedBy=multi-user.target |