public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: mail-filter/opendkim/, mail-filter/opendkim/files/
@ 2018-10-25 13:39 Craig Andrews
  0 siblings, 0 replies; 9+ messages in thread
From: Craig Andrews @ 2018-10-25 13:39 UTC (permalink / raw
  To: gentoo-commits

commit:     bb8b6bb78adfa6f50f37a09b7fa8b16c5fd85471
Author:     Craig Andrews <candrews <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 24 20:57:27 2018 +0000
Commit:     Craig Andrews <candrews <AT> gentoo <DOT> org>
CommitDate: Thu Oct 25 13:39:26 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bb8b6bb7

mail-filter/opendkim: Fix building with OpenSSL 1.1.1

Closes: https://bugs.gentoo.org/669512
Signed-off-by: Craig Andrews <candrews <AT> gentoo.org>
Package-Manager: Portage-2.3.51, Repoman-2.3.11

 .../files/opendkim-2.10.3-openssl-1.1.1.patch      | 170 +++++++++++++++++
 mail-filter/opendkim/opendkim-2.10.3-r4.ebuild     | 205 +++++++++++++++++++++
 2 files changed, 375 insertions(+)

diff --git a/mail-filter/opendkim/files/opendkim-2.10.3-openssl-1.1.1.patch b/mail-filter/opendkim/files/opendkim-2.10.3-openssl-1.1.1.patch
new file mode 100644
index 00000000000..825d7753aca
--- /dev/null
+++ b/mail-filter/opendkim/files/opendkim-2.10.3-openssl-1.1.1.patch
@@ -0,0 +1,170 @@
+From FreeBSD: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223568
+--- a/configure.ac	2015-05-12 18:43:09 UTC
++++ b/configure.ac
+@@ -860,26 +860,28 @@ then
+ 	AC_SEARCH_LIBS([ERR_peek_error], [crypto], ,
+ 	               AC_MSG_ERROR([libcrypto not found]))
+ 
+-	AC_SEARCH_LIBS([SSL_library_init], [ssl], ,
+-		[
+-			if test x"$enable_shared" = x"yes"
+-			then
+-				AC_MSG_ERROR([Cannot build shared opendkim
+-				              against static openssl libraries.
+-				              Configure with --disable-shared
+-				              to get this working or obtain a
+-				              shared libssl library for
+-				              opendkim to use.])
+-			fi
+ 
+-			# avoid caching issue - last result of SSL_library_init
+-			# shouldn't be cached for this next check
+-			unset ac_cv_search_SSL_library_init
+-			LIBCRYPTO_LIBS="$LIBCRYPTO_LIBS -ldl"
+-			AC_SEARCH_LIBS([SSL_library_init], [ssl], ,
+-			               AC_MSG_ERROR([libssl not found]), [-ldl])
+-		]
+-	)
++	AC_LINK_IFELSE(
++		       [AC_LANG_PROGRAM([[#include <openssl/ssl.h>]],
++					[[SSL_library_init();]])],
++					[od_have_ossl="yes";],
++					[od_have_ossl="no";])
++	if test x"$od_have_ossl" = x"no"
++	then
++		if test x"$enable_shared" = x"yes"
++		then
++			AC_MSG_ERROR([Cannot build shared opendkim
++			              against static openssl libraries.
++			              Configure with --disable-shared
++			              to get this working or obtain a
++			              shared libssl library for
++			              opendkim to use.])
++		fi
++
++		LIBCRYPTO_LIBS="$LIBCRYPTO_LIBS -ldl"
++		AC_SEARCH_LIBS([SSL_library_init], [ssl], ,
++		               AC_MSG_ERROR([libssl not found]), [-ldl])
++	fi
+ 
+ 	AC_CHECK_DECL([SHA256_DIGEST_LENGTH],
+                       AC_DEFINE([HAVE_SHA256], 1,
+--- a/libopendkim/tests/Makefile.in	2015-05-12 18:43:48 UTC
++++ b/libopendkim/tests/Makefile.in
+@@ -1108,8 +1108,10 @@ am__nobase_list = $(am__nobase_strip_setup); \
+       { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+     END { for (dir in files) print dir, files[dir] }'
+ am__base_list = \
+-  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+-  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
++  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\
++/ /g' | \
++  sed '$$!N;$$!N;$$!N;$$!N;s/\
++/ /g'
+ am__uninstall_files_from_dir = { \
+   test -z "$$files" \
+     || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+@@ -4131,16 +4133,19 @@ uninstall-am: uninstall-dist_docDATA
+ @LCOV_TRUE@description.txt: $(check_PROGRAMS) $(check_SCRIPTS)
+ @LCOV_TRUE@	rm -f $@
+ @LCOV_TRUE@	for i in $(check_PROGRAMS); do \
+-@LCOV_TRUE@		testname=$${i/t-}; \
+-@LCOV_TRUE@		testname=$${testname//-/_}; \
++@LCOV_TRUE@		testname=$${i#t-}; \
++@LCOV_TRUE@		testname=$$(echo $${testname} | sed -e 's/-/_/g'); \
+ @LCOV_TRUE@		fgrep '***' $$i.c | tail -n 1 | \
+-@LCOV_TRUE@		(echo $${testname} ; sed -e 's/[^*]*\*\*\*\(.*\)\\n.*/\t\1\n/g' ) >> $@; \
++@LCOV_TRUE@		(echo $${testname} ; sed -e 's/[^*]*\*\*\*\(.*\)\\
++@LCOV_TRUE@.*/	\1\
++@LCOV_TRUE@/g' ) >> $@; \
+ @LCOV_TRUE@	done
+ @LCOV_TRUE@	for i in $(check_SCRIPTS); do \
+-@LCOV_TRUE@		testname=$${i/t-}; \
+-@LCOV_TRUE@		testname=$${testname//-/_}; \
++@LCOV_TRUE@		testname=$${i#t-}; \
++@LCOV_TRUE@		testname=$$(echo $${testname} | sed -e 's/-/_/g'); \
+ @LCOV_TRUE@		grep '^#' $$i | tail -n 1 | \
+-@LCOV_TRUE@		(echo $${testname} ; sed -e 's/^# \(.*\)/\t\1\n/g' ) >> $@; \
++@LCOV_TRUE@		(echo $${testname} ; sed -e 's/^# \(.*\)/	\1\
++@LCOV_TRUE@/g' ) >> $@; \
+ @LCOV_TRUE@	done
+ 
+ @LCOV_TRUE@description.html: description.txt
+--- a/libopendkim/dkim-canon.c	2015-05-11 03:56:13 UTC
++++ b/libopendkim/dkim-canon.c
+@@ -388,7 +388,7 @@ dkim_canon_header_string(struct dkim_dstring *dstr, dk
+ 		}
+ 
+ 		/* skip all spaces before first word */
+-		while (*p != '\0' && DKIM_ISWSP(*p))
++		while (*p != '\0' && DKIM_ISLWSP(*p))
+ 			p++;
+ 
+ 		space = FALSE;				/* just saw a space */
+--- a/opendkim/tests/Makefile.in	2015-05-12 18:43:49 UTC
++++ b/opendkim/tests/Makefile.in
+@@ -139,8 +139,10 @@ am__nobase_list = $(am__nobase_strip_setup); \
+       { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+     END { for (dir in files) print dir, files[dir] }'
+ am__base_list = \
+-  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+-  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
++  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\
++/ /g' | \
++  sed '$$!N;$$!N;$$!N;$$!N;s/\
++/ /g'
+ am__uninstall_files_from_dir = { \
+   test -z "$$files" \
+     || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+@@ -1298,14 +1300,16 @@ uninstall-am: uninstall-dist_docDATA
+ @LCOV_TRUE@description.txt: $(check_SCRIPTS)
+ @LCOV_TRUE@	rm -f $@
+ @LCOV_TRUE@	for test in $? ; do \
+-@LCOV_TRUE@		testname=$${test/t-}; \
+-@LCOV_TRUE@		testname=$${testname//-/_}; \
++@LCOV_TRUE@		testname=$${test#t-}; \
++@LCOV_TRUE@		testname=$$(echo $${testname} | sed -e 's/-/_/g'); \
+ @LCOV_TRUE@		grep ^# $$test | tail -n 1 | \
+-@LCOV_TRUE@			sed -e "s/^#\(.*\)/$${testname}\n\t\1\n/g" >> $@; \
++@LCOV_TRUE@			sed -e "s/^#\(.*\)/$${testname}\
++@LCOV_TRUE@	\1\
++@LCOV_TRUE@/g" >> $@; \
+ @LCOV_TRUE@	done
+ 
+ @LCOV_TRUE@description.html: description.txt
+-@LCOV_TRUE@	gendesc --output $@ $<
++@LCOV_TRUE@	gendesc --output $@ $?
+ 
+ @LCOV_TRUE@maintainer-clean-local:
+ @LCOV_TRUE@	-rm -rf lcov/[^C]*
+--- a/opendkim/opendkim-crypto.c	2013-02-25 21:02:41 UTC
++++ b/opendkim/opendkim-crypto.c
+@@ -222,7 +222,11 @@ dkimf_crypto_free_id(void *ptr)
+ 	{
+ 		assert(pthread_setspecific(id_key, ptr) == 0);
+ 
++#if OPENSSL_VERSION_NUMBER >= 0x10100000
++		OPENSSL_thread_stop();
++#else
+ 		ERR_remove_state(0);
++#endif
+ 
+ 		free(ptr);
+ 
+@@ -392,11 +396,15 @@ dkimf_crypto_free(void)
+ {
+ 	if (crypto_init_done)
+ 	{
++#if OPENSSL_VERSION_NUMBER >= 0x10100000
++		OPENSSL_thread_stop();
++#else
+ 		CRYPTO_cleanup_all_ex_data();
+ 		CONF_modules_free();
+ 		EVP_cleanup();
+ 		ERR_free_strings();
+ 		ERR_remove_state(0);
++#endif
+ 
+ 		if (nmutexes > 0)
+ 		{
+

diff --git a/mail-filter/opendkim/opendkim-2.10.3-r4.ebuild b/mail-filter/opendkim/opendkim-2.10.3-r4.ebuild
new file mode 100644
index 00000000000..6c1b66b18e1
--- /dev/null
+++ b/mail-filter/opendkim/opendkim-2.10.3-r4.ebuild
@@ -0,0 +1,205 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit autotools db-use eutils systemd user
+
+# for betas
+#MY_P=${P/_b/.B}
+#S=${WORKDIR}/${PN}-2.8.0
+#SRC_URI="mirror://sourceforge/opendkim/${MY_P}.tar.gz"
+
+DESCRIPTION="A milter-based application to provide DKIM signing and verification"
+HOMEPAGE="http://opendkim.org"
+SRC_URI="mirror://sourceforge/opendkim/${P}.tar.gz"
+
+LICENSE="Sendmail-Open-Source BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="+berkdb gnutls ldap libressl lmdb lua memcached opendbx poll sasl selinux +ssl static-libs unbound"
+
+DEPEND="|| ( mail-filter/libmilter mail-mta/sendmail )
+	dev-libs/libbsd
+	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 )
+	gnutls? ( >=net-libs/gnutls-3.3 )"
+
+RDEPEND="${DEPEND}
+	sys-process/psmisc
+	selinux? ( sec-policy/selinux-dkim )
+"
+
+REQUIRED_USE="sasl? ( ldap )"
+
+PATCHES=(
+	"${FILESDIR}/${P}-gnutls-3.4.patch"
+	"${FILESDIR}/${P}-openssl-1.1.1.patch"
+)
+
+pkg_setup() {
+	enewgroup milter
+	# mail-milter/spamass-milter creates milter user with this home directory
+	# For consistency reasons, milter user must be created here with this home directory
+	# even though this package doesn't need a home directory for this user (#280571)
+	enewuser milter -1 -1 /var/lib/milter milter
+}
+
+src_prepare() {
+	default
+
+	sed -i -e 's:/var/db/dkim:/etc/opendkim:g' \
+	       -e 's:/var/db/opendkim:/var/lib/opendkim:g' \
+	       -e 's:/etc/mail:/etc/opendkim:g' \
+	       -e 's:mailnull:milter:g' \
+	       -e 's:^#[[:space:]]*PidFile.*:PidFile /run/opendkim/opendkim.pid:' \
+		   opendkim/opendkim.conf.sample opendkim/opendkim.conf.simple.in \
+		   stats/opendkim-reportstats{,.in} || die
+
+	sed -i -e 's:dist_doc_DATA:dist_html_DATA:' libopendkim/docs/Makefile.am \
+		|| die
+
+	sed -i -e '/sock.*mt.getcwd/s:mt.getcwd():"/tmp":' opendkim/tests/*.lua
+	sed -i -e '/sock.*mt.getcwd/s:mt.getcwd():"/proc/self/cwd":' opendkim/tests/*.lua
+
+	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 gnutls) \
+		$(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
+		#--with-test-socket=/tmp/opendkim-$(echo ${RANDOM})-S
+		#--disable-rpath
+}
+
+src_install() {
+	default
+	prune_libtool_files
+
+	dosbin stats/opendkim-reportstats
+
+	newinitd "${FILESDIR}/opendkim.init.r3" opendkim
+	systemd_newunit "${FILESDIR}/opendkim-r1.service" opendkim.service
+
+	dodir /etc/opendkim /var/lib/opendkim
+	fowners milter:milter /var/lib/opendkim
+
+	# default configuration
+	if [ ! -f "${ROOT}"/etc/opendkim/opendkim.conf ]; then
+		grep ^[^#] "${S}"/opendkim/opendkim.conf.simple \
+			> "${D}"/etc/opendkim/opendkim.conf
+		if use unbound; then
+			echo TrustAnchorFile /etc/dnssec/root-anchors.txt >> "${D}"/etc/opendkim/opendkim.conf
+		fi
+		echo UserID milter >> "${D}"/etc/opendkim/opendkim.conf
+		if use berkdb; then
+			echo Statistics /var/lib/opendkim/stats.dat >> \
+				"${D}"/etc/opendkim/opendkim.conf
+		fi
+	fi
+}
+
+pkg_postinst() {
+	if [[ -z ${REPLACING_VERSION} ]]; then
+		elog "If you want to sign your mail messages and need some help"
+		elog "please run:"
+		elog "  emerge --config ${CATEGORY}/${PN}"
+		elog "It will help you create your key and give you hints on how"
+		elog "to configure your DNS and MTA."
+
+		ewarn "Make sure your MTA has r/w access to the socket file."
+		ewarn "This can be done either by setting UMask to 002 and adding MTA's user"
+		ewarn "to milter group or you can simply set UMask to 000."
+	fi
+}
+
+pkg_config() {
+	local selector keysize pubkey
+
+	read -p "Enter the selector name (default ${HOSTNAME}): " selector
+	[[ -n "${selector}" ]] || selector=${HOSTNAME}
+	if [[ -z "${selector}" ]]; then
+		eerror "Oddly enough, you don't have a HOSTNAME."
+		return 1
+	fi
+	if [[ -f "${ROOT}"etc/opendkim/${selector}.private ]]; then
+		ewarn "The private key for this selector already exists."
+	else
+		keysize=1024
+		# generate the private and public keys
+		opendkim-genkey -b ${keysize} -D "${ROOT}"etc/opendkim/ \
+			-s ${selector} -d '(your domain)' && \
+			chown milter:milter \
+			"${ROOT}"etc/opendkim/"${selector}".private || \
+				{ eerror "Failed to create private and public keys." ; return 1; }
+		chmod go-r "${ROOT}"etc/opendkim/"${selector}".private
+	fi
+
+	# opendkim selector configuration
+	echo
+	einfo "Make sure you have the following settings in your /etc/opendkim/opendkim.conf:"
+	einfo "  Keyfile /etc/opendkim/${selector}.private"
+	einfo "  Selector ${selector}"
+
+	# MTA configuration
+	echo
+	einfo "If you are using Postfix, add following lines to your main.cf:"
+	einfo "  smtpd_milters     = unix:/var/run/opendkim/opendkim.sock"
+	einfo "  non_smtpd_milters = unix:/var/run/opendkim/opendkim.sock"
+	einfo "  and read http://www.postfix.org/MILTER_README.html"
+
+	# DNS configuration
+	einfo "After you configured your MTA, publish your key by adding this TXT record to your domain:"
+	cat "${ROOT}"etc/opendkim/${selector}.txt
+	einfo "t=y signifies you only test the DKIM on your domain. See following page for the complete list of tags:"
+	einfo "  http://www.dkim.org/specs/rfc4871-dkimbase.html#key-text"
+}


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: mail-filter/opendkim/, mail-filter/opendkim/files/
@ 2019-03-31 19:03 Michael Orlitzky
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Orlitzky @ 2019-03-31 19:03 UTC (permalink / raw
  To: gentoo-commits

commit:     95a67b7125a6fd3b8ef970d7c6f66b9bec91cfcc
Author:     Ralph Seichter <github <AT> seichter <DOT> de>
AuthorDate: Fri Mar 29 18:45:11 2019 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sun Mar 31 19:02:48 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=95a67b71

mail-filter/opendkim: Added pre-start configuration checks

Added pre-start configuration checks for OpenRC and systemd.

Signed-off-by: Ralph Seichter <gentoo <AT> seichter.de>
Closes: https://bugs.gentoo.org/622604
Package-Manager: Portage-2.3.62, Repoman-2.3.11
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 mail-filter/opendkim/files/opendkim.init.r6    |  77 +++++++++
 mail-filter/opendkim/files/opendkim.service.r4 |  16 ++
 mail-filter/opendkim/opendkim-2.10.3-r9.ebuild | 223 +++++++++++++++++++++++++
 3 files changed, 316 insertions(+)

diff --git a/mail-filter/opendkim/files/opendkim.init.r6 b/mail-filter/opendkim/files/opendkim.init.r6
new file mode 100644
index 00000000000..95aa971fd88
--- /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.r4 b/mail-filter/opendkim/files/opendkim.service.r4
new file mode 100644
index 00000000000..8c366007c00
--- /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

diff --git a/mail-filter/opendkim/opendkim-2.10.3-r9.ebuild b/mail-filter/opendkim/opendkim-2.10.3-r9.ebuild
new file mode 100644
index 00000000000..841184ed46b
--- /dev/null
+++ b/mail-filter/opendkim/opendkim-2.10.3-r9.ebuild
@@ -0,0 +1,223 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit autotools db-use eutils systemd 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 gnutls ldap libressl lmdb lua memcached opendbx poll sasl selinux +ssl static-libs unbound"
+
+DEPEND="|| ( mail-filter/libmilter mail-mta/sendmail )
+	dev-libs/libbsd
+	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 )
+	gnutls? ( >=net-libs/gnutls-3.3 )"
+
+RDEPEND="${DEPEND}
+	sys-process/psmisc
+	selinux? ( sec-policy/selinux-dkim )
+"
+
+REQUIRED_USE="sasl? ( ldap )"
+
+PATCHES=(
+	"${FILESDIR}/${P}-gnutls-3.4.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.
+	enewuser opendkim
+}
+
+src_prepare() {
+	default
+
+	# We delete the "Socket" setting because it's overridden by our
+	# conf.d file.
+	sed -e 's:/var/db/dkim:/var/lib/opendkim:g' \
+		-e '/^[[:space:]]*Socket/d' \
+		-i opendkim/opendkim.conf.sample opendkim/opendkim.conf.simple.in \
+		stats/opendkim-reportstats{,.in} || die
+
+	sed -i -e 's:dist_doc_DATA:dist_html_DATA:' libopendkim/docs/Makefile.am \
+		|| die
+
+	# TODO: what purpose does this serve, do the tests even get run?
+	sed -e "/sock.*mt.getcwd/s:mt.getcwd():${T}:" \
+		-i 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 gnutls) \
+		$(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_install() {
+	default
+	prune_libtool_files
+
+	dosbin stats/opendkim-reportstats
+
+	newinitd "${FILESDIR}/opendkim.init.r6" opendkim
+	newconfd "${FILESDIR}/opendkim.confd" opendkim
+	systemd_newunit "${FILESDIR}/opendkim.service.r4" opendkim.service
+	systemd_install_serviced "${FILESDIR}/${PN}.service.conf" "${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
+
+	# Strip the comments out of the "simple" example configuration...
+	grep ^[^#] "${S}"/opendkim/opendkim.conf.simple \
+		 > "${T}/opendkim.conf" || die
+
+	# and tweak it a bit before installing it unconditionally.
+	echo "# For use with unbound" >> "${T}/opendkim.conf" || die
+	echo "#TrustAnchorFile /etc/dnssec/root-anchors.txt" \
+		 >> "${T}/opendkim.conf" || die
+	echo UserID opendkim >> "${T}/opendkim.conf" || die
+	insinto /etc/opendkim
+	doins "${T}/opendkim.conf"
+}
+
+pkg_postinst() {
+	if [[ -z ${REPLACING_VERSION} ]]; then
+		elog "If you want to sign your mail messages and need some help"
+		elog "please run:"
+		elog "  emerge --config ${CATEGORY}/${PN}"
+		elog "It will help you create your key and give you hints on how"
+		elog "to configure your DNS and MTA."
+
+		# TODO: This is tricky, we really need a good wiki page showing
+		# how to share a local socket with an MTA!
+		elog "If you are using a local (UNIX) socket, then you will"
+		elog "need to make sure that your MTA has read/write access"
+		elog "to the socket file. This is best accomplished by creating"
+		elog "a completely-new group with only your MTA user and the "
+		elog "\"opendkim\" user in it. You would then set \"UMask 0112\""
+		elog "in your opendkim.conf, and switch the primary group of your"
+		elog "\"opendkim\" user to the group that you just created. The"
+		elog "last step is necessary for the socket to be created as the"
+		elog "new group (and not as group \"opendkim\")".
+	else
+		ewarn "The user account for the OpenDKIM daemon has changed"
+		ewarn "from \"milter\" to \"opendkim\" to prevent unrelated services"
+		ewarn "from being able to read your private keys. You should"
+		ewarn "adjust your existing configuration to use the \"opendkim\""
+		ewarn "user and group, and change the permissions on"
+		ewarn "${ROOT}var/lib/opendkim to root:opendkim with mode 0750."
+		ewarn "The owner and group of the files within that directory"
+		ewarn "will likely need to be adjusted as well."
+	fi
+}
+
+pkg_config() {
+	local selector keysize pubkey
+
+	read -p "Enter the selector name (default ${HOSTNAME}): " selector
+	[[ -n "${selector}" ]] || selector="${HOSTNAME}"
+	if [[ -z "${selector}" ]]; then
+		eerror "Oddly enough, you don't have a HOSTNAME."
+		return 1
+	fi
+	if [[ -f "${ROOT}var/lib/opendkim/${selector}.private" ]]; then
+		ewarn "The private key for this selector already exists."
+	else
+		keysize=1024
+		# Generate the private and public keys. Note that opendkim-genkeys
+		# sets umask=077 on its own to keep these safe. However, we want
+		# them to be readable (only!) to the opendkim user, and we manage
+		# that by changing their groups and making everything group-readable.
+		opendkim-genkey -b ${keysize} -D "${ROOT}"var/lib/opendkim/ \
+			-s "${selector}" -d '(your domain)' && \
+			chgrp --no-dereference opendkim \
+				  "${ROOT}var/lib/opendkim/${selector}".{private,txt} || \
+				{ eerror "Failed to create private and public keys." ;
+				  return 1; }
+		chmod g+r "${ROOT}var/lib/opendkim/${selector}".{private,txt}
+	fi
+
+	# opendkim selector configuration
+	echo
+	einfo "Make sure you have the following settings in your /etc/opendkim/opendkim.conf:"
+	einfo "  Keyfile /var/lib/opendkim/${selector}.private"
+	einfo "  Selector ${selector}"
+
+	# MTA configuration
+	echo
+	einfo "If you are using Postfix, add following lines to your main.cf:"
+	einfo "  smtpd_milters     = unix:/run/opendkim/opendkim.sock"
+	einfo "  non_smtpd_milters = unix:/run/opendkim/opendkim.sock"
+	einfo "  and read http://www.postfix.org/MILTER_README.html"
+
+	# DNS configuration
+	einfo "After you configured your MTA, publish your key by adding this TXT record to your domain:"
+	cat "${ROOT}var/lib/opendkim/${selector}.txt"
+	einfo "t=y signifies you only test the DKIM on your domain. See following page for the complete list of tags:"
+	einfo "  http://www.dkim.org/specs/rfc4871-dkimbase.html#key-text"
+}


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: mail-filter/opendkim/, mail-filter/opendkim/files/
@ 2019-04-24 12:46 Michael Orlitzky
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Orlitzky @ 2019-04-24 12:46 UTC (permalink / raw
  To: gentoo-commits

commit:     41f1717e1094b877bbede64784644f66fd1825c5
Author:     Ralph Seichter <github <AT> seichter <DOT> de>
AuthorDate: Wed Apr 17 15:27:19 2019 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> 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 <AT> /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 <AT>  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 <gentoo <AT> seichter.de>
Package-Manager: Portage-2.3.62, Repoman-2.3.11
Signed-off-by: Michael Orlitzky <mjo <AT> 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}" <<EOT || die
+
+# The UMask is really only used for the PID file (root:root) and the
+# local UNIX socket, if you're using one. It should be 0117 for the
+# socket.
+UMask			0117
+UserID			opendkim
+
+# For use with unbound
+#TrustAnchorFile	/etc/dnssec/root-anchors.txt
+EOT
+	insinto /etc/opendkim
+	doins "${cf}"
+}
+
+pkg_postinst() {
+	tmpfiles_process "${PN}.conf"
+	if [[ -z ${REPLACING_VERSION} ]]; then
+		elog "If you want to sign your mail messages and need some help"
+		elog "please run:"
+		elog "	emerge --config ${CATEGORY}/${PN}"
+		elog "It will help you create your key and give you hints on how"
+		elog "to configure your DNS and MTA."
+
+		elog "If you are using a local (UNIX) socket, then you will"
+		elog "need to make sure that your MTA has read/write access"
+		elog "to the socket file. This is best accomplished by creating"
+		elog "a completely-new group with only your MTA user and the"
+		elog "\"opendkim\" user in it. Step-by-step instructions can be"
+		elog "found on our Wiki, at https://wiki.gentoo.org/wiki/OpenDKIM ."
+	else
+		ewarn "The user account for the OpenDKIM daemon has changed"
+		ewarn "from \"milter\" to \"opendkim\" to prevent unrelated services"
+		ewarn "from being able to read your private keys. You should"
+		ewarn "adjust your existing configuration to use the \"opendkim\""
+		ewarn "user and group, and change the permissions on"
+		ewarn "${ROOT}var/lib/opendkim to root:opendkim with mode 0750."
+		ewarn "The owner and group of the files within that directory"
+		ewarn "will likely need to be adjusted as well."
+	fi
+}
+
+pkg_config() {
+	local selector keysize pubkey
+
+	read -p "Enter the selector name (default ${HOSTNAME}): " selector
+	[[ -n "${selector}" ]] || selector="${HOSTNAME}"
+	if [[ -z "${selector}" ]]; then
+		eerror "Oddly enough, you don't have a HOSTNAME."
+		return 1
+	fi
+	if [[ -f "${ROOT}var/lib/opendkim/${selector}.private" ]]; then
+		ewarn "The private key for this selector already exists."
+	else
+		keysize=1024
+		# Generate the private and public keys. Note that opendkim-genkeys
+		# sets umask=077 on its own to keep these safe. However, we want
+		# them to be readable (only!) to the opendkim user, and we manage
+		# that by changing their groups and making everything group-readable.
+		opendkim-genkey -b ${keysize} -D "${ROOT}"var/lib/opendkim/ \
+			-s "${selector}" -d '(your domain)' && \
+			chgrp --no-dereference opendkim \
+				"${ROOT}var/lib/opendkim/${selector}".{private,txt} || \
+				{ eerror "Failed to create private and public keys."; return 1; }
+		chmod g+r "${ROOT}var/lib/opendkim/${selector}".{private,txt}
+	fi
+
+	# opendkim selector configuration
+	echo
+	einfo "Make sure you have the following settings in your /etc/opendkim/opendkim.conf:"
+	einfo "  Keyfile /var/lib/opendkim/${selector}.private"
+	einfo "  Selector ${selector}"
+
+	# MTA configuration
+	echo
+	einfo "If you are using Postfix, add following lines to your main.cf:"
+	einfo "  smtpd_milters	   = unix:/run/opendkim/opendkim.sock"
+	einfo "  non_smtpd_milters = unix:/run/opendkim/opendkim.sock"
+	einfo "  and read http://www.postfix.org/MILTER_README.html"
+
+	# DNS configuration
+	einfo "After you configured your MTA, publish your key by adding this TXT record to your domain:"
+	cat "${ROOT}var/lib/opendkim/${selector}.txt"
+	einfo "t=y signifies you only test the DKIM on your domain. See following page for the complete list of tags:"
+	einfo "  http://www.dkim.org/specs/rfc4871-dkimbase.html#key-text"
+}


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: mail-filter/opendkim/, mail-filter/opendkim/files/
@ 2019-04-24 21:26 Michael Orlitzky
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Orlitzky @ 2019-04-24 21:26 UTC (permalink / raw
  To: gentoo-commits

commit:     843899b66751006b2b882d6f5741f3d0082c06fd
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 24 21:23:44 2019 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Wed Apr 24 21:24:15 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=843899b6

mail-filter/opendkim: new revision to set sysconfdir consistently.

In the previous revision -r11, we tried to unite the configuration for
OpenRC and systemd. But, I made a mistake: the upstream location for
e.g. the main configuration file is @sysconfdir <AT> /opendkim.conf, but in
Gentoo we install it to @sysconfdir <AT> /opendkim/opendkim.conf. That path
is overridden in the OpenRC service script, but not in the systemd
service, which now crashes upon starting.

The error, however, is in the OpenRC script (and in our ebuild). The
correct way to relocate the configuration files is to pass a different
value to --sysconfdir in src_configure(). This new revision does that,
and updates the OpenRC service script to use the built-in location,
rather than a custom Gentoo-defined one. That's how it should have
been all along.

This also fixes an unreported bug, wherein all of the installed
documentation like opendkim.conf(5) pointed to the wrong path.

Thanks to Ralph Seichter who built a systemd virtual machine in order
to test everything.

Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>
Package-Manager: Portage-2.3.62, Repoman-2.3.11

 mail-filter/opendkim/files/opendkim-2.10.3-openrc.patch      | 12 ++----------
 ...opendkim-2.10.3-r11.ebuild => opendkim-2.10.3-r12.ebuild} |  6 ++++++
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/mail-filter/opendkim/files/opendkim-2.10.3-openrc.patch b/mail-filter/opendkim/files/opendkim-2.10.3-openrc.patch
index 9033b84281c..9b645ba0f0c 100644
--- a/mail-filter/opendkim/files/opendkim-2.10.3-openrc.patch
+++ b/mail-filter/opendkim/files/opendkim-2.10.3-openrc.patch
@@ -119,17 +119,9 @@ index 76df01cd..401130bb 100644
 +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
+index 00000000..4b783615
 --- /dev/null
 +++ b/contrib/OpenRC/opendkim.openrc.in.in
 @@ -0,0 +1,54 @@
@@ -137,7 +129,7 @@ index 00000000..d9631cdf
 +# Copyright 1999-2019 Gentoo Authors
 +# Distributed under the terms of the GNU General Public License v2
 +
-+CONFFILE="@SYSCONFDIR@/opendkim/${RC_SVCNAME}.conf"
++CONFFILE="@SYSCONFDIR@/${RC_SVCNAME}.conf"
 +required_files="${CONFFILE}"
 +
 +command="@SBINDIR@/opendkim"

diff --git a/mail-filter/opendkim/opendkim-2.10.3-r11.ebuild b/mail-filter/opendkim/opendkim-2.10.3-r12.ebuild
similarity index 96%
rename from mail-filter/opendkim/opendkim-2.10.3-r11.ebuild
rename to mail-filter/opendkim/opendkim-2.10.3-r12.ebuild
index 0db960be3c6..ee5908da59c 100644
--- a/mail-filter/opendkim/opendkim-2.10.3-r11.ebuild
+++ b/mail-filter/opendkim/opendkim-2.10.3-r12.ebuild
@@ -80,6 +80,12 @@ src_configure() {
 	if use ldap; then
 		myconf+=( $(use_with sasl) )
 	fi
+
+	# We install the our configuration filed under e.g. /etc/opendkim,
+	# so the next line is necessary to point the daemon and all of its
+	# documentation to the right location by default.
+	myconf+=( --sysconfdir="${EPREFIX}/etc/${PN}" )
+
 	econf \
 		$(use_with berkdb db) \
 		$(use_with opendbx odbx) \


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: mail-filter/opendkim/, mail-filter/opendkim/files/
@ 2019-07-23 23:04 Michael Orlitzky
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Orlitzky @ 2019-07-23 23:04 UTC (permalink / raw
  To: gentoo-commits

commit:     6cf011f5246b46f78e2b3a4f7b1e4a61046c14f0
Author:     Ralph Seichter <github <AT> seichter <DOT> de>
AuthorDate: Mon Jul 22 17:01:39 2019 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Tue Jul 23 23:01:13 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6cf011f5

mail-filter/opendkim: Remove obsolete ebuilds

Removed obsolete ebuild versions and their supporting files.

Signed-off-by: Ralph Seichter <gentoo <AT> seichter.de>
Package-Manager: Portage-2.3.66, Repoman-2.3.11
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 .../files/opendkim-2.10.3-gnutls-3.4.patch         |  52 -----
 .../files/opendkim-2.10.3-openssl-1.1.1.patch      | 170 ---------------
 mail-filter/opendkim/files/opendkim-r3.service     |  15 --
 mail-filter/opendkim/files/opendkim.confd          |  18 --
 mail-filter/opendkim/files/opendkim.init.r5        |  73 -------
 mail-filter/opendkim/files/opendkim.service        |  11 -
 mail-filter/opendkim/files/opendkim.service.conf   |   2 -
 mail-filter/opendkim/opendkim-2.10.3-r15.ebuild    | 230 ---------------------
 mail-filter/opendkim/opendkim-2.10.3-r8.ebuild     | 223 --------------------
 9 files changed, 794 deletions(-)

diff --git a/mail-filter/opendkim/files/opendkim-2.10.3-gnutls-3.4.patch b/mail-filter/opendkim/files/opendkim-2.10.3-gnutls-3.4.patch
deleted file mode 100644
index f4594efaac9..00000000000
--- a/mail-filter/opendkim/files/opendkim-2.10.3-gnutls-3.4.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From 3eea12e5f9af7739d5d009c6888b65bd4875a554 Mon Sep 17 00:00:00 2001
-From: Alon Bar-Lev <alon.barlev@gmail.com>
-Date: Sat, 4 Mar 2017 00:41:35 +0200
-Subject: [PATCH] crypto: support gnutls-3.4
-
-https://sourceforge.net/p/opendkim/patches/36/
-
-Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
----
- libopendkim/dkim.c | 19 ++++++++++++++++++-
- 1 file changed, 18 insertions(+), 1 deletion(-)
-
-diff --git a/libopendkim/dkim.c b/libopendkim/dkim.c
-index d0d75a5..0c2278e 100644
---- a/libopendkim/dkim.c
-+++ b/libopendkim/dkim.c
-@@ -5301,6 +5301,8 @@ dkim_sig_process(DKIM *dkim, DKIM_SIGINFO *sig)
- 	size_t diglen = 0;
- #ifdef USE_GNUTLS
- 	gnutls_datum_t key;
-+	gnutls_digest_algorithm_t hash;
-+	gnutls_sign_algorithm_t sign_algo;
- #else /* USE_GNUTLS */
- 	BIO *key;
- #endif /* USE_GNUTLS */
-@@ -5442,7 +5444,22 @@ dkim_sig_process(DKIM *dkim, DKIM_SIGINFO *sig)
- 			return DKIM_STAT_OK;
- 		}
- 
--		rsastat = gnutls_pubkey_verify_hash(rsa->rsa_pubkey, 0,
-+		hash = GNUTLS_DIG_SHA1;
-+
-+		if (dkim_libfeature(dkim->dkim_libhandle,
-+		                    DKIM_FEATURE_SHA256) &&
-+		    sig->sig_hashtype == DKIM_HASHTYPE_SHA256)
-+			hash = GNUTLS_DIG_SHA256;
-+
-+		sign_algo = gnutls_pk_to_sign(GNUTLS_PK_RSA, hash);
-+		if (sign_algo == GNUTLS_SIGN_UNKNOWN)
-+		{
-+			assert(0);
-+			/* NOTREACHED */
-+		}
-+
-+		rsastat = gnutls_pubkey_verify_hash2(rsa->rsa_pubkey,
-+		                                    sign_algo, 0,
- 		                                    &rsa->rsa_digest,
- 		                                    &rsa->rsa_sig);
- 		if (rsastat < 0)
--- 
-2.10.2
-

diff --git a/mail-filter/opendkim/files/opendkim-2.10.3-openssl-1.1.1.patch b/mail-filter/opendkim/files/opendkim-2.10.3-openssl-1.1.1.patch
deleted file mode 100644
index 825d7753aca..00000000000
--- a/mail-filter/opendkim/files/opendkim-2.10.3-openssl-1.1.1.patch
+++ /dev/null
@@ -1,170 +0,0 @@
-From FreeBSD: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223568
---- a/configure.ac	2015-05-12 18:43:09 UTC
-+++ b/configure.ac
-@@ -860,26 +860,28 @@ then
- 	AC_SEARCH_LIBS([ERR_peek_error], [crypto], ,
- 	               AC_MSG_ERROR([libcrypto not found]))
- 
--	AC_SEARCH_LIBS([SSL_library_init], [ssl], ,
--		[
--			if test x"$enable_shared" = x"yes"
--			then
--				AC_MSG_ERROR([Cannot build shared opendkim
--				              against static openssl libraries.
--				              Configure with --disable-shared
--				              to get this working or obtain a
--				              shared libssl library for
--				              opendkim to use.])
--			fi
- 
--			# avoid caching issue - last result of SSL_library_init
--			# shouldn't be cached for this next check
--			unset ac_cv_search_SSL_library_init
--			LIBCRYPTO_LIBS="$LIBCRYPTO_LIBS -ldl"
--			AC_SEARCH_LIBS([SSL_library_init], [ssl], ,
--			               AC_MSG_ERROR([libssl not found]), [-ldl])
--		]
--	)
-+	AC_LINK_IFELSE(
-+		       [AC_LANG_PROGRAM([[#include <openssl/ssl.h>]],
-+					[[SSL_library_init();]])],
-+					[od_have_ossl="yes";],
-+					[od_have_ossl="no";])
-+	if test x"$od_have_ossl" = x"no"
-+	then
-+		if test x"$enable_shared" = x"yes"
-+		then
-+			AC_MSG_ERROR([Cannot build shared opendkim
-+			              against static openssl libraries.
-+			              Configure with --disable-shared
-+			              to get this working or obtain a
-+			              shared libssl library for
-+			              opendkim to use.])
-+		fi
-+
-+		LIBCRYPTO_LIBS="$LIBCRYPTO_LIBS -ldl"
-+		AC_SEARCH_LIBS([SSL_library_init], [ssl], ,
-+		               AC_MSG_ERROR([libssl not found]), [-ldl])
-+	fi
- 
- 	AC_CHECK_DECL([SHA256_DIGEST_LENGTH],
-                       AC_DEFINE([HAVE_SHA256], 1,
---- a/libopendkim/tests/Makefile.in	2015-05-12 18:43:48 UTC
-+++ b/libopendkim/tests/Makefile.in
-@@ -1108,8 +1108,10 @@ am__nobase_list = $(am__nobase_strip_setup); \
-       { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
-     END { for (dir in files) print dir, files[dir] }'
- am__base_list = \
--  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
--  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\
-+/ /g' | \
-+  sed '$$!N;$$!N;$$!N;$$!N;s/\
-+/ /g'
- am__uninstall_files_from_dir = { \
-   test -z "$$files" \
-     || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
-@@ -4131,16 +4133,19 @@ uninstall-am: uninstall-dist_docDATA
- @LCOV_TRUE@description.txt: $(check_PROGRAMS) $(check_SCRIPTS)
- @LCOV_TRUE@	rm -f $@
- @LCOV_TRUE@	for i in $(check_PROGRAMS); do \
--@LCOV_TRUE@		testname=$${i/t-}; \
--@LCOV_TRUE@		testname=$${testname//-/_}; \
-+@LCOV_TRUE@		testname=$${i#t-}; \
-+@LCOV_TRUE@		testname=$$(echo $${testname} | sed -e 's/-/_/g'); \
- @LCOV_TRUE@		fgrep '***' $$i.c | tail -n 1 | \
--@LCOV_TRUE@		(echo $${testname} ; sed -e 's/[^*]*\*\*\*\(.*\)\\n.*/\t\1\n/g' ) >> $@; \
-+@LCOV_TRUE@		(echo $${testname} ; sed -e 's/[^*]*\*\*\*\(.*\)\\
-+@LCOV_TRUE@.*/	\1\
-+@LCOV_TRUE@/g' ) >> $@; \
- @LCOV_TRUE@	done
- @LCOV_TRUE@	for i in $(check_SCRIPTS); do \
--@LCOV_TRUE@		testname=$${i/t-}; \
--@LCOV_TRUE@		testname=$${testname//-/_}; \
-+@LCOV_TRUE@		testname=$${i#t-}; \
-+@LCOV_TRUE@		testname=$$(echo $${testname} | sed -e 's/-/_/g'); \
- @LCOV_TRUE@		grep '^#' $$i | tail -n 1 | \
--@LCOV_TRUE@		(echo $${testname} ; sed -e 's/^# \(.*\)/\t\1\n/g' ) >> $@; \
-+@LCOV_TRUE@		(echo $${testname} ; sed -e 's/^# \(.*\)/	\1\
-+@LCOV_TRUE@/g' ) >> $@; \
- @LCOV_TRUE@	done
- 
- @LCOV_TRUE@description.html: description.txt
---- a/libopendkim/dkim-canon.c	2015-05-11 03:56:13 UTC
-+++ b/libopendkim/dkim-canon.c
-@@ -388,7 +388,7 @@ dkim_canon_header_string(struct dkim_dstring *dstr, dk
- 		}
- 
- 		/* skip all spaces before first word */
--		while (*p != '\0' && DKIM_ISWSP(*p))
-+		while (*p != '\0' && DKIM_ISLWSP(*p))
- 			p++;
- 
- 		space = FALSE;				/* just saw a space */
---- a/opendkim/tests/Makefile.in	2015-05-12 18:43:49 UTC
-+++ b/opendkim/tests/Makefile.in
-@@ -139,8 +139,10 @@ am__nobase_list = $(am__nobase_strip_setup); \
-       { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
-     END { for (dir in files) print dir, files[dir] }'
- am__base_list = \
--  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
--  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\
-+/ /g' | \
-+  sed '$$!N;$$!N;$$!N;$$!N;s/\
-+/ /g'
- am__uninstall_files_from_dir = { \
-   test -z "$$files" \
-     || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
-@@ -1298,14 +1300,16 @@ uninstall-am: uninstall-dist_docDATA
- @LCOV_TRUE@description.txt: $(check_SCRIPTS)
- @LCOV_TRUE@	rm -f $@
- @LCOV_TRUE@	for test in $? ; do \
--@LCOV_TRUE@		testname=$${test/t-}; \
--@LCOV_TRUE@		testname=$${testname//-/_}; \
-+@LCOV_TRUE@		testname=$${test#t-}; \
-+@LCOV_TRUE@		testname=$$(echo $${testname} | sed -e 's/-/_/g'); \
- @LCOV_TRUE@		grep ^# $$test | tail -n 1 | \
--@LCOV_TRUE@			sed -e "s/^#\(.*\)/$${testname}\n\t\1\n/g" >> $@; \
-+@LCOV_TRUE@			sed -e "s/^#\(.*\)/$${testname}\
-+@LCOV_TRUE@	\1\
-+@LCOV_TRUE@/g" >> $@; \
- @LCOV_TRUE@	done
- 
- @LCOV_TRUE@description.html: description.txt
--@LCOV_TRUE@	gendesc --output $@ $<
-+@LCOV_TRUE@	gendesc --output $@ $?
- 
- @LCOV_TRUE@maintainer-clean-local:
- @LCOV_TRUE@	-rm -rf lcov/[^C]*
---- a/opendkim/opendkim-crypto.c	2013-02-25 21:02:41 UTC
-+++ b/opendkim/opendkim-crypto.c
-@@ -222,7 +222,11 @@ dkimf_crypto_free_id(void *ptr)
- 	{
- 		assert(pthread_setspecific(id_key, ptr) == 0);
- 
-+#if OPENSSL_VERSION_NUMBER >= 0x10100000
-+		OPENSSL_thread_stop();
-+#else
- 		ERR_remove_state(0);
-+#endif
- 
- 		free(ptr);
- 
-@@ -392,11 +396,15 @@ dkimf_crypto_free(void)
- {
- 	if (crypto_init_done)
- 	{
-+#if OPENSSL_VERSION_NUMBER >= 0x10100000
-+		OPENSSL_thread_stop();
-+#else
- 		CRYPTO_cleanup_all_ex_data();
- 		CONF_modules_free();
- 		EVP_cleanup();
- 		ERR_free_strings();
- 		ERR_remove_state(0);
-+#endif
- 
- 		if (nmutexes > 0)
- 		{
-

diff --git a/mail-filter/opendkim/files/opendkim-r3.service b/mail-filter/opendkim/files/opendkim-r3.service
deleted file mode 100644
index a102c0a6900..00000000000
--- a/mail-filter/opendkim/files/opendkim-r3.service
+++ /dev/null
@@ -1,15 +0,0 @@
-[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
deleted file mode 100644
index 03bb8d88e2b..00000000000
--- a/mail-filter/opendkim/files/opendkim.confd
+++ /dev/null
@@ -1,18 +0,0 @@
-# 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
deleted file mode 100644
index ad45f420e3c..00000000000
--- a/mail-filter/opendkim/files/opendkim.init.r5
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/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.service b/mail-filter/opendkim/files/opendkim.service
deleted file mode 100644
index be534d670bc..00000000000
--- a/mail-filter/opendkim/files/opendkim.service
+++ /dev/null
@@ -1,11 +0,0 @@
-[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
-ExecReload=/bin/kill -USR1 $MAINPID
-
-[Install]
-WantedBy=multi-user.target

diff --git a/mail-filter/opendkim/files/opendkim.service.conf b/mail-filter/opendkim/files/opendkim.service.conf
deleted file mode 100644
index 380ba22ac94..00000000000
--- a/mail-filter/opendkim/files/opendkim.service.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-[Service]
-Environment="OPENDKIM_SOCKET=inet:8891@localhost"

diff --git a/mail-filter/opendkim/opendkim-2.10.3-r15.ebuild b/mail-filter/opendkim/opendkim-2.10.3-r15.ebuild
deleted file mode 100644
index 2a84537cc6a..00000000000
--- a/mail-filter/opendkim/opendkim-2.10.3-r15.ebuild
+++ /dev/null
@@ -1,230 +0,0 @@
-# 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 test unbound"
-
-COMMON_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 )"
-
-DEPEND="${COMMON_DEPEND}
-	test? ( dev-lang/lua:* )"
-
-RDEPEND="${COMMON_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.r2"
-)
-
-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 -e 's:/var/db/dkim:/var/lib/opendkim:g' \
-		-i opendkim/opendkim.conf.sample opendkim/opendkim.conf.simple.in \
-		|| die
-	sed -e 's:dist_doc_DATA:dist_html_DATA:' \
-		-i libopendkim/docs/Makefile.am \
-		|| die
-	eautoreconf
-}
-
-src_configure() {
-	local myconf=()
-	if use berkdb ; then
-		myconf+=(
-			--with-db-incdir=$(db_includedir)
-			--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
-
-	# We install the our configuration filed under e.g. /etc/opendkim,
-	# so the next line is necessary to point the daemon and all of its
-	# documentation to the right location by default.
-	myconf+=( --sysconfdir="${EPREFIX}/etc/${PN}" )
-
-	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 \
-		--with-test-socket="${T}/opendkim.sock"
-}
-
-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}" <<EOT || die
-
-# The UMask is really only used for the PID file (root:root) and the
-# local UNIX socket, if you're using one. It should be 0117 for the
-# socket.
-UMask			0117
-UserID			opendkim
-
-# For use with unbound
-#TrustAnchorFile	/etc/dnssec/root-anchors.txt
-EOT
-	insinto /etc/opendkim
-	doins "${cf}"
-}
-
-pkg_postinst() {
-	tmpfiles_process "${PN}.conf"
-	if [[ -z ${REPLACING_VERSION} ]]; then
-		elog "If you want to sign your mail messages and need some help"
-		elog "please run:"
-		elog "	emerge --config ${CATEGORY}/${PN}"
-		elog "It will help you create your key and give you hints on how"
-		elog "to configure your DNS and MTA."
-
-		elog "If you are using a local (UNIX) socket, then you will"
-		elog "need to make sure that your MTA has read/write access"
-		elog "to the socket file. This is best accomplished by creating"
-		elog "a completely-new group with only your MTA user and the"
-		elog "\"opendkim\" user in it. Step-by-step instructions can be"
-		elog "found on our Wiki, at https://wiki.gentoo.org/wiki/OpenDKIM ."
-	else
-		ewarn "The user account for the OpenDKIM daemon has changed"
-		ewarn "from \"milter\" to \"opendkim\" to prevent unrelated services"
-		ewarn "from being able to read your private keys. You should"
-		ewarn "adjust your existing configuration to use the \"opendkim\""
-		ewarn "user and group, and change the permissions on"
-		ewarn "${ROOT}var/lib/opendkim to root:opendkim with mode 0750."
-		ewarn "The owner and group of the files within that directory"
-		ewarn "will likely need to be adjusted as well."
-	fi
-}
-
-pkg_config() {
-	local selector keysize pubkey
-
-	read -p "Enter the selector name (default ${HOSTNAME}): " selector
-	[[ -n "${selector}" ]] || selector="${HOSTNAME}"
-	if [[ -z "${selector}" ]]; then
-		eerror "Oddly enough, you don't have a HOSTNAME."
-		return 1
-	fi
-	if [[ -f "${ROOT}var/lib/opendkim/${selector}.private" ]]; then
-		ewarn "The private key for this selector already exists."
-	else
-		keysize=1024
-		# Generate the private and public keys. Note that opendkim-genkeys
-		# sets umask=077 on its own to keep these safe. However, we want
-		# them to be readable (only!) to the opendkim user, and we manage
-		# that by changing their groups and making everything group-readable.
-		opendkim-genkey -b ${keysize} -D "${ROOT}"var/lib/opendkim/ \
-			-s "${selector}" -d '(your domain)' && \
-			chgrp --no-dereference opendkim \
-				"${ROOT}var/lib/opendkim/${selector}".{private,txt} || \
-				{ eerror "Failed to create private and public keys."; return 1; }
-		chmod g+r "${ROOT}var/lib/opendkim/${selector}".{private,txt}
-	fi
-
-	# opendkim selector configuration
-	echo
-	einfo "Make sure you have the following settings in your /etc/opendkim/opendkim.conf:"
-	einfo "  Keyfile /var/lib/opendkim/${selector}.private"
-	einfo "  Selector ${selector}"
-
-	# MTA configuration
-	echo
-	einfo "If you are using Postfix, add following lines to your main.cf:"
-	einfo "  smtpd_milters	   = unix:/run/opendkim/opendkim.sock"
-	einfo "  non_smtpd_milters = unix:/run/opendkim/opendkim.sock"
-	einfo "  and read http://www.postfix.org/MILTER_README.html"
-
-	# DNS configuration
-	einfo "After you configured your MTA, publish your key by adding this TXT record to your domain:"
-	cat "${ROOT}var/lib/opendkim/${selector}.txt"
-	einfo "t=y signifies you only test the DKIM on your domain. See following page for the complete list of tags:"
-	einfo "  http://www.dkim.org/specs/rfc4871-dkimbase.html#key-text"
-}

diff --git a/mail-filter/opendkim/opendkim-2.10.3-r8.ebuild b/mail-filter/opendkim/opendkim-2.10.3-r8.ebuild
deleted file mode 100644
index 9d1d90805c8..00000000000
--- a/mail-filter/opendkim/opendkim-2.10.3-r8.ebuild
+++ /dev/null
@@ -1,223 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit autotools db-use eutils systemd 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 gnutls ldap libressl lmdb lua memcached opendbx poll sasl selinux +ssl static-libs unbound"
-
-DEPEND="|| ( mail-filter/libmilter mail-mta/sendmail )
-	dev-libs/libbsd
-	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 )
-	gnutls? ( >=net-libs/gnutls-3.3 )"
-
-RDEPEND="${DEPEND}
-	sys-process/psmisc
-	selinux? ( sec-policy/selinux-dkim )
-"
-
-REQUIRED_USE="sasl? ( ldap )"
-
-PATCHES=(
-	"${FILESDIR}/${P}-gnutls-3.4.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.
-	enewuser opendkim
-}
-
-src_prepare() {
-	default
-
-	# We delete the "Socket" setting because it's overridden by our
-	# conf.d file.
-	sed -e 's:/var/db/dkim:/var/lib/opendkim:g' \
-		-e '/^[[:space:]]*Socket/d' \
-		-i opendkim/opendkim.conf.sample opendkim/opendkim.conf.simple.in \
-		stats/opendkim-reportstats{,.in} || die
-
-	sed -i -e 's:dist_doc_DATA:dist_html_DATA:' libopendkim/docs/Makefile.am \
-		|| die
-
-	# TODO: what purpose does this serve, do the tests even get run?
-	sed -e "/sock.*mt.getcwd/s:mt.getcwd():${T}:" \
-		-i 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 gnutls) \
-		$(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_install() {
-	default
-	prune_libtool_files
-
-	dosbin stats/opendkim-reportstats
-
-	newinitd "${FILESDIR}/opendkim.init.r5" opendkim
-	newconfd "${FILESDIR}/opendkim.confd" opendkim
-	systemd_newunit "${FILESDIR}/opendkim-r3.service" opendkim.service
-	systemd_install_serviced "${FILESDIR}/${PN}.service.conf" "${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
-
-	# Strip the comments out of the "simple" example configuration...
-	grep ^[^#] "${S}"/opendkim/opendkim.conf.simple \
-		 > "${T}/opendkim.conf" || die
-
-	# and tweak it a bit before installing it unconditionally.
-	echo "# For use with unbound" >> "${T}/opendkim.conf" || die
-	echo "#TrustAnchorFile /etc/dnssec/root-anchors.txt" \
-		 >> "${T}/opendkim.conf" || die
-	echo UserID opendkim >> "${T}/opendkim.conf" || die
-	insinto /etc/opendkim
-	doins "${T}/opendkim.conf"
-}
-
-pkg_postinst() {
-	if [[ -z ${REPLACING_VERSION} ]]; then
-		elog "If you want to sign your mail messages and need some help"
-		elog "please run:"
-		elog "  emerge --config ${CATEGORY}/${PN}"
-		elog "It will help you create your key and give you hints on how"
-		elog "to configure your DNS and MTA."
-
-		# TODO: This is tricky, we really need a good wiki page showing
-		# how to share a local socket with an MTA!
-		elog "If you are using a local (UNIX) socket, then you will"
-		elog "need to make sure that your MTA has read/write access"
-		elog "to the socket file. This is best accomplished by creating"
-		elog "a completely-new group with only your MTA user and the "
-		elog "\"opendkim\" user in it. You would then set \"UMask 0112\""
-		elog "in your opendkim.conf, and switch the primary group of your"
-		elog "\"opendkim\" user to the group that you just created. The"
-		elog "last step is necessary for the socket to be created as the"
-		elog "new group (and not as group \"opendkim\")".
-	else
-		ewarn "The user account for the OpenDKIM daemon has changed"
-		ewarn "from \"milter\" to \"opendkim\" to prevent unrelated services"
-		ewarn "from being able to read your private keys. You should"
-		ewarn "adjust your existing configuration to use the \"opendkim\""
-		ewarn "user and group, and change the permissions on"
-		ewarn "${ROOT}var/lib/opendkim to root:opendkim with mode 0750."
-		ewarn "The owner and group of the files within that directory"
-		ewarn "will likely need to be adjusted as well."
-	fi
-}
-
-pkg_config() {
-	local selector keysize pubkey
-
-	read -p "Enter the selector name (default ${HOSTNAME}): " selector
-	[[ -n "${selector}" ]] || selector="${HOSTNAME}"
-	if [[ -z "${selector}" ]]; then
-		eerror "Oddly enough, you don't have a HOSTNAME."
-		return 1
-	fi
-	if [[ -f "${ROOT}var/lib/opendkim/${selector}.private" ]]; then
-		ewarn "The private key for this selector already exists."
-	else
-		keysize=1024
-		# Generate the private and public keys. Note that opendkim-genkeys
-		# sets umask=077 on its own to keep these safe. However, we want
-		# them to be readable (only!) to the opendkim user, and we manage
-		# that by changing their groups and making everything group-readable.
-		opendkim-genkey -b ${keysize} -D "${ROOT}"var/lib/opendkim/ \
-			-s "${selector}" -d '(your domain)' && \
-			chgrp --no-dereference opendkim \
-				  "${ROOT}var/lib/opendkim/${selector}".{private,txt} || \
-				{ eerror "Failed to create private and public keys." ;
-				  return 1; }
-		chmod g+r "${ROOT}var/lib/opendkim/${selector}".{private,txt}
-	fi
-
-	# opendkim selector configuration
-	echo
-	einfo "Make sure you have the following settings in your /etc/opendkim/opendkim.conf:"
-	einfo "  Keyfile /var/lib/opendkim/${selector}.private"
-	einfo "  Selector ${selector}"
-
-	# MTA configuration
-	echo
-	einfo "If you are using Postfix, add following lines to your main.cf:"
-	einfo "  smtpd_milters     = unix:/run/opendkim/opendkim.sock"
-	einfo "  non_smtpd_milters = unix:/run/opendkim/opendkim.sock"
-	einfo "  and read http://www.postfix.org/MILTER_README.html"
-
-	# DNS configuration
-	einfo "After you configured your MTA, publish your key by adding this TXT record to your domain:"
-	cat "${ROOT}var/lib/opendkim/${selector}.txt"
-	einfo "t=y signifies you only test the DKIM on your domain. See following page for the complete list of tags:"
-	einfo "  http://www.dkim.org/specs/rfc4871-dkimbase.html#key-text"
-}


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: mail-filter/opendkim/, mail-filter/opendkim/files/
@ 2020-01-28 19:51 Michael Orlitzky
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Orlitzky @ 2020-01-28 19:51 UTC (permalink / raw
  To: gentoo-commits

commit:     27f5cf2a6b5241f55adab59c541d18fc04fe7509
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 28 19:28:59 2020 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Tue Jan 28 19:47:56 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=27f5cf2a

mail-filter/opendkim: new revision to fix liblua detection.

The ./configure script for OpenDKIM is all kinds of crazy when it
comes to detecting liblua. First, the PKG_CHECK_MODULES call was
looking for the wrong module, and I had to add the correct name to the
list. But then, once pkg-config could find liblua, it was doing the
wrong thing -- none of the "I have Lua support" commands were being
executed. So in a way it was fortunate that the old PKG_CHECK_MODULES
was failing. In any case, I've patched configure.ac to fix everything,
and will be sending a PR upstream.

This new revision adds that patch.

Closes: https://bugs.gentoo.org/704556
Package-Manager: Portage-2.3.84, Repoman-2.3.20
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 .../files/opendkim-2.10.3-lua-pkgconfig.patch      | 174 ++++++++++++++++
 mail-filter/opendkim/opendkim-2.10.3-r18.ebuild    | 228 +++++++++++++++++++++
 2 files changed, 402 insertions(+)

diff --git a/mail-filter/opendkim/files/opendkim-2.10.3-lua-pkgconfig.patch b/mail-filter/opendkim/files/opendkim-2.10.3-lua-pkgconfig.patch
new file mode 100644
index 00000000000..ee8d5769f76
--- /dev/null
+++ b/mail-filter/opendkim/files/opendkim-2.10.3-lua-pkgconfig.patch
@@ -0,0 +1,174 @@
+From 1f1c947a983c49677544ab08dea3ea04869a8caf Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Sun, 26 Jan 2020 22:29:16 -0500
+Subject: [PATCH 1/1] configure.ac: check for "lua" with pkg-config in addition
+ to "lua5.1".
+
+The upstream Lua pkg-config file is named lua.pc, so unless some
+distribution renames it, OpenDKIM should be looking for "lua"
+and not "lua5.1" in its PKG_CHECK_MODULES call. In any case, we
+should definitely be checking for "lua", so this commit appends it
+to the list of modules we look for. The "lua5.1" module was left
+alone, because I don't know enough of the history to be sure that
+removing it is the right thing to do.
+
+When the call to PKG_CHECK_MODULES fails, OpenDKIM falls back to
+a manual search that looks in /usr/lib, and this can detect 32-bit
+libraries on a 64-bit system. Therefore it is preferable that the
+PKG_CHECK_MODULES call succeed.
+
+In the process of adding this fallback, I realized that some
+additional actions need to be performed in the success branch of
+the existing (and new) PKG_CHECK_MODULES call. The following
+three lines were added,
+
+  AC_SEARCH_LIBS([dlopen], [dl])
+  AC_SUBST([LUA_MANNOTICE], "")
+  AC_DEFINE([USE_LUA], 1, [support for Lua scripting])
+
+to tell various parts of OpenDKIM that we do indeed have Lua support.
+Afterwards, it became clear that those three lines could be factored
+out of *every* lua check, so that has been done as well.
+
+Closes: https://github.com/trusteddomainproject/OpenDKIM/issues/62
+Gentoo-bug: https://bugs.gentoo.org/704556
+---
+ configure.ac | 45 +++++++++++++++++----------------------------
+ 1 file changed, 17 insertions(+), 28 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index a478bb83..1d0db41a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1495,12 +1495,20 @@ lua_found="no"
+ 
+ if test \(  x"$luapath" = x"auto" -o x"$luapath" = x"yes" \) -a x"$PKG_CONFIG" != x""
+ then
+-        PKG_CHECK_MODULES([LIBLUA], [lua5.1],
+-	                  [
+-				lua_found="yes"
+-				LIBLUA_INCDIRS="$LIBLUA_CFLAGS"
+-	                  ],
+-			  [AC_MSG_WARN([pkg-config for Lua not found, trying manual search...])])
++  PKG_CHECK_MODULES([LIBLUA], [lua5.1], [
++      LIBLUA_INCDIRS="$LIBLUA_CFLAGS"
++      lua_found="yes"
++    ],
++    [
++      AC_MSG_WARN([pkg-config for lua5.1 not found, trying lua...])
++      PKG_CHECK_MODULES([LIBLUA], [lua], [
++          LIBLUA_INCDIRS="$LIBLUA_CFLAGS"
++          lua_found="yes"
++        ],
++	[AC_MSG_WARN([pkg-config for lua not found, trying manual search...])]
++      )
++    ]
++  )
+ fi
+ 
+ if test \( x"$luapath" = x"yes" -o x"$luapath" = x"auto" \) -a x"$lua_found" = x"no"
+@@ -1515,10 +1523,6 @@ then
+ 			LIBLUA_INCDIRS="-I$d/include/lua51"
+ 			LIBLUA_LIBDIRS="-L$d/lib/lua51"
+ 			LIBLUA_LIBS="-llua -lm"
+-			AC_SEARCH_LIBS([dlopen], [dl])
+-			AC_DEFINE([USE_LUA], 1,
+-			          [support for Lua scripting])
+-			AC_SUBST([LUA_MANNOTICE], "")
+ 			lua_found="yes"
+ 			break
+ 		elif test -f $d/include/lua52/lua.h
+@@ -1527,10 +1531,6 @@ then
+ 			LIBLUA_INCDIRS="-I$d/include/lua52"
+ 			LIBLUA_LIBDIRS="-L$d/lib/lua52"
+ 			LIBLUA_LIBS="-llua -lm"
+-			AC_SEARCH_LIBS([dlopen], [dl])
+-			AC_DEFINE([USE_LUA], 1,
+-			          [support for Lua scripting])
+-			AC_SUBST([LUA_MANNOTICE], "")
+ 			lua_found="yes"
+ 			break
+ 		elif test -f $d/include/lua5.1/lua.h
+@@ -1539,10 +1539,6 @@ then
+ 			LIBLUA_INCDIRS="-I$d/include/lua5.1"
+ 			LIBLUA_LIBDIRS="-L$d/lib"
+ 			LIBLUA_LIBS="-llua5.1 -lm"
+-			AC_SEARCH_LIBS([dlopen], [dl])
+-			AC_DEFINE([USE_LUA], 1,
+-			          [support for Lua scripting])
+-			AC_SUBST([LUA_MANNOTICE], "")
+ 			lua_found="yes"
+ 			break
+ 		elif test -f $d/include/lua5.2/lua.h
+@@ -1551,10 +1547,6 @@ then
+ 			LIBLUA_INCDIRS="-I$d/include/lua5.2"
+ 			LIBLUA_LIBDIRS="-L$d/lib"
+ 			LIBLUA_LIBS="-llua5.2 -lm"
+-			AC_SEARCH_LIBS([dlopen], [dl])
+-			AC_DEFINE([USE_LUA], 1,
+-			          [support for Lua scripting])
+-			AC_SUBST([LUA_MANNOTICE], "")
+ 			lua_found="yes"
+ 			break
+ 		elif test -f $d/include/lua.h
+@@ -1563,7 +1555,6 @@ then
+ 			LIBLUA_INCDIRS="-I$d/include"
+ 			LIBLUA_LIBDIRS="-L$d/lib"
+ 			LIBLUA_LIBS="-llua -lm"
+-			AC_SEARCH_LIBS([dlopen], [dl])
+ 			lua_found="yes"
+ 			break
+ 		fi
+@@ -1588,7 +1579,6 @@ then
+ 		LIBLUA_INCDIRS="-I$luapath/include/lua51"
+ 		LIBLUA_LIBDIRS="-L$luapath/lib/lua51"
+ 		LIBLUA_LIBS="-llua -lm"
+-		AC_SEARCH_LIBS([dlopen], [dl])
+ 		lua_found="yes"
+ 	elif test -f $luapath/include/lua52/lua.h
+ 	then
+@@ -1596,7 +1586,6 @@ then
+ 		LIBLUA_INCDIRS="-I$luapath/include/lua52"
+ 		LIBLUA_LIBDIRS="-L$luapath/lib/lua52"
+ 		LIBLUA_LIBS="-llua -lm"
+-		AC_SEARCH_LIBS([dlopen], [dl])
+ 		lua_found="yes"
+ 	elif test -f $luapath/include/lua5.1/lua.h
+ 	then
+@@ -1604,7 +1593,6 @@ then
+ 		LIBLUA_INCDIRS="-I$luapath/include/lua5.1"
+ 		LIBLUA_LIBDIRS="-L$luapath/lib"
+ 		LIBLUA_LIBS="-llua5.1 -lm"
+-		AC_SEARCH_LIBS([dlopen], [dl])
+ 		lua_found="yes"
+ 	elif test -f $luapath/include/lua5.2/lua.h
+ 	then
+@@ -1612,7 +1600,6 @@ then
+ 		LIBLUA_INCDIRS="-I$luapath/include/lua5.2"
+ 		LIBLUA_LIBDIRS="-L$luapath/lib"
+ 		LIBLUA_LIBS="-llua5.2 -lm"
+-		AC_SEARCH_LIBS([dlopen], [dl])
+ 		lua_found="yes"
+ 	elif test -f $luapath/include/lua.h
+ 	then
+@@ -1620,7 +1607,6 @@ then
+ 		LIBLUA_INCDIRS="-I$luapath/include"
+ 		LIBLUA_LIBDIRS="-L$luapath/lib"
+ 		LIBLUA_LIBS="-llua -lm"
+-		AC_SEARCH_LIBS([dlopen], [dl])
+ 		lua_found="yes"
+ 	else
+ 		AC_MSG_ERROR(not found at $luapath)
+@@ -1629,6 +1615,9 @@ fi
+ 
+ if test x"$lua_found" = x"yes"
+ then
++	AC_SUBST([LUA_MANNOTICE], "")
++	AC_DEFINE([USE_LUA], 1, [support for Lua scripting])
++	AC_SEARCH_LIBS([dlopen], [dl])
+ 	saved_CPPFLAGS="$CPPFLAGS"
+ 	CPPFLAGS="$outer_CPPFLAGS $LIBLUA_INCDIRS"
+ 	AC_MSG_CHECKING([Lua version])
+-- 
+2.24.1
+

diff --git a/mail-filter/opendkim/opendkim-2.10.3-r18.ebuild b/mail-filter/opendkim/opendkim-2.10.3-r18.ebuild
new file mode 100644
index 00000000000..260010392d1
--- /dev/null
+++ b/mail-filter/opendkim/opendkim-2.10.3-r18.ebuild
@@ -0,0 +1,228 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools db-use eutils systemd tmpfiles
+
+DESCRIPTION="A milter providing DKIM signing and verification"
+HOMEPAGE="http://opendkim.org/"
+SRC_URI="https://downloads.sourceforge.net/project/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 stats querycache test unbound"
+
+BDEPEND="acct-user/opendkim
+	test? ( dev-lang/lua:* )"
+
+COMMON_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 )"
+
+DEPEND="${COMMON_DEPEND}"
+
+RDEPEND="${COMMON_DEPEND}
+	acct-user/opendkim
+	sys-process/psmisc
+	selinux? ( sec-policy/selinux-dkim )"
+
+REQUIRED_USE="sasl? ( ldap )
+	stats? ( opendbx )
+	querycache? ( berkdb )"
+RESTRICT="!test? ( test )"
+
+PATCHES=(
+	"${FILESDIR}/${P}-openrc.patch"
+	"${FILESDIR}/${P}-openssl-1.1.1.patch.r2"
+	"${FILESDIR}/${P}-lua-pkgconfig.patch"
+)
+
+src_prepare() {
+	default
+	sed -e 's:/var/db/dkim:/var/lib/opendkim:g' \
+		-i opendkim/opendkim.conf.sample opendkim/opendkim.conf.simple.in \
+		|| die
+	sed -e 's:dist_doc_DATA:dist_html_DATA:' \
+		-i libopendkim/docs/Makefile.am \
+		|| die
+	eautoreconf
+}
+
+src_configure() {
+	local myconf=()
+	if use berkdb ; then
+		myconf+=( --with-db-incdir=$(db_includedir) )
+	fi
+	if use unbound; then
+		myconf+=( --with-unbound )
+	else
+		myconf+=( --with-ldns )
+	fi
+	if use ldap; then
+		myconf+=( $(use_with sasl) )
+	fi
+
+	# We install the our configuration filed under e.g. /etc/opendkim,
+	# so the next line is necessary to point the daemon and all of its
+	# documentation to the right location by default.
+	myconf+=( --sysconfdir="${EPREFIX}/etc/${PN}" )
+
+	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 querycache query_cache) \
+		$(use_enable static-libs static) \
+		$(use_enable stats) \
+		$(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 \
+		--with-test-socket="${T}/opendkim.sock"
+}
+
+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}" <<EOT || die
+
+# The UMask is really only used for the PID file (root:root) and the
+# local UNIX socket, if you're using one. It should be 0117 for the
+# socket.
+UMask			0117
+UserID			opendkim
+
+# For use with unbound
+#TrustAnchorFile	/etc/dnssec/root-anchors.txt
+EOT
+	insinto /etc/opendkim
+	doins "${cf}"
+}
+
+pkg_postinst() {
+	tmpfiles_process "${PN}.conf"
+	if [[ -z ${REPLACING_VERSION} ]]; then
+		elog "If you want to sign your mail messages and need some help"
+		elog "please run:"
+		elog "	emerge --config ${CATEGORY}/${PN}"
+		elog "It will help you create your key and give you hints on how"
+		elog "to configure your DNS and MTA."
+
+		elog "If you are using a local (UNIX) socket, then you will"
+		elog "need to make sure that your MTA has read/write access"
+		elog "to the socket file. This is best accomplished by creating"
+		elog "a completely-new group with only your MTA user and the"
+		elog "\"opendkim\" user in it. Step-by-step instructions can be"
+		elog "found on our Wiki, at https://wiki.gentoo.org/wiki/OpenDKIM ."
+	else
+		ewarn "The user account for the OpenDKIM daemon has changed"
+		ewarn "from \"milter\" to \"opendkim\" to prevent unrelated services"
+		ewarn "from being able to read your private keys. You should"
+		ewarn "adjust your existing configuration to use the \"opendkim\""
+		ewarn "user and group, and change the permissions on"
+		ewarn "${ROOT}/var/lib/opendkim to root:opendkim with mode 0750."
+		ewarn "The owner and group of the files within that directory"
+		ewarn "will likely need to be adjusted as well."
+	fi
+}
+
+pkg_config() {
+	local selector keysize pubkey
+
+	read -p "Enter the selector name (default ${HOSTNAME}): " selector
+	[[ -n "${selector}" ]] || selector="${HOSTNAME}"
+	if [[ -z "${selector}" ]]; then
+		eerror "Oddly enough, you don't have a HOSTNAME."
+		return 1
+	fi
+	if [[ -f "${ROOT}/var/lib/opendkim/${selector}.private" ]]; then
+		ewarn "The private key for this selector already exists."
+	else
+		keysize=1024
+		# Generate the private and public keys. Note that opendkim-genkeys
+		# sets umask=077 on its own to keep these safe. However, we want
+		# them to be readable (only!) to the opendkim user, and we manage
+		# that by changing their groups and making everything group-readable.
+		opendkim-genkey -b ${keysize} -D "${ROOT}/var/lib/opendkim/" \
+			-s "${selector}" -d '(your domain)' && \
+			chgrp --no-dereference opendkim \
+				"${ROOT}/var/lib/opendkim/${selector}".{private,txt} || \
+				{ eerror "Failed to create private and public keys."; return 1; }
+		chmod g+r "${ROOT}/var/lib/opendkim/${selector}".{private,txt}
+	fi
+
+	# opendkim selector configuration
+	echo
+	einfo "Make sure you have the following settings in your /etc/opendkim/opendkim.conf:"
+	einfo "  Keyfile /var/lib/opendkim/${selector}.private"
+	einfo "  Selector ${selector}"
+
+	# MTA configuration
+	echo
+	einfo "If you are using Postfix, add following lines to your main.cf:"
+	einfo "  smtpd_milters	   = unix:/run/opendkim/opendkim.sock"
+	einfo "  non_smtpd_milters = unix:/run/opendkim/opendkim.sock"
+	einfo "  and read http://www.postfix.org/MILTER_README.html"
+
+	# DNS configuration
+	einfo "After you configured your MTA, publish your key by adding this TXT record to your domain:"
+	cat "${ROOT}/var/lib/opendkim/${selector}.txt"
+	einfo "t=y signifies you only test the DKIM on your domain. See following page for the complete list of tags:"
+	einfo "  http://www.dkim.org/specs/rfc4871-dkimbase.html#key-text"
+}


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: mail-filter/opendkim/, mail-filter/opendkim/files/
@ 2020-12-09 15:05 Michael Orlitzky
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Orlitzky @ 2020-12-09 15:05 UTC (permalink / raw
  To: gentoo-commits

commit:     8e5aca07ddfbd0e6578698a24390b006897e941a
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Wed Dec  9 13:37:45 2020 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Wed Dec  9 15:01:46 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8e5aca07

mail-filter/opendkim: new revision to fix lib/lib64 mixup.

Includes a patch that I've sent upstream to prevent ./configure from
"detecting" /usr/lib as the correct library path when -lfoo works
regardless of whether or not you're looking in /usr/lib.

Closes: https://bugs.gentoo.org/751286
Package-Manager: Portage-3.0.9, Repoman-3.0.2
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 .../opendkim-2.10.3-fix-libmilter-search.patch     | 223 +++++++++++++++++++++
 ....10.3-r18.ebuild => opendkim-2.10.3-r19.ebuild} |   2 +
 2 files changed, 225 insertions(+)

diff --git a/mail-filter/opendkim/files/opendkim-2.10.3-fix-libmilter-search.patch b/mail-filter/opendkim/files/opendkim-2.10.3-fix-libmilter-search.patch
new file mode 100644
index 00000000000..5e03a9931cf
--- /dev/null
+++ b/mail-filter/opendkim/files/opendkim-2.10.3-fix-libmilter-search.patch
@@ -0,0 +1,223 @@
+From a1371d8c81d5fc22cbc8ea2b1c9eb465e9a8e874 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Fri, 6 Nov 2020 07:40:06 -0500
+Subject: [PATCH] configure.ac: simplify the search for libmilter.
+
+This commit (temporarily?) reverts the --with-milter flag to a boolean,
+disallowing the user to pass it a path. This is done for several reasons:
+
+  * There's only one standard major version of libmilter, so people are
+    unlikely to have multiple copies of it installed side-by-side. And
+    When only one copy is present and usable with "-lmilter", the
+    ability to specify a path is redundant.
+
+  * The "milter path" was used for both the headers and the library
+    itself. As a result, the user was expected to specify something
+    like "/usr" as the milter path, whence OpenDKIM would infer that
+    the headers live in /usr/include and that the libraries live
+    in /usr/<somewhere>. If multiple libraries live in multiple
+    somewheres -- as is the case with "lib" and "lib64" on multilib
+    systems -- OpenDKIM is prone to guessing incorrectly. In other
+    words, the "milter path" mechanism was not fine-grained enough
+    to specify the correct library, and this led to link failures
+    in some not-too-uncommon cases.
+
+  * Headers and libraries in non-standard paths should be handled with
+    pkg-config, anyway.
+---
+ configure.ac         | 129 +++++++------------------------------------
+ opendkim/Makefile.am |   9 ++-
+ 2 files changed, 23 insertions(+), 115 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 828fe53f..8234e588 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -932,120 +932,29 @@ AC_SUBST(LIBCRYPTO_LIBS)
+ AC_MSG_CHECKING([for milter library and includes])
+ AC_ARG_WITH([milter],
+             AS_HELP_STRING([--with-milter],
+-                           [location of milter includes and library]),
+-            [milterpath="$withval"], [milterpath="auto"])
+-
+-if test x"$enable_filter" = x"no"
+-then
+-	milterpath="no"
+-fi
+-
+-if test "$milterpath" = "auto" -o "$milterpath" = "yes"
+-then
+-	milterdirs="/usr/local /opt/local /usr"
+-	for d in $milterdirs
+-	do
+-		if test -f $d/include/libmilter/mfapi.h
+-		then
+-			milterpath=$d
+-			break
+-		fi
+-	done
+-fi
+-case "$milterpath" in
+-	no)
+-		if test x"$enable_filter" = x"yes"
+-		then
+-			AC_MSG_ERROR([milter is required])
+-		fi
+-		AC_MSG_RESULT(disabled)
+-		;;
+-	auto)
+-		AC_MSG_ERROR([milter not found])
+-		;;
+-	*/*)
+-		if ! test -f $milterpath/include/libmilter/mfapi.h
+-		then
+-			AC_MSG_ERROR([milter includes not found at $milterpath])
+-		fi
+-		AC_MSG_RESULT([$milterpath])
+-		;;
+-	*)
+-		AC_MSG_ERROR([milter not found])
+-		;;
+-esac
+-
+-LIBMILTER_INCDIRS=""
+-LIBMILTER_LIBDIRS=""
+-LIBMILTER_LIBS=""
++                           [whether or not (yes or no) to use libmilter]),
++            [milterpath="$withval"], [milterpath="no"])
++
++AS_IF([test x"$enable_filter" = x"no"],[milterpath="no"])
++AS_IF([test x"$milterpath" = x"no"], [
++  AS_IF([test x"$enable_filter" = x"yes"],[
++    AC_MSG_ERROR([libmilter is required if filtering is enabled])
++  ])
++])
+ 
+-if test x"$milterpath" != x"no"
+-then
+-	LIBMILTER_INCDIRS="-I$milterpath/include"
++AS_IF([test x"$milterpath" = x"yes"], [
++  AC_CHECK_HEADER(libmilter/mfapi.h,
++                  [],
++		  AC_MSG_ERROR([libmilter/mfapi.h not found]))
+ 
+-	saved_CC="$CC"
+-	saved_CFLAGS="$CFLAGS"
+-	saved_CPPFLAGS="$CPPFLAGS"
+-	saved_LDFLAGS="$LDFLAGS"
+-	saved_LIBS="$LIBS"
++  AC_SEARCH_LIBS([smfi_register],
++                 [milter],
++		 [LIBMILTER_LIBS="-lmilter"],
++		 AC_MSG_ERROR([libmilter not found]))
+ 
+-	CC="$PTHREAD_CC"
+-	LIBS="$outer_LIBS $PTHREAD_LIBS $saved_LIBS"
+-	CPPFLAGS="$LIBMILTER_INCDIRS $saved_CPPFLAGS"
+-	CFLAGS="$PTHREAD_CFLAGS $saved_CFLAGS"
+-	LDFLAGS="$outer_LDFLAGS $PTHREAD_CFLAGS $saved_LDFLAGS"
+-
+-	breakloop="no"
+-	for d in lib lib64 lib/libmilter
+-	do
+-		unset ac_cv_search_smfi_register
+-		LDFLAGS="$outer_LDFLAGS $PTHREAD_CFLAGS -L$milterpath/$d $saved_LDFLAGS"
+-		AC_SEARCH_LIBS([smfi_register], [milter],
+-		               [
+-		               	LIBMILTER_LIBDIRS="-L$milterpath/$d"
+-		               	LIBMILTER_LIBS="-lmilter"
+-		               	breakloop="yes"
+-		               ])
+-
+-		AC_CHECK_FUNC([smfi_insheader],
+-			      AC_DEFINE([HAVE_SMFI_INSHEADER], 1,
+-					[Define if libmilter has smfi_insheader()]))
+-
+-		AC_CHECK_FUNC([smfi_opensocket],
+-			      AC_DEFINE([HAVE_SMFI_OPENSOCKET], 1,
+-					[Define if libmilter has smfi_opensocket()]))
+-
+-		AC_CHECK_FUNC([smfi_progress],
+-			      AC_DEFINE([HAVE_SMFI_PROGRESS], 1,
+-					[Define if libmilter has smfi_progress()]))
+-
+-		AC_CHECK_FUNC([smfi_setsymlist],
+-			      AC_DEFINE([HAVE_SMFI_SETSYMLIST], 1,
+-					[Define if libmilter has smfi_setsymlist()]))
+-
+-		AC_CHECK_FUNC([smfi_version],
+-			      AC_DEFINE([HAVE_SMFI_VERSION], 1,
+-					[Define if libmilter has smfi_version()]))
+-
+-		if test x"$breakloop" = x"yes"
+-		then
+-			break
+-		fi
+-	done
+-	if test x"$LIBMILTER_LIBDIRS" = x""
+-	then
+-		AC_MSG_ERROR([libmilter not found])
+-	fi
+-
+-	CC="$saved_CC"
+-	CPPFLAGS="$saved_CPPFLAGS"
+-	CFLAGS="$saved_CFLAGS"
+-	LDFLAGS="$saved_LDFLAGS"
+-	LIBS="$saved_LIBS"
+-fi
++  AC_CHECK_FUNCS([smfi_insheader smfi_opensocket smfi_progress smfi_setsymlist smfi_version])
++])
+ 
+-AC_SUBST(LIBMILTER_INCDIRS)
+-AC_SUBST(LIBMILTER_LIBDIRS)
+ AC_SUBST(LIBMILTER_LIBS)
+ 
+ #
+diff --git a/opendkim/Makefile.am b/opendkim/Makefile.am
+index 4aa615c1..e3d1d10e 100644
+--- a/opendkim/Makefile.am
++++ b/opendkim/Makefile.am
+@@ -26,7 +26,7 @@ opendkim_SOURCES = opendkim.c opendkim.h opendkim-ar.c opendkim-ar.h opendkim-ar
+ opendkim_CC = $(PTHREAD_CC)
+ opendkim_CFLAGS = $(PTHREAD_CFLAGS) $(LIBCRYPTO_CFLAGS) $(COV_CFLAGS)
+ opendkim_CPPFLAGS = -I$(srcdir)/../libopendkim $(LIBCRYPTO_CPPFLAGS)
+-opendkim_LDFLAGS = $(LIBCRYPTO_LIBDIRS) $(LIBMILTER_LIBDIRS) $(PTHREAD_CFLAGS) $(COV_LDFLAGS)
++opendkim_LDFLAGS = $(LIBCRYPTO_LIBDIRS) $(PTHREAD_CFLAGS) $(COV_LDFLAGS)
+ opendkim_LDADD = ../libopendkim/libopendkim.la $(LIBMILTER_LIBS) $(LIBCRYPTO_LIBS) $(PTHREAD_LIBS) $(COV_LIBADD) $(LIBRESOLV)
+ if USE_DB_OPENDKIM
+ opendkim_CPPFLAGS += $(LIBDB_INCDIRS)
+@@ -88,7 +88,6 @@ opendkim_CPPFLAGS += -I$(srcdir)/../reprrd
+ opendkim_LDADD += ../reprrd/libreprrd.la
+ endif
+ 
+-opendkim_CPPFLAGS += $(LIBMILTER_INCDIRS)
+ endif
+ 
+ if STATS
+@@ -108,7 +107,7 @@ opendkim_testkey_CFLAGS = $(LIBCRYPTO_CFLAGS) $(COV_CFLAGS) $(PTHREAD_CFLAGS)
+ opendkim_testkey_LDFLAGS = $(LIBCRYPTO_LIBDIRS) $(COV_LDFLAGS) $(PTHREAD_CFLAGS)
+ opendkim_testkey_LDADD = ../libopendkim/libopendkim.la $(LIBCRYPTO_LIBS) $(LIBRESOLV) $(COV_LIBADD) $(PTHREAD_LIBS)
+ if LUA
+-opendkim_testkey_CPPFLAGS += $(LIBLUA_INCDIRS) $(LIBMILTER_INCDIRS)
++opendkim_testkey_CPPFLAGS += $(LIBLUA_INCDIRS)
+ opendkim_testkey_LDFLAGS += $(LIBLUA_LIBDIRS)
+ opendkim_testkey_LDADD += $(LIBLUA_LIBS)
+ endif
+@@ -200,7 +199,7 @@ opendkim_genzone_CPPFLAGS += $(OPENLDAP_CPPFLAGS)
+ opendkim_genzone_LDADD += $(OPENLDAP_LIBS)
+ endif
+ if LUA
+-opendkim_genzone_CPPFLAGS += $(LIBLUA_INCDIRS) $(LIBMILTER_INCDIRS)
++opendkim_genzone_CPPFLAGS += $(LIBLUA_INCDIRS)
+ opendkim_genzone_LDFLAGS += $(LIBLUA_LIBDIRS)
+ opendkim_genzone_LDADD += $(LIBLUA_LIBS)
+ endif
+@@ -250,7 +249,7 @@ opendkim_atpszone_CPPFLAGS += $(OPENLDAP_CPPFLAGS)
+ opendkim_atpszone_LDADD += $(OPENLDAP_LIBS)
+ endif
+ if LUA
+-opendkim_atpszone_CPPFLAGS += $(LIBLUA_INCDIRS) $(LIBMILTER_INCDIRS)
++opendkim_atpszone_CPPFLAGS += $(LIBLUA_INCDIRS)
+ opendkim_atpszone_LDFLAGS += $(LIBLUA_LIBDIRS)
+ opendkim_atpszone_LDADD += $(LIBLUA_LIBS)
+ endif

diff --git a/mail-filter/opendkim/opendkim-2.10.3-r18.ebuild b/mail-filter/opendkim/opendkim-2.10.3-r19.ebuild
similarity index 99%
rename from mail-filter/opendkim/opendkim-2.10.3-r18.ebuild
rename to mail-filter/opendkim/opendkim-2.10.3-r19.ebuild
index 33852707c25..7b9bb903b79 100644
--- a/mail-filter/opendkim/opendkim-2.10.3-r18.ebuild
+++ b/mail-filter/opendkim/opendkim-2.10.3-r19.ebuild
@@ -52,6 +52,7 @@ PATCHES=(
 	"${FILESDIR}/${P}-openssl-1.1.1.patch.r2"
 	"${FILESDIR}/${P}-lua-pkgconfig.patch"
 	"${FILESDIR}/${P}-define-P-macro-in-libvbr.patch"
+	"${FILESDIR}/${P}-fix-libmilter-search.patch"
 )
 
 src_prepare() {
@@ -98,6 +99,7 @@ src_configure() {
 		$(use_with memcached libmemcached) \
 		"${myconf[@]}" \
 		--enable-filter \
+		--with-milter \
 		--enable-atps \
 		--enable-identity_header \
 		--enable-rate_limit \


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: mail-filter/opendkim/, mail-filter/opendkim/files/
@ 2020-12-24 15:56 Michael Orlitzky
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Orlitzky @ 2020-12-24 15:56 UTC (permalink / raw
  To: gentoo-commits

commit:     23a08d7367b3dfa0957e2ab1cfab3f799a6b3bf5
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 24 15:36:41 2020 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Thu Dec 24 15:36:41 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=23a08d73

mail-filter/opendkim: add back lua-5.2 support.

Package-Manager: Portage-3.0.9, Repoman-3.0.2
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 .../files/opendkim-2.10.3-lua-pkgconfig-pt2.patch  | 51 ++++++++++++++++++++++
 mail-filter/opendkim/opendkim-2.10.3-r25.ebuild    |  6 +--
 2 files changed, 53 insertions(+), 4 deletions(-)

diff --git a/mail-filter/opendkim/files/opendkim-2.10.3-lua-pkgconfig-pt2.patch b/mail-filter/opendkim/files/opendkim-2.10.3-lua-pkgconfig-pt2.patch
new file mode 100644
index 00000000000..9e963eced4d
--- /dev/null
+++ b/mail-filter/opendkim/files/opendkim-2.10.3-lua-pkgconfig-pt2.patch
@@ -0,0 +1,51 @@
+From 6dcab8d2e001bb4b91314693affa65e9c1a9adbd Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Tue, 22 Dec 2020 19:36:28 -0500
+Subject: [PATCH 1/2] configure.ac: drop lua5.1 pkg-config check.
+
+The official upstream name for the lua pkg-config file is "lua.pc", so
+preferring the name "lua5.1.pc" to the official one can lead to
+problems when both are installed. Specifically, if lua-5.2 is
+installed and its pkg-config file is called "lua.pc", then ./configure
+will still detect (and use!) lua-5.1 if it happens to be installed
+with just the right name.
+
+This was honestly left in only for superstitious reasons, and now it's
+actually causing problems on Gentoo systems that have more than one
+version of Lua installed. So, time to go.
+
+Closes: https://github.com/trusteddomainproject/OpenDKIM/issues/111
+---
+ configure.ac | 14 ++------------
+ 1 file changed, 2 insertions(+), 12 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 828fe53f..d3d688ec 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1517,20 +1517,10 @@ lua_found="no"
+ 
+ if test \(  x"$luapath" = x"auto" -o x"$luapath" = x"yes" \) -a x"$PKG_CONFIG" != x""
+ then
+-  PKG_CHECK_MODULES([LIBLUA], [lua5.1], [
++  PKG_CHECK_MODULES([LIBLUA], [lua], [
+       LIBLUA_INCDIRS="$LIBLUA_CFLAGS"
+       lua_found="yes"
+-    ],
+-    [
+-      AC_MSG_WARN([pkg-config for lua5.1 not found, trying lua...])
+-      PKG_CHECK_MODULES([LIBLUA], [lua], [
+-          LIBLUA_INCDIRS="$LIBLUA_CFLAGS"
+-          lua_found="yes"
+-        ],
+-	[AC_MSG_WARN([pkg-config for lua not found, trying manual search...])]
+-      )
+-    ]
+-  )
++    ])
+ fi
+ 
+ if test \( x"$luapath" = x"yes" -o x"$luapath" = x"auto" \) -a x"$lua_found" = x"no"
+-- 
+2.26.2
+

diff --git a/mail-filter/opendkim/opendkim-2.10.3-r25.ebuild b/mail-filter/opendkim/opendkim-2.10.3-r25.ebuild
index eb05adb29aa..b105074a89a 100644
--- a/mail-filter/opendkim/opendkim-2.10.3-r25.ebuild
+++ b/mail-filter/opendkim/opendkim-2.10.3-r25.ebuild
@@ -3,10 +3,7 @@
 
 EAPI=7
 
-# Supports lua5-2 as well but in order for that to work the lua-pkgconfig
-# patch has to be updated not to prefer "lua5.1" over "lua" while looking
-# for Lua pkgconfig modules.
-LUA_COMPAT=( lua5-1 )
+LUA_COMPAT=( lua5-1 lua5-2 )
 
 inherit autotools db-use eutils systemd tmpfiles lua-single
 
@@ -58,6 +55,7 @@ PATCHES=(
 	"${FILESDIR}/${P}-openrc.patch"
 	"${FILESDIR}/${P}-openssl-1.1.1.patch.r2"
 	"${FILESDIR}/${P}-lua-pkgconfig.patch"
+	"${FILESDIR}/${P}-lua-pkgconfig-pt2.patch"
 	"${FILESDIR}/${P}-define-P-macro-in-libvbr.patch"
 	"${FILESDIR}/${P}-fix-libmilter-search.patch"
 )


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: mail-filter/opendkim/, mail-filter/opendkim/files/
@ 2023-02-23 23:36 Michael Orlitzky
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Orlitzky @ 2023-02-23 23:36 UTC (permalink / raw
  To: gentoo-commits

commit:     9c1172d2e454c89f3bbda6841e06b8230a399d49
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 23 22:43:58 2023 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Thu Feb 23 23:33:20 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9c1172d2

mail-filter/opendkim: fix two musl/standards issues.

New patches to fix a missing include and to correct a few function
signatures that violated the C standards.

Closes: https://bugs.gentoo.org/870412
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 .../opendkim/files/opendkim-2.10.3-c-std.patch     | 155 +++++++++++++++++++++
 .../files/opendkim-2.10.3-snprintf-include.patch   |  27 ++++
 mail-filter/opendkim/opendkim-2.10.3-r30.ebuild    |   2 +
 3 files changed, 184 insertions(+)

diff --git a/mail-filter/opendkim/files/opendkim-2.10.3-c-std.patch b/mail-filter/opendkim/files/opendkim-2.10.3-c-std.patch
new file mode 100644
index 000000000000..08df8eb0b03b
--- /dev/null
+++ b/mail-filter/opendkim/files/opendkim-2.10.3-c-std.patch
@@ -0,0 +1,155 @@
+From 2d6db0225da9632ddf25aa70839d9d6244af6a42 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Thu, 23 Feb 2023 17:37:33 -0500
+Subject: [PATCH 1/1] configure.ac: update main() signatures to conform to the
+ standard.
+
+There are some tests in configure.ac that contain,
+
+  int main() { ... }
+
+That's not the correct signature for main() according to the C
+standard, and newer compilers are going to reject it. More information
+about this can be found at,
+
+  https://wiki.gentoo.org/wiki/Modern_C_porting
+
+In this case, the fix is simply to write
+
+  int main(int argc, char** argv) { ... }
+
+instead.
+---
+ configure.ac | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 1eaa95d8..d8162303 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -147,7 +147,7 @@ dnscheck='
+ #include <netinet/in.h>
+ #include <arpa/nameser.h>
+ #include <resolv.h> 
+-int main() {
++int main(int argc, char** argv) {
+ res_mkquery (0, 0, 0, 0, 0, 0, 0, 0, 0);
+ dn_expand (0, 0, 0, 0, 0);
+ dn_skipname (0, 0);
+@@ -549,7 +549,7 @@ gprof_gmon_out="unknown"
+ if test x"$hasgprof" = x"yes"
+ then
+ 	gprofcheck='
+-int main() {
++int main(int argc, char** argv) {
+ 	long x;
+ 
+ 	x = random();
+@@ -747,7 +747,7 @@ then
+ 		#if GNUTLS_VERSION_NUMBER < 0x020b07
+ 		# error GnuTLS 2.11.7 or later required
+ 		#endif 
+-		int main()
++		int main(int argc, char** argv)
+ 		{
+ 			return 0;
+ 		}'
+@@ -759,7 +759,7 @@ then
+ 
+ 	sha256check='
+ 		#include <gnutls/gnutls.h>
+-		int main()
++		int main(int argc, char** argv)
+ 		{
+ 			int x = GNUTLS_DIG_SHA256;
+ 		}'
+@@ -1191,7 +1191,7 @@ then
+ #include <libmemcached/memcached.h>
+ 
+ int
+-main()
++main(int argc, char** argv)
+ {
+ 	memcached_return_t x;
+ 
+@@ -1649,7 +1649,7 @@ then
+ #endif
+ 
+ int
+-main()
++main(int argc, char** argv)
+ {
+ 	return 0;
+ }
+@@ -1859,7 +1859,7 @@ then
+ #endif
+ 
+ int
+-main()
++main(int argc, char** argv)
+ {
+ 	return 0;
+ }
+-- 
+2.39.2
+
+From 1f551737e838723f9ad9be1692bb12a9a3b4cdd9 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Thu, 23 Feb 2023 18:15:50 -0500
+Subject: [PATCH 2/2] libvbr/vbr.c: modernize vbr_strlcpy() signature.
+
+The vbr_strlcpy() function declares that its arguments should live in
+registers:
+
+  vbr_strlcpy(dst, src, size)
+        register char *dst;
+        register const char *src;
+        ssize_t size;
+  {
+    ...
+
+This makes GCC unhappy when -Werror=strict-prototypes is used:
+
+  vbr.c:167:1: error: function declaration isn't a prototype
+  [-Werror=strict-prototypes]
+    167 | vbr_strlcpy(dst, src, size)
+
+The "register" keyword is largely obsolete on modern systems anyway,
+since the compiler is better at determining how to move memory around
+than the programmer is. So to appease GCC and simplify the code a bit,
+the signature has been changed to,
+
+  vbr_strlcpy(char *dst, const char *src, ssize_t size) { ... }
+
+changes. Lines starting # with '#' will be ignored, and an empty
+message aborts the commit.  # # On branch configure.ac-c-standard #
+Your branch is up to date with 'origin/configure.ac-c-standard'.  # #
+Changes to be committed: # modified: libvbr/vbr.c # # Changes not
+staged for commit: # modified: configure # # Untracked files: #
+0000-cover-letter.patch #
+---
+ libvbr/vbr.c | 7 ++-----
+ 1 file changed, 2 insertions(+), 5 deletions(-)
+
+diff --git a/libvbr/vbr.c b/libvbr/vbr.c
+index cb9124d7..c6a2439f 100644
+--- a/libvbr/vbr.c
++++ b/libvbr/vbr.c
+@@ -164,12 +164,9 @@ static void vbr_error __P((VBR *, const char *, ...));
+ */
+ 
+ size_t
+-vbr_strlcpy(dst, src, size)
+-	register char *dst;
+-	register const char *src;
+-	ssize_t size;
++vbr_strlcpy(char *dst, const char *src, ssize_t size)
+ {
+-	register ssize_t i;
++	ssize_t i;
+ 
+ 	if (size-- <= 0)
+ 		return strlen(src);
+-- 
+2.39.2
+

diff --git a/mail-filter/opendkim/files/opendkim-2.10.3-snprintf-include.patch b/mail-filter/opendkim/files/opendkim-2.10.3-snprintf-include.patch
new file mode 100644
index 000000000000..5cbe24b02cdb
--- /dev/null
+++ b/mail-filter/opendkim/files/opendkim-2.10.3-snprintf-include.patch
@@ -0,0 +1,27 @@
+From 706554992156dd655e893268f201bbecbe283eb5 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Thu, 23 Feb 2023 17:05:36 -0500
+Subject: [PATCH 1/1] libopendkim/util.c: include stdio.h for snprintf.
+
+This fixes a build failure on musl, reported at
+
+  https://bugs.gentoo.org/896048
+---
+ libopendkim/util.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/libopendkim/util.c b/libopendkim/util.c
+index 6792b169..b1c6a769 100644
+--- a/libopendkim/util.c
++++ b/libopendkim/util.c
+@@ -17,6 +17,7 @@
+ # include <stdbool.h>
+ #endif /* HAVE_STDBOOL_H */
+ #include <ctype.h>
++#include <stdio.h>
+ #include <assert.h>
+ #include <string.h>
+ #include <errno.h>
+-- 
+2.39.2
+

diff --git a/mail-filter/opendkim/opendkim-2.10.3-r30.ebuild b/mail-filter/opendkim/opendkim-2.10.3-r30.ebuild
index 9334c2a8071f..bb6117a78bb2 100644
--- a/mail-filter/opendkim/opendkim-2.10.3-r30.ebuild
+++ b/mail-filter/opendkim/opendkim-2.10.3-r30.ebuild
@@ -56,6 +56,8 @@ PATCHES=(
 	"${FILESDIR}/${P}-lua-pkgconfig-pt2.patch"
 	"${FILESDIR}/${P}-define-P-macro-in-libvbr.patch"
 	"${FILESDIR}/${P}-fix-libmilter-search.patch"
+	"${FILESDIR}/${P}-snprintf-include.patch"
+	"${FILESDIR}/${P}-c-std.patch"
 )
 
 pkg_setup() {


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-02-23 23:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-25 13:39 [gentoo-commits] repo/gentoo:master commit in: mail-filter/opendkim/, mail-filter/opendkim/files/ Craig Andrews
  -- strict thread matches above, loose matches on Subject: below --
2019-03-31 19:03 Michael Orlitzky
2019-04-24 12:46 Michael Orlitzky
2019-04-24 21:26 Michael Orlitzky
2019-07-23 23:04 Michael Orlitzky
2020-01-28 19:51 Michael Orlitzky
2020-12-09 15:05 Michael Orlitzky
2020-12-24 15:56 Michael Orlitzky
2023-02-23 23:36 Michael Orlitzky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox