diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2020-12-14 13:26:14 +0000 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2020-12-14 13:26:14 +0000 |
commit | 6abbf81ef2f298e3221ff5e67a1f3c5f23958212 (patch) | |
tree | 25413d1cb3a0cbfe36029db32398c0f333609215 /mail-filter/opendkim | |
parent | 9c417bacd51da6d8b57fa9f37425161d30d4b95b (diff) |
gentoo resync : 14.12.2020
Diffstat (limited to 'mail-filter/opendkim')
-rw-r--r-- | mail-filter/opendkim/Manifest | 4 | ||||
-rw-r--r-- | mail-filter/opendkim/files/opendkim-2.10.3-fix-libmilter-search.patch | 223 | ||||
-rw-r--r-- | mail-filter/opendkim/opendkim-2.10.3-r19.ebuild (renamed from mail-filter/opendkim/opendkim-2.10.3-r18.ebuild) | 2 | ||||
-rw-r--r-- | mail-filter/opendkim/opendkim-2.10.3-r25.ebuild | 235 |
4 files changed, 463 insertions, 1 deletions
diff --git a/mail-filter/opendkim/Manifest b/mail-filter/opendkim/Manifest index d530ae537f7f..e1a014b6d606 100644 --- a/mail-filter/opendkim/Manifest +++ b/mail-filter/opendkim/Manifest @@ -1,8 +1,10 @@ AUX opendkim-2.10.3-define-P-macro-in-libvbr.patch 1111 BLAKE2B ef21e6609a80eadfc3c493b088df6afe368d0ed833d04e7cde922e643b434a7033c888e1b7158d1085152b128a60d95fae722885f15be08c63bed898e4924127 SHA512 6cf0cb4e54814f661f9869bfdfda0ab44c67f237475ebc69b18c670de9f356bb5375740dc8e0a922f25a3215ad5a884725629c92eac1dbf8251364725d77c105 +AUX opendkim-2.10.3-fix-libmilter-search.patch 7465 BLAKE2B 9b6de6dd084437dd9fb2d905ba3addd3d39150b0cc36d7d62f8f10390acb3adb584dd23f8ee5b87c2b322cee34580e16725ce86b5967f14067d7ccae070ce7d4 SHA512 f8c675abed82f2058403b80162f83e6f44f7cc7502e32228f3127d332d17fd664dbb91a27a93717bd45cac875f356d9c6af1807ceec46ffe1d73e1a603615219 AUX opendkim-2.10.3-lua-pkgconfig.patch 5688 BLAKE2B 57fd8b57d12af4d1351e8bfa2ad01a39e85a6f1e440e3754e497082f5f1098dfc8c31771b1f83ae59f1e53ef242af78093601b1348b62945deacf8afdc42fca0 SHA512 b9ee7e625d1a3f00dcda7e441a81749d773daa9cfad7f046dd03d775564f1c111648c883ef1dcc16a6b518239b6a66bee4ba59f59227d182fcf61b887594d1d7 AUX opendkim-2.10.3-openrc.patch 10203 BLAKE2B e825ae1258c82607eb6d10d5acc3246908868fd3d5703ba0044f93bdf51e5a95dbc39a1e3060855073d14c31da5cb3985afe81c526f592f56463bf698ce4c317 SHA512 34499044cb768d54c0c1653a62fb34c9815990d815c98ccfba22afc1ad9c837c6689ff17a3d1da1221d698c91ce9d77a1964d99055527dfd797f8d428e1db615 AUX opendkim-2.10.3-openssl-1.1.1.patch.r2 5966 BLAKE2B c0dcb757f1195e8a3fc055f5162b805bf5bb2fe7a6a7c24317cfc1f0ed05491803f2fefbc22e96409a339f9741cac5344044a1efadec1f3e3c87084b2c221ed6 SHA512 e532d0411bc6cf1f55bf2de1bad54dc29d19558b2c4ea27aa72f17738688d48f111c3662e88064169a78347144eae289b362bfa4849ab4d3b06ff97d439cce47 DIST opendkim-2.10.3.tar.gz 1210224 BLAKE2B affd4526568431fa1afee93a167c5569912c9344ea4e6eee3281a035bd0c76d2be5d2e8e144bbebabd681a73388a37ac56d9a2e4daf00af9baadad14ffb42265 SHA512 97923e533d072c07ae4d16a46cbed95ee799aa50f19468d8bc6d1dc534025a8616c3b4b68b5842bc899b509349a2c9a67312d574a726b048c0ea46dd4fcc45d8 EBUILD opendkim-2.10.3-r17.ebuild 7370 BLAKE2B 5d651b5389f07920d307d9c9895d1bfb320edff2d4ce6cb339b9f2f75e9b2073ffeb528b3bfa409d5eab87d7c04b99c48f61793598c7d0b88cea84c8281f1c3c SHA512 cbc2f5869b49a0981ba874b26ff386adcaddcbc15d227d56ad3baf7b6b6b31c33691bfe5552daa8354cef1db3ded88f9576647347bc047835170bd5c31f9dff9 -EBUILD opendkim-2.10.3-r18.ebuild 7470 BLAKE2B 29c3df2013d536dff7e22f42683d751dd53b1b084dcc6d1c2e39abf83b54a3bc2acb9c2a6793cb8fd17350fa47999437031a763a3b4dcb28270882132b06da8a SHA512 2060392ca44308bf02c58d3844e6295661b2ef1f164b06e5c7b633a37dd8cf6ff5378be9c620bc5040d35a6d73e68754dcc24ff8a4fb2b11b8c620532df9ad05 +EBUILD opendkim-2.10.3-r19.ebuild 7535 BLAKE2B 229490e546e0bdaeb805170904d51cb839731de789deb9e0159a339ca7087d05cbbe67fa1570b1795b0cbca4f89f7a0876cda1d66591d741698219e5670945f2 SHA512 f80317d6acb48c0a9c36ddc42a92c24c8bc05558014ff7f7d00a6049d84885d49e7954d84499cfd050d09d754d5ac17f7428c8bd41e7b58e28d493f5a3c497b0 +EBUILD opendkim-2.10.3-r25.ebuild 7632 BLAKE2B 61ec5b795f374b7fe884f9ef841605a05b4c67678c8a6f908aa94874837998dd7a42bbc773b76b280ed58d2a4851bcabcdee30498497854a8113efc1326d7830 SHA512 78dd8a2a723d5990e12c58ceb2ec45c87c2034019e0c57f6d614d38d653c3dc5667d45f0b6ddaf95ad5aa07355c9c3b269d8a3b366c880c54642eac137dc299d MISC metadata.xml 2185 BLAKE2B 0cfb33303e8edf764700664863e2dbf90a288e71cf1a078c33ebaac20b11e398e34ae8ca289732b24401ec1f4b192e2c922a86297632af9a039736c52e0ac143 SHA512 56753bc62e8fa16ad3df9e49c2877bbfa5ca8f2f617455c8b9757e50cdd2afe6b27d2d185edb3620d447e42277d755373eafb448da08262723cfb0b5863c3399 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 000000000000..5e03a9931cf5 --- /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 index 33852707c253..7b9bb903b797 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 \ diff --git a/mail-filter/opendkim/opendkim-2.10.3-r25.ebuild b/mail-filter/opendkim/opendkim-2.10.3-r25.ebuild new file mode 100644 index 000000000000..8ca7f3a8623d --- /dev/null +++ b/mail-filter/opendkim/opendkim-2.10.3-r25.ebuild @@ -0,0 +1,235 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +LUA_COMPAT=( lua5-1 lua5-2} ) + +inherit autotools db-use eutils systemd tmpfiles lua-single + +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 ~arm64 ~x86" +IUSE="berkdb ldap libressl lmdb lua memcached opendbx poll sasl selinux +ssl static-libs stats querycache test unbound" + +BDEPEND="acct-user/opendkim + test? ( ${LUA_DEPS} )" + +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? ( ${LUA_DEPS} ) + 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 ) + lua? ( ${LUA_REQUIRED_USE} ) + test? ( ${LUA_REQUIRED_USE} )" +RESTRICT="!test? ( test )" + +PATCHES=( + "${FILESDIR}/${P}-openrc.patch" + "${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() { + 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 \ + --with-milter \ + --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" +} |