From 538c7221784f3c8112b370ac2f24270a8038c437 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Tue, 6 Oct 2009 09:10:43 +0000 Subject: initial ebuild by me. Eray Aslan also requested this in bug #282488 (Portage version: 2.2_rc42/cvs/Linux x86_64) --- mail-filter/opendkim/ChangeLog | 14 ++ .../files/opendkim-1.1.0-autoconf-automake.patch | 143 ++++++++++++++++++++ .../files/opendkim-1.1.0-flockinclude.patch | 12 ++ .../files/opendkim-1.1.0-rep-querycache.patch | 20 +++ .../files/opendkim-1.1.0-vbr-booliscpp.patch | 11 ++ mail-filter/opendkim/files/opendkim.init | 51 ++++++++ mail-filter/opendkim/metadata.xml | 15 +++ mail-filter/opendkim/opendkim-1.1.0.ebuild | 144 +++++++++++++++++++++ 8 files changed, 410 insertions(+) create mode 100644 mail-filter/opendkim/ChangeLog create mode 100644 mail-filter/opendkim/files/opendkim-1.1.0-autoconf-automake.patch create mode 100644 mail-filter/opendkim/files/opendkim-1.1.0-flockinclude.patch create mode 100644 mail-filter/opendkim/files/opendkim-1.1.0-rep-querycache.patch create mode 100644 mail-filter/opendkim/files/opendkim-1.1.0-vbr-booliscpp.patch create mode 100644 mail-filter/opendkim/files/opendkim.init create mode 100644 mail-filter/opendkim/metadata.xml create mode 100644 mail-filter/opendkim/opendkim-1.1.0.ebuild (limited to 'mail-filter') diff --git a/mail-filter/opendkim/ChangeLog b/mail-filter/opendkim/ChangeLog new file mode 100644 index 000000000000..16c25a520430 --- /dev/null +++ b/mail-filter/opendkim/ChangeLog @@ -0,0 +1,14 @@ +# ChangeLog for mail-filter/opendkim +# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/mail-filter/opendkim/ChangeLog,v 1.1 2009/10/06 09:10:43 dragonheart Exp $ + +*opendkim-1.1.0 (06 Oct 2009) + + 06 Oct 2009; Daniel Black +opendkim-1.1.0.ebuild, + +files/opendkim-1.1.0-autoconf-automake.patch, + +files/opendkim-1.1.0-flockinclude.patch, + +files/opendkim-1.1.0-rep-querycache.patch, + +files/opendkim-1.1.0-vbr-booliscpp.patch, +files/opendkim.init, + +metadata.xml: + initial ebuild by me. Eray Aslan also requested this in bug #282488 + diff --git a/mail-filter/opendkim/files/opendkim-1.1.0-autoconf-automake.patch b/mail-filter/opendkim/files/opendkim-1.1.0-autoconf-automake.patch new file mode 100644 index 000000000000..b2ddd1f9634f --- /dev/null +++ b/mail-filter/opendkim/files/opendkim-1.1.0-autoconf-automake.patch @@ -0,0 +1,143 @@ +--- ./opendkim-1.1.0.orig/configure.ac 2009-09-16 08:29:38.000000000 +1000 ++++ ./opendkim-1.1.0/configure.ac 2009-10-06 18:21:08.000000000 +1100 +@@ -45,6 +45,11 @@ + + # Checks for library functions. + AC_CHECK_FUNCS([dup2 endpwent getcwd gethostname gettimeofday isascii memchr memmove memset regcomp select socket strcasecmp strchr strdup strerror strncasecmp strrchr strtol strtoul strtoull strlcpy strlcat]) ++# Checks for library functions. ++AC_FUNC_FORK ++AC_FUNC_MALLOC ++AC_FUNC_MKTIME ++AC_FUNC_REALLOC + + # Conditional stuff + AC_ARG_ENABLE(arlib, AS_HELP_STRING(--enable-arlib, enable provided asynchronous resolver library)) +--- ./opendkim-1.1.0.orig/opendkim/Makefile.am 2009-09-16 08:29:38.000000000 +1000 ++++ ./opendkim-1.1.0/opendkim/Makefile.am 2009-10-06 18:44:47.000000000 +1100 +@@ -7,10 +7,11 @@ + # this lists the binaries to produce, the (non-PHONY, binary) targets in + # the previous manual Makefile + sbin_PROGRAMS = opendkim-testkey opendkim-testadsp +-sbin_SCRIPTS = opendkim-genkey.sh ++dist_sbin_SCRIPTS = opendkim-genkey.sh + +-exampledir = $(datarootdir)/doc/@PACKAGE@ +-example_DATA = opendkim.conf.sample ++EXTRA_DIST = opendkim.conf.sample ++sampledir = $(docdir) ++sample_DATA = opendkim.conf.sample + + if BUILD_FILTER + sbin_PROGRAMS += opendkim +@@ -98,12 +99,8 @@ + sbin_PROGRAMS += opendkim-stats + opendkim_stats_SOURCES = opendkim-db.c opendkim-stats.c + opendkim_stats_CPPFLAGS = -DUSE_DB -I../libopendkim $(LIBCRYPTO_INCDIRS) $(LIBDB_INCDIRS) +-opendkim_stats_LDFLAGS = -L../libopendkim $(LIBCRYPTO_LIBDIRS) $(LIBUNBOUND_LIBDIRS) $(LIBDB_LIBDIRS) +-opendkim_stats_LDADD = ../libopendkim/libopendkim.la $(LIBUNBOUND_LIBS) $(LIBDB_LIBS) +-if USE_ARLIB +-opendkim_stats_LDFLAGS += -L../libar +-opendkim_stats_LDADD += -lar +-endif ++opendkim_stats_LDFLAGS = $(LIBCRYPTO_LIBDIRS) $(LIBUNBOUND_LIBDIRS) $(LIBDB_LIBDIRS) ++opendkim_stats_LDADD = ../libopendkim/libopendkim.la $(LIBDB_LIBS) + if DEBUG + opendkim_stats_CFLAGS = -g + endif +@@ -111,20 +108,11 @@ + + opendkim_testkey_SOURCES = opendkim-testkey.c + opendkim_testkey_CPPFLAGS = -I../libopendkim $(LIBCRYPTO_INCDIRS) +-opendkim_testkey_LDFLAGS = -L../libopendkim $(LIBCRYPTO_LIBDIRS) ++opendkim_testkey_LDFLAGS = $(LIBCRYPTO_LIBDIRS) + opendkim_testkey_LDADD = ../libopendkim/libopendkim.la + opendkim_testkey_CFLAGS = + if USE_ARLIB +-opendkim_testkey_LDFLAGS += -L../libar +-opendkim_testkey_LDADD += -lar +-endif +-if USE_DB_OPENDKIM +-opendkim_testkey_LDFLAGS += $(LIBDB_LIBDIRS) +-opendkim_testkey_LDADD += $(LIBDB_LIBS) +-endif +-if USE_UNBOUND +-opendkim_testkey_LDFLAGS += $(LIBUNBOUND_LIBDIRS) +-opendkim_testkey_LDADD += $(LIBUNBOUND_LIBS) ++opendkim_testkey_LDADD += ../libar/libar.la + endif + if DEBUG + opendkim_testkey_CFLAGS += -g +@@ -132,31 +120,21 @@ + + opendkim_testadsp_SOURCES = opendkim-testadsp.c + opendkim_testadsp_CPPFLAGS = -I../libopendkim $(LIBCRYPTO_INCDIRS) +-opendkim_testadsp_LDFLAGS = -L../libopendkim $(LIBCRYPTO_LIBDIRS) ++opendkim_testadsp_LDFLAGS = $(LIBCRYPTO_LIBDIRS) + opendkim_testadsp_LDADD = ../libopendkim/libopendkim.la + opendkim_testadsp_CFLAGS = + if USE_ARLIB +-opendkim_testadsp_LDFLAGS += -L../libar +-opendkim_testadsp_LDADD += -lar +-endif +-if USE_DB_OPENDKIM +-opendkim_testadsp_LDFLAGS += $(LIBDB_LIBDIRS) +-opendkim_testadsp_LDADD += $(LIBDB_LIBS) +-endif +-if USE_UNBOUND +-opendkim_testadsp_LDFLAGS += $(LIBUNBOUND_LIBDIRS) +-opendkim_testadsp_LDADD += $(LIBUNBOUND_LIBS) ++opendkim_testadsp_LDADD += ../libar/libar.la + endif + if DEBUG + opendkim_testadsp_CFLAGS += -g + endif + +-man_MANS = opendkim-genkey.8 opendkim-testadsp.8 opendkim-testkey.8 ++dist_man_MANS = opendkim-genkey.8 opendkim-testadsp.8 opendkim-testkey.8 + if BUILD_FILTER +-man_MANS += opendkim.conf.5 opendkim.8 ++dist_man_MANS += opendkim.conf.5 opendkim.8 + endif + if STATS +-man_MANS += opendkim-stats.8 ++dist_man_MANS += opendkim-stats.8 + endif + +-EXTRA_DIST = $(example_DATA) $(man_MANS) opendkim-stats.8 $(sbin_SCRIPTS) +--- ./opendkim-1.1.0.orig/libopendkim/Makefile.am 2009-09-11 08:08:39.000000000 +1000 ++++ ./opendkim-1.1.0/libopendkim/Makefile.am 2009-10-06 18:59:33.000000000 +1100 +@@ -10,8 +10,8 @@ + endif + libopendkimincludedir = $(includedir)/opendkim + libopendkiminclude_HEADERS = dkim.h +-libopendkim_ladir = $(datadir)/opendkim +-libopendkim_la_DATA = docs/dkim.html docs/dkim_alg_t.html docs/dkim_body.html \ ++docsdir = $(htmldir) ++docs_DATA = docs/dkim.html docs/dkim_alg_t.html docs/dkim_body.html \ + docs/dkim_canon_t.html docs/dkim_cbstat.html docs/dkim_chunk.html \ + docs/dkim_close.html docs/dkim_dnssec.html docs/dkim_eoh.html \ + docs/dkim_eom.html docs/dkim_flush_cache.html docs/dkim_free.html \ +@@ -77,7 +77,7 @@ + + if USE_ARLIB + libopendkim_la_CFLAGS += -DUSE_ARLIB -I../libar +-libopendkim_la_LIBADD += ../libar/libar.a ++libopendkim_la_LIBADD += ../libar/libar.la + endif + + if USE_DB_LIBOPENDKIM +--- ./opendkim-1.1.0.orig/libar/Makefile.am 2009-09-02 03:47:06.000000000 +1000 ++++ ./opendkim-1.1.0/libar/Makefile.am 2009-10-06 19:21:21.000000000 +1100 +@@ -1,8 +1,8 @@ + # $Id: opendkim-1.1.0-autoconf-automake.patch,v 1.1 2009/10/06 09:10:42 dragonheart Exp $ + +-lib_LIBRARIES = libar.a +-libar_a_SOURCES = ar.c ar-strl.c manual.c ar-strl.h ++lib_LTLIBRARIES = libar.la ++libar_la_SOURCES = ar.c ar-strl.c manual.c ar-strl.h ++libar_la_LIBADD = -lresolv + libarincludedir = $(includedir)/ar + libarinclude_HEADERS = ar.h manual.h +-man_MANS = ar.3 +-EXTRA_DIST = $(man_MANS) ++dist_man_MANS = ar.3 diff --git a/mail-filter/opendkim/files/opendkim-1.1.0-flockinclude.patch b/mail-filter/opendkim/files/opendkim-1.1.0-flockinclude.patch new file mode 100644 index 000000000000..f9bde1056a0d --- /dev/null +++ b/mail-filter/opendkim/files/opendkim-1.1.0-flockinclude.patch @@ -0,0 +1,12 @@ +--- opendkim-1.1.0.orig/opendkim/opendkim-db.c.orig 2009-10-06 14:57:17.000000000 +1100 ++++ opendkim-1.1.0/opendkim/opendkim-db.c 2009-10-06 15:01:42.000000000 +1100 +@@ -23,6 +23,9 @@ + #include + #include + ++/* flock function defination */ ++#include ++ + /* opendkim includes */ + #include "opendkim-db.h" + diff --git a/mail-filter/opendkim/files/opendkim-1.1.0-rep-querycache.patch b/mail-filter/opendkim/files/opendkim-1.1.0-rep-querycache.patch new file mode 100644 index 000000000000..7135f5547c47 --- /dev/null +++ b/mail-filter/opendkim/files/opendkim-1.1.0-rep-querycache.patch @@ -0,0 +1,20 @@ +--- ./opendkim-1.1.0/libopendkim/dkim-rep.c.orig 2009-10-06 19:11:04.000000000 +1100 ++++ ./opendkim-1.1.0/libopendkim/dkim-rep.c 2009-10-06 19:12:01.000000000 +1100 +@@ -37,6 +37,7 @@ + /* libopendkim includes */ + #include "dkim.h" + #include "dkim-types.h" ++#include "util.h" + + /* prototypes */ + extern void dkim_error __P((DKIM *, const char *, ...)); +@@ -177,6 +178,9 @@ + char query[DKIM_MAXHOSTNAMELEN + 1]; + char qname[DKIM_MAXHOSTNAMELEN + 1]; + char buf[BUFRSZ + 1]; ++#ifdef QUERY_CACHE ++ int ttl = 0; ++#endif /* QUERY_CACHE */ + + assert(dkim != NULL); + assert(user != NULL); diff --git a/mail-filter/opendkim/files/opendkim-1.1.0-vbr-booliscpp.patch b/mail-filter/opendkim/files/opendkim-1.1.0-vbr-booliscpp.patch new file mode 100644 index 000000000000..f740d7fa6158 --- /dev/null +++ b/mail-filter/opendkim/files/opendkim-1.1.0-vbr-booliscpp.patch @@ -0,0 +1,11 @@ +--- ./opendkim-1.1.0/libopendkim/vbr.c.orig 2009-10-06 19:16:19.000000000 +1100 ++++ ./opendkim-1.1.0/libopendkim/vbr.c 2009-10-06 19:16:30.000000000 +1100 +@@ -235,7 +235,7 @@ + ** TRUE iff ansbuf contains an IN TXT reply that could be deocde. + */ + +-static bool ++static int + vbr_txt_decode(u_char *ansbuf, size_t anslen, u_char *buf, size_t buflen) + { + int type; diff --git a/mail-filter/opendkim/files/opendkim.init b/mail-filter/opendkim/files/opendkim.init new file mode 100644 index 000000000000..ddf3d5548610 --- /dev/null +++ b/mail-filter/opendkim/files/opendkim.init @@ -0,0 +1,51 @@ +#!/sbin/runscript +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/mail-filter/opendkim/files/opendkim.init,v 1.1 2009/10/06 09:10:42 dragonheart Exp $ + +CONFFILE=/etc/opendkim/${SVCNAME}.conf +PIDFILE=/var/run/opendkim/${SVCNAME}.pid + +depend() { + use dns logger net +} + +check_cfg() { + + if [ ! -f "${CONFFILE}" ] ; then + eerror "Configuration file ${CONFFILE} is missing" + return 1 + fi + + if egrep -q '^[[:space:]]*Background[[:space:]]+no' "${CONFFILE}" ; then + eerror "${SVCNAME} service cannot run with Background key set to yes!" + return 1 + fi + + if egrep -q '^[[:space:]]*PidFile[[:space:]]' "${CONFFILE}"; then + eerror "Please remove PidFile key from your configuration file!" + eerror "${SVCNAME} is automatically configured to use ${PIDFILE} as pid file." + return 1 + fi +} + +start() { + check_cfg || return 1 + + # Remove stalled Unix socket if no other process is using it + local UNIX_SOCKET=$(sed -ne 's/^[[:space:]]*Socket[[:space:]]\+\(unix\|local\)://p' "${CONFFILE}") + if [ -S "${UNIX_SOCKET}" ] && ! fuser -s "${UNIX_SOCKET}"; then + rm "${UNIX_SOCKET}" + fi + + ebegin "Starting OpenDKIM" + start-stop-daemon --start --pidfile "${PIDFILE}" \ + --exec /usr/sbin/opendkim -- -x "${CONFFILE}" -P "${PIDFILE}" + eend $? +} + +stop() { + ebegin "Stopping OpenDKIM" + start-stop-daemon --stop --pidfile "${PIDFILE}" + eend $? +} diff --git a/mail-filter/opendkim/metadata.xml b/mail-filter/opendkim/metadata.xml new file mode 100644 index 000000000000..13dd9050dc16 --- /dev/null +++ b/mail-filter/opendkim/metadata.xml @@ -0,0 +1,15 @@ + + + +no-herd + + dragonheart@gentoo.org + Daniel Black + +A program implementing the Milter API that signs and verifies +using the DKIM standard. This is a fork of Sendmail's DKIM-milter + + Include features like stats, querycache, popauth and + bodylengthdb that include berkdb + + diff --git a/mail-filter/opendkim/opendkim-1.1.0.ebuild b/mail-filter/opendkim/opendkim-1.1.0.ebuild new file mode 100644 index 000000000000..626684be7bc4 --- /dev/null +++ b/mail-filter/opendkim/opendkim-1.1.0.ebuild @@ -0,0 +1,144 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/mail-filter/opendkim/opendkim-1.1.0.ebuild,v 1.1 2009/10/06 09:10:43 dragonheart Exp $ + +EAPI="2" + +inherit eutils autotools toolchain-funcs + +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" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="+db" + +# FUTURE: unbound (dnssec lib) - bug #223103 + +DEPEND="dev-libs/openssl + db? ( >=sys-libs/db-3.2 ) + || ( mail-filter/libmilter mail-mta/sendmail )" +RDEPEND="dev-libs/openssl" + +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() { + epatch "${FILESDIR}/${P}"-flockinclude.patch + epatch "${FILESDIR}/${P}"-autoconf-automake.patch + epatch "${FILESDIR}/${P}"-rep-querycache.patch + epatch "${FILESDIR}/${P}"-vbr-booliscpp.patch + eautoreconf + sed -i -e 's:/var/db/dkim:/etc/opendkim:g' \ + -e 's:/etc/mail:/etc/opendkim:g' \ + opendkim/opendkim.conf.sample +} + +src_configure() { + econf $(use_enable db bodylengthdb) \ + $(use_enable db popauth) \ + $(use_enable db querycache) \ + $(use_enable db stats) \ + --without-domainkeys \ + --enable-arlib \ + --enable-dkimreputation \ + --enable-dnsupgrade \ + --enable-multiplesigs \ + --enable-reportintervals \ + --enable-vbr +} + +src_install() { + emake DESTDIR="${D}" install + # file collision + rm "${D}"/usr/share/man/man3/ar.3 + + mv "${D}"/usr/share/doc/opendkim "${D}"/usr/share/doc/${PF} + newinitd "${FILESDIR}/opendkim.init" opendkim + dodir /etc/opendkim /var/run/opendkim /var/lib/opendkim + fowners milter:milter /var/run/opendkim /etc/opendkim /var/lib/opendkim + + # default configuration + if [ ! -f /etc/opendkim/opendkim.conf ]; then + grep ^[^#] "${S}"/opendkim/opendkim.conf.sample \ + > "${D}"/etc/opendkim/opendkim.conf + echo \# Socket local:/var/run/opendkim/opendkim.sock >> \ + "${D}"/etc/opendkim/opendkim.conf + echo UserID milter >> "${D}"/etc/opendkim/opendkim.conf + if use db; then + echo Statistics /var/lib/opendkim/stats.db >> \ + "${D}"/etc/opendkim/opendkim.conf + fi + fi +} + +pkg_postinst() { + elog "If you want to sign your mail messages, you will have to 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." +} + +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 + einfo "Select the size of private key:" + einfo " [1] 512 bits" + einfo " [2] 1024 bits" + while read -n 1 -s -p " Press 1 or 2 on the keyboard to select the key size " keysize ; do + [[ "${keysize}" == "1" || "${keysize}" == "2" ]] && echo && break + done + case ${keysize} in + 1) keysize=512 ;; + *) keysize=1024 ;; + esac + + # generate the private and public keys + opendkim-genkey.sh -b ${keysize} -D "${ROOT}"etc/opendkim/ \ + -s ${selector} && \ + 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 dkim-filter.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" + + # 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" + einfo + einfo "Also look at the ADSP http://tools.ietf.org/html/rfc5617" +} -- cgit v1.2.3-65-gdbad