From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 64B1E138334 for ; Wed, 24 Apr 2019 12:46:37 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 73E36E0922; Wed, 24 Apr 2019 12:46:36 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 48AB1E0922 for ; Wed, 24 Apr 2019 12:46:36 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E016A3423D6 for ; Wed, 24 Apr 2019 12:46:34 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 4651F4F6 for ; Wed, 24 Apr 2019 12:46:33 +0000 (UTC) From: "Michael Orlitzky" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michael Orlitzky" Message-ID: <1556109866.41f1717e1094b877bbede64784644f66fd1825c5.mjo@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: mail-filter/opendkim/, mail-filter/opendkim/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: mail-filter/opendkim/files/opendkim-2.10.3-openrc.patch mail-filter/opendkim/opendkim-2.10.3-r11.ebuild X-VCS-Directories: mail-filter/opendkim/files/ mail-filter/opendkim/ X-VCS-Committer: mjo X-VCS-Committer-Name: Michael Orlitzky X-VCS-Revision: 41f1717e1094b877bbede64784644f66fd1825c5 X-VCS-Branch: master Date: Wed, 24 Apr 2019 12:46:33 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 217ba7f9-c515-45ac-8220-f0413e476643 X-Archives-Hash: 5335240715ab1b60a88aa803e0c33aba commit: 41f1717e1094b877bbede64784644f66fd1825c5 Author: Ralph Seichter seichter de> AuthorDate: Wed Apr 17 15:27:19 2019 +0000 Commit: Michael Orlitzky gentoo org> CommitDate: Wed Apr 24 12:44:26 2019 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=41f1717e mail-filter/opendkim: Improved OpenRC and systemd support Michael Orlitzky and I have been working on improved OpenRC support for OpenDKIM. Our pull request has not yet been accepted upstream (not even acknowledged, in fact). The multi-file patch adds our changes to the existing Gentoo ebuild. Changes to the upstream build files include: * configure.ac: Added workaround to support @runstatedir@. On modern systems /run replaces /var/run, so using @runstatedir@ instead of @localstatedir /run is preferable. Autoconf 2.70 will support @runstatedir@ , but it has not been released yet, so a workaround is required for version 2.61. * contrib/systemd: Use @runstatedir in opendkim.service.in, enable full @VARIABLE@ substitution, fix inconsistencies in the systemd service file, add tmpfiles.d configuration file (https://bugs.gentoo.org/606978). * opendkim/opendkim.conf.*.in: Use @runstatedir@ in PidFile paths, enable full @VARIABLE@ substitution. Bug: https://bugs.gentoo.org/606978 Signed-off-by: Ralph Seichter seichter.de> Package-Manager: Portage-2.3.62, Repoman-2.3.11 Signed-off-by: Michael Orlitzky gentoo.org> .../opendkim/files/opendkim-2.10.3-openrc.patch | 303 +++++++++++++++++++++ mail-filter/opendkim/opendkim-2.10.3-r11.ebuild | 222 +++++++++++++++ 2 files changed, 525 insertions(+) diff --git a/mail-filter/opendkim/files/opendkim-2.10.3-openrc.patch b/mail-filter/opendkim/files/opendkim-2.10.3-openrc.patch new file mode 100644 index 00000000000..9033b84281c --- /dev/null +++ b/mail-filter/opendkim/files/opendkim-2.10.3-openrc.patch @@ -0,0 +1,303 @@ +diff --git a/Makefile.am b/Makefile.am +index ee2d21ab..b085b988 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -39,6 +39,52 @@ DISTCLEANFILES = opendkim-@VERSION@.tar.gz + # though. + DISTCHECK_CONFIGURE_FLAGS=--enable-vbr --with-lua --enable-stats --with-odbx --with-db --with-openssl=/usr/local --enable-atps --enable-replace_rules + ++ ++# ++# Handle some scripts and configuration files that need @VARIABLE@ ++# replacements here, so that we can share the rules (which are ++# identical) between all of the targets. ++# ++ ++# We want to *build and install* these on the target machine. ++nodist_doc_DATA = contrib/OpenRC/opendkim.openrc \ ++ contrib/systemd/opendkim.service \ ++ contrib/systemd/opendkim.tmpfiles \ ++ opendkim/opendkim.conf.simple \ ++ opendkim/opendkim.conf.simple-verify ++ ++# Custom variable to keep the rule below as sane as possible. ++doc_DATA_intermediate = contrib/OpenRC/opendkim.openrc.in ++ ++# We want to *ship* these. ++EXTRA_DIST = contrib/OpenRC/opendkim.openrc.in.in \ ++ contrib/systemd/opendkim.service.in \ ++ contrib/systemd/opendkim.tmpfiles.in \ ++ opendkim/opendkim.conf.simple.in \ ++ opendkim/opendkim.conf.simple-verify.in ++ ++# The next rule allow us to replace bindir, libdir, etc. within ++# files. The example is taken from the autoconf documentation and can ++# be found in the "Installation Directory Variables" section. ++edit = sed -e 's|@DOMAIN[@]|$(DOMAIN)|g' \ ++ -e 's|@RUNSTATEDIR[@]|$(runstatedir)|g' \ ++ -e 's|@SBINDIR[@]|$(sbindir)|g' \ ++ -e 's|@SYSCONFDIR[@]|$(sysconfdir)|g' ++ ++# This rule includes EVERY source/intermediate file as a dependency of ++# EVERY output file, which is clearly wrong, but it may be the best we ++# can do without duplication. At least it's the right kind of wrong, ++# and rebuilds too often rather than not often enough. ++$(nodist_doc_DATA): $(doc_DATA_intermediate) $(EXTRA_DIST) Makefile ++ rm -f $@ $@.tmp ++ srcdir=''; \ ++ test -f ./$@.in || srcdir=$(srcdir)/; \ ++ $(edit) $${srcdir}$@.in > $@.tmp ++ mv $@.tmp $@ ++ ++ ++ ++ + $(DIST_ARCHIVES): distcheck + + $(DIST_ARCHIVES).md5: $(DIST_ARCHIVES) +diff --git a/configure.ac b/configure.ac +index 76914fd9..a478bb83 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -65,6 +65,9 @@ AC_PROG_CC_C99 + AM_PROG_CC_C_O + AC_PROG_LIBTOOL + ++# Used by the OpenRC service script, at least. ++AC_PROG_GREP ++ + PKG_PROG_PKG_CONFIG + + # +@@ -2628,6 +2631,11 @@ AC_SUBST(SPECCONFIGURE) + AC_SUBST(SPECREQUIRES) + AC_SUBST(SPECBUILDREQUIRES) + ++# Autoconf 2.70 will support this, and many distros patch it in, ++# but Autoconf 2.70 hasn't actually been released yet. ++AS_IF([test -z "${runstatedir}"], [runstatedir='${localstatedir}/run']) ++AC_SUBST([runstatedir]) ++ + # + # Finish up + # +@@ -2639,6 +2647,7 @@ AC_OUTPUT([ Makefile + contrib/docs/Makefile + contrib/init/Makefile + contrib/init/generic/Makefile ++ contrib/OpenRC/opendkim.openrc.in + contrib/init/redhat/Makefile + contrib/init/redhat/opendkim + contrib/init/redhat/opendkim-default-keygen +@@ -2650,8 +2659,6 @@ AC_OUTPUT([ Makefile + contrib/spec/Makefile + contrib/spec/opendkim.spec + contrib/stats/Makefile +- contrib/systemd/Makefile +- contrib/systemd/opendkim.service + libopendkim/opendkim.pc libopendkim/Makefile + libopendkim/docs/Makefile + libopendkim/tests/Makefile +@@ -2664,8 +2671,6 @@ AC_OUTPUT([ Makefile + opendkim/opendkim-lua.3 + opendkim/opendkim-testkey.8 opendkim/opendkim-stats.8 + opendkim/opendkim-testmsg.8 opendkim/opendkim.conf.5 +- opendkim/opendkim.conf.simple +- opendkim/opendkim.conf.simple-verify + opendkim/opendkim-atpszone.8 opendkim/opendkim-spam.1 + opendkim/tests/Makefile + stats/Makefile stats/opendkim-importstats.8 +diff --git a/contrib/Makefile.am b/contrib/Makefile.am +index 76df01cd..401130bb 100644 +--- a/contrib/Makefile.am ++++ b/contrib/Makefile.am +@@ -3,6 +3,6 @@ + + #AUTOMAKE_OPTIONS = foreign + +-SUBDIRS = convert docs init ldap lua patches repute spec stats systemd ++SUBDIRS = convert docs init ldap lua patches repute spec stats + + dist_doc_DATA = README +diff --git a/contrib/OpenRC/.gitignore b/contrib/OpenRC/.gitignore +new file mode 100644 +index 00000000..af0aa700 +--- /dev/null ++++ b/contrib/OpenRC/.gitignore +@@ -0,0 +1,2 @@ ++opendkim.openrc ++opendkim.openrc.in +diff --git a/contrib/OpenRC/opendkim.openrc.in.in b/contrib/OpenRC/opendkim.openrc.in.in +new file mode 100644 +index 00000000..d9631cdf +--- /dev/null ++++ b/contrib/OpenRC/opendkim.openrc.in.in +@@ -0,0 +1,54 @@ ++#!/sbin/openrc-run ++# Copyright 1999-2019 Gentoo Authors ++# Distributed under the terms of the GNU General Public License v2 ++ ++CONFFILE="@SYSCONFDIR@/opendkim/${RC_SVCNAME}.conf" ++required_files="${CONFFILE}" ++ ++command="@SBINDIR@/opendkim" ++pidfile="@RUNSTATEDIR@/${RC_SVCNAME}.pid" ++command_args="-P ${pidfile} -x ${CONFFILE}" ++extra_commands="checkconfig" ++ ++depend() { ++ use dns logger net ++ before mta ++} ++ ++checkconfig() { ++ # ++ # 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@ '^[[:space:]]*Background[[:space:]]\+[FfNn0]' "${CONFFILE}" \ ++ >/dev/null 2>&1; then ++ eend 1 "${RC_SVCNAME} cannot run in the foreground!" ++ fi ++ if ! "${command}" -n "${command_args}"; then ++ eend 1 "${RC_SVCNAME} configuration check failed" ++ 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 ++ checkconfig || return $? ++ 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 ++ checkconfig || return $? ++ fi ++} +diff --git a/contrib/systemd/Makefile.am b/contrib/systemd/Makefile.am +deleted file mode 100644 +index 2ffc88cc..00000000 +--- a/contrib/systemd/Makefile.am ++++ /dev/null +@@ -1,3 +0,0 @@ +-# Copyright (c) 2013, The Trusted Domain Project. All rights reserved. +- +-dist_doc_DATA = opendkim.service +diff --git a/contrib/systemd/opendkim.service.in b/contrib/systemd/opendkim.service.in +index f7665f43..236f8a06 100644 +--- a/contrib/systemd/opendkim.service.in ++++ b/contrib/systemd/opendkim.service.in +@@ -1,20 +1,28 @@ +-# If you are using OpenDKIM with SQL datasets it might be necessary to start OpenDKIM after the database servers. +-# For example, if using both MariaDB and PostgreSQL, change "After=" in the "[Unit]" section to: +-# After=network.target nss-lookup.target syslog.target mariadb.service postgresql.service ++# If you are using OpenDKIM with SQL datasets, you should start ++# OpenDKIM after your database server. For example, when using ++# PostgreSQL, you should create a supplementary ".conf" file in the ++# appropriate directory containing, ++# ++# [Unit] ++# After=postgresql.service ++# + + [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 ++Documentation=man:opendkim(8) \ ++ man:opendkim.conf(5) \ ++ man:opendkim-genkey(8) \ ++ man:opendkim-genzone(8) \ ++ man:opendkim-testkey(8) \ ++ http://www.opendkim.org/docs.html + After=network.target nss-lookup.target syslog.target + + [Service] + Type=forking +-PIDFile=@localstatedir@/run/opendkim/opendkim.pid +-EnvironmentFile=-@sysconfdir@/sysconfig/opendkim +-ExecStart=@sbindir@/opendkim $OPTIONS ++ExecStart=@SBINDIR@/opendkim -P @RUNSTATEDIR@/opendkim.pid ++ExecStartPre=@SBINDIR@/opendkim -P @RUNSTATEDIR@/opendkim.pid -n -f + ExecReload=/bin/kill -USR1 $MAINPID +-User=opendkim +-Group=opendkim ++PIDFile=@RUNSTATEDIR@/opendkim.pid + + [Install] + WantedBy=multi-user.target +diff --git a/contrib/systemd/opendkim.tmpfiles.in b/contrib/systemd/opendkim.tmpfiles.in +new file mode 100644 +index 00000000..a9118974 +--- /dev/null ++++ b/contrib/systemd/opendkim.tmpfiles.in +@@ -0,0 +1,5 @@ ++# We allow everyone to read/traverse this directory because if it ++# contains a local socket, then (for example) your MTA will want to ++# look in there. Permissions on the socket itself are controlled ++# by the "UserID" and "UMask" directives in the daemon's configuration. ++d @RUNSTATEDIR@/opendkim 0755 opendkim opendkim +diff --git a/opendkim/Makefile.am b/opendkim/Makefile.am +index 4aa615c1..7d514771 100644 +--- a/opendkim/Makefile.am ++++ b/opendkim/Makefile.am +@@ -16,9 +16,11 @@ endif + sbin_PROGRAMS += opendkim-stats + endif + ++ + dist_sbin_SCRIPTS = opendkim-genkey +-dist_doc_DATA = opendkim.conf.sample opendkim.conf.simple \ +- opendkim.conf.simple-verify README.SQL ++ ++dist_doc_DATA = opendkim.conf.sample README.SQL ++ + + if BUILD_FILTER + sbin_PROGRAMS += opendkim +diff --git a/opendkim/opendkim.conf.simple-verify.in b/opendkim/opendkim.conf.simple-verify.in +index 2224b64f..463048ab 100644 +--- a/opendkim/opendkim.conf.simple-verify.in ++++ b/opendkim/opendkim.conf.simple-verify.in +@@ -17,5 +17,5 @@ Mode v + + # ADSPDiscard no + +-# PidFile /var/run/opendkim/opendkim.pid ++# PidFile @RUNSTATEDIR@/opendkim.pid + +diff --git a/opendkim/opendkim.conf.simple.in b/opendkim/opendkim.conf.simple.in +index 735b924b..b70bfb46 100644 +--- a/opendkim/opendkim.conf.simple.in ++++ b/opendkim/opendkim.conf.simple.in +@@ -12,6 +12,12 @@ KeyFile /var/db/dkim/@DOMAIN@.private + + Socket inet:8891@localhost + ++# To use a local socket instead, specify a path here. The "standard" ++# location is under @runstatedir@/opendkim, and it's best to agree ++# on that directory so that various init systems can configure its ++# permissions and ownership automatically. ++#Socket local:@RUNSTATEDIR@/opendkim/opendkim.sock ++ + ReportAddress postmaster@@DOMAIN@ + SendReports yes + +@@ -25,4 +31,4 @@ SendReports yes + # + # PeerList X.X.X.X + +-# PidFile /var/run/opendkim/opendkim.pid ++# PidFile @RUNSTATEDIR@/opendkim.pid diff --git a/mail-filter/opendkim/opendkim-2.10.3-r11.ebuild b/mail-filter/opendkim/opendkim-2.10.3-r11.ebuild new file mode 100644 index 00000000000..b93dfe4a861 --- /dev/null +++ b/mail-filter/opendkim/opendkim-2.10.3-r11.ebuild @@ -0,0 +1,222 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +inherit autotools db-use eutils systemd tmpfiles user + +DESCRIPTION="A milter providing DKIM signing and verification" +HOMEPAGE="http://opendkim.org/" +SRC_URI="mirror://sourceforge/opendkim/${P}.tar.gz" + +# The GPL-2 is for the init script, bug 425960. +LICENSE="BSD GPL-2 Sendmail-Open-Source" +SLOT="0" +KEYWORDS="~amd64 ~arm ~x86" +IUSE="+berkdb ldap libressl lmdb lua memcached opendbx poll sasl selinux +ssl static-libs unbound" + +DEPEND="|| ( mail-filter/libmilter mail-mta/sendmail ) + dev-libs/libbsd + sys-apps/grep + ssl? ( + !libressl? ( dev-libs/openssl:0= ) + libressl? ( dev-libs/libressl:0= ) + ) + berkdb? ( >=sys-libs/db-3.2:* ) + opendbx? ( >=dev-db/opendbx-1.4.0 ) + lua? ( dev-lang/lua:* ) + ldap? ( net-nds/openldap ) + lmdb? ( dev-db/lmdb ) + memcached? ( dev-libs/libmemcached ) + sasl? ( dev-libs/cyrus-sasl ) + unbound? ( >=net-dns/unbound-1.4.1:= net-dns/dnssec-root ) + !unbound? ( net-libs/ldns )" + +RDEPEND="${DEPEND} + sys-process/psmisc + selinux? ( sec-policy/selinux-dkim )" + +REQUIRED_USE="sasl? ( ldap )" + +PATCHES=( + "${FILESDIR}/${P}-openrc.patch" + "${FILESDIR}/${P}-openssl-1.1.1.patch" +) + +pkg_setup() { + # This user can read your private keys, and must therefore not be + # shared with any other package. + enewgroup opendkim + enewuser opendkim -1 -1 -1 opendkim +} + +src_prepare() { + default + sed -i -e 's:/var/db/dkim:/var/lib/opendkim:g' \ + opendkim/opendkim.conf.sample opendkim/opendkim.conf.simple.in || die + sed -i -e 's:dist_doc_DATA:dist_html_DATA:' libopendkim/docs/Makefile.am || die + # TODO: what purpose does this serve? + sed -i -e "/sock.*mt.getcwd/s:mt.getcwd():${T}:" \ + opendkim/tests/*.lua || die + eautoreconf +} + +src_configure() { + local myconf=() + if use berkdb ; then + myconf+=( + $(db_includedir) + --with-db-incdir=${myconf#-I} + --enable-popauth + --enable-query_cache + --enable-stats + ) + fi + if use unbound; then + myconf+=( --with-unbound ) + else + myconf+=( --with-ldns ) + fi + if use ldap; then + myconf+=( $(use_with sasl) ) + fi + econf \ + $(use_with berkdb db) \ + $(use_with opendbx odbx) \ + $(use_with lua) \ + $(use_enable lua rbl) \ + $(use_with ldap openldap) \ + $(use_with lmdb) \ + $(use_enable poll) \ + $(use_enable static-libs static) \ + $(use_with memcached libmemcached) \ + "${myconf[@]}" \ + --enable-filter \ + --enable-atps \ + --enable-identity_header \ + --enable-rate_limit \ + --enable-resign \ + --enable-replace_rules \ + --enable-default_sender \ + --enable-sender_macro \ + --enable-vbr \ + --disable-live-testing +} + +src_compile() { + emake runstatedir=/run +} + +src_install() { + default + find "${D}" -name '*.la' -type f -delete || die + + dosbin stats/opendkim-reportstats + + newinitd "${S}/contrib/OpenRC/opendkim.openrc" "${PN}" + systemd_newtmpfilesd "${S}/contrib/systemd/opendkim.tmpfiles" "${PN}.conf" + systemd_newunit "contrib/systemd/opendkim.service" "${PN}.service" + + dodir /etc/opendkim + keepdir /var/lib/opendkim + + # The OpenDKIM data (particularly, your keys) should be read-only to + # the UserID that the daemon runs as. + fowners root:opendkim /var/lib/opendkim + fperms 750 /var/lib/opendkim + + # Tweak the "simple" example configuration a bit before installing + # it unconditionally. + local cf="${T}/opendkim.conf" + # Some MTAs are known to break DKIM signatures with "simple" + # canonicalization [1], so we choose the "relaxed" policy + # over OpenDKIM's current default settings. + # [1] https://wordtothewise.com/2016/12/dkim-canonicalization-or-why-microsoft-breaks-your-mail/ + sed -E -e 's:^(Canonicalization)[[:space:]]+.*:\1\trelaxed/relaxed:' \ + "${S}/opendkim/opendkim.conf.simple" >"${cf}" || die + cat >>"${cf}" <