| 1 |
eras |
1.1 |
# Copyright 1999-2012 Gentoo Foundation |
| 2 |
|
|
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
|
|
# $Header: /var/cvsroot/gentoo-x86/mail-filter/opendkim/opendkim-2.7.0.ebuild,v 1.1 2012/10/27 07:25:23 eras Exp $ |
| 4 |
|
|
|
| 5 |
|
|
EAPI=4 |
| 6 |
|
|
inherit eutils db-use autotools user |
| 7 |
|
|
|
| 8 |
|
|
# for betas |
| 9 |
|
|
#MY_P=${P/_b/.B} |
| 10 |
|
|
#S=${WORKDIR}/${PN}-2.0.0 |
| 11 |
|
|
#SRC_URI="mirror://sourceforge/opendkim/${MY_P}.tar.gz" |
| 12 |
|
|
|
| 13 |
|
|
DESCRIPTION="A milter-based application to provide DKIM signing and verification" |
| 14 |
|
|
HOMEPAGE="http://opendkim.org" |
| 15 |
|
|
SRC_URI="mirror://sourceforge/opendkim/${P}.tar.gz" |
| 16 |
|
|
|
| 17 |
|
|
LICENSE="Sendmail-Open-Source BSD" |
| 18 |
|
|
SLOT="0" |
| 19 |
|
|
KEYWORDS="~amd64 ~x86" |
| 20 |
|
|
IUSE="+berkdb gnutls ldap lua opendbx poll sasl +ssl static-libs unbound" |
| 21 |
|
|
|
| 22 |
|
|
DEPEND="|| ( mail-filter/libmilter mail-mta/sendmail ) |
| 23 |
|
|
ssl? ( >=dev-libs/openssl-0.9.8 ) |
| 24 |
|
|
berkdb? ( >=sys-libs/db-3.2 ) |
| 25 |
|
|
opendbx? ( >=dev-db/opendbx-1.4.0 ) |
| 26 |
|
|
lua? ( dev-lang/lua ) |
| 27 |
|
|
ldap? ( net-nds/openldap ) |
| 28 |
|
|
sasl? ( dev-libs/cyrus-sasl ) |
| 29 |
|
|
unbound? ( >=net-dns/unbound-1.4.1 net-dns/dnssec-root ) |
| 30 |
|
|
!unbound? ( net-libs/ldns ) |
| 31 |
|
|
gnutls? ( >=net-libs/gnutls-2.11.7 )" |
| 32 |
|
|
|
| 33 |
|
|
RDEPEND="${DEPEND} |
| 34 |
|
|
sys-process/psmisc" |
| 35 |
|
|
|
| 36 |
|
|
REQUIRED_USE="sasl? ( ldap )" |
| 37 |
|
|
|
| 38 |
|
|
pkg_setup() { |
| 39 |
|
|
enewgroup milter |
| 40 |
|
|
# mail-milter/spamass-milter creates milter user with this home directory |
| 41 |
|
|
# For consistency reasons, milter user must be created here with this home directory |
| 42 |
|
|
# even though this package doesn't need a home directory for this user (#280571) |
| 43 |
|
|
enewuser milter -1 -1 /var/lib/milter milter |
| 44 |
|
|
} |
| 45 |
|
|
|
| 46 |
|
|
src_prepare() { |
| 47 |
|
|
sed -i -e 's:/var/db/dkim:/etc/opendkim:g' \ |
| 48 |
|
|
-e 's:/var/db/opendkim:/var/lib/opendkim:g' \ |
| 49 |
|
|
-e 's:/etc/mail:/etc/opendkim:g' \ |
| 50 |
|
|
-e 's:mailnull:milter:g' \ |
| 51 |
|
|
-e 's:^#[[:space:]]*PidFile.*:PidFile /var/run/opendkim/opendkim.pid:' \ |
| 52 |
|
|
opendkim/opendkim.conf.sample opendkim/opendkim.conf.simple.in \ |
| 53 |
|
|
stats/opendkim-reportstats || die |
| 54 |
|
|
|
| 55 |
|
|
sed -i -e 's:dist_doc_DATA:dist_html_DATA:' libopendkim/docs/Makefile.am \ |
| 56 |
|
|
|| die |
| 57 |
|
|
|
| 58 |
|
|
# don't go over the sock length and fail |
| 59 |
|
|
sed -i -e '/^sock/s/t-sign-ss-macro-value-file.sock/t-s-s-m-v-f.sock/' \ |
| 60 |
|
|
opendkim/tests/t-sign-ss-macro-value-file.lua || die |
| 61 |
|
|
|
| 62 |
|
|
eautoreconf |
| 63 |
|
|
} |
| 64 |
|
|
|
| 65 |
|
|
src_configure() { |
| 66 |
|
|
local myconf |
| 67 |
|
|
if use berkdb ; then |
| 68 |
|
|
myconf=$(db_includedir) |
| 69 |
|
|
myconf="--with-db-incdir=${myconf#-I}" |
| 70 |
|
|
myconf+=" --enable-popauth" |
| 71 |
|
|
myconf+=" --enable-query_cache" |
| 72 |
|
|
myconf+=" --enable-stats" |
| 73 |
|
|
fi |
| 74 |
|
|
if use unbound; then |
| 75 |
|
|
myconf+=" --with-unbound" |
| 76 |
|
|
else |
| 77 |
|
|
myconf+=" --with-ldns" |
| 78 |
|
|
fi |
| 79 |
|
|
if use ldap; then |
| 80 |
|
|
myconf+=" $(use_with sasl)" |
| 81 |
|
|
fi |
| 82 |
|
|
econf \ |
| 83 |
|
|
$(use_with berkdb db) \ |
| 84 |
|
|
$(use_with opendbx odbx) \ |
| 85 |
|
|
$(use_with lua) \ |
| 86 |
|
|
$(use_enable lua rbl) \ |
| 87 |
|
|
$(use_with ldap openldap) \ |
| 88 |
|
|
$(use_enable poll) \ |
| 89 |
|
|
$(use_enable static-libs static) \ |
| 90 |
|
|
$(use_with gnutls) \ |
| 91 |
|
|
${myconf} \ |
| 92 |
|
|
--docdir=/usr/share/doc/${PF} \ |
| 93 |
|
|
--htmldir=/usr/share/doc/${PF}/html \ |
| 94 |
|
|
--enable-filter \ |
| 95 |
|
|
--enable-adsp_lists \ |
| 96 |
|
|
--enable-dkim_reputation \ |
| 97 |
|
|
--enable-identity_header \ |
| 98 |
|
|
--enable-rate_limit \ |
| 99 |
|
|
--enable-redirect \ |
| 100 |
|
|
--enable-resign \ |
| 101 |
|
|
--enable-replace_rules \ |
| 102 |
|
|
--enable-default_sender \ |
| 103 |
|
|
--enable-sender_macro \ |
| 104 |
|
|
--enable-vbr \ |
| 105 |
|
|
--disable-rpath \ |
| 106 |
|
|
--disable-live-testing |
| 107 |
|
|
} |
| 108 |
|
|
|
| 109 |
|
|
src_install() { |
| 110 |
|
|
emake DESTDIR="${D}" install |
| 111 |
|
|
|
| 112 |
|
|
dosbin stats/opendkim-reportstats |
| 113 |
|
|
newinitd "${FILESDIR}/opendkim.init.r2" opendkim |
| 114 |
|
|
dodir /etc/opendkim /var/lib/opendkim |
| 115 |
|
|
fowners milter:milter /var/lib/opendkim |
| 116 |
|
|
|
| 117 |
|
|
# default configuration |
| 118 |
|
|
if [ ! -f "${ROOT}"/etc/opendkim/opendkim.conf ]; then |
| 119 |
|
|
grep ^[^#] "${S}"/opendkim/opendkim.conf.simple \ |
| 120 |
|
|
> "${D}"/etc/opendkim/opendkim.conf |
| 121 |
|
|
if use unbound; then |
| 122 |
|
|
echo TrustedAnchorFile /etc/dnssec/root-anchors.txt >> "${D}"/etc/opendkim/opendkim.conf |
| 123 |
|
|
fi |
| 124 |
|
|
echo UserID milter >> "${D}"/etc/opendkim/opendkim.conf |
| 125 |
|
|
if use berkdb; then |
| 126 |
|
|
echo Statistics /var/lib/opendkim/stats.dat >> \ |
| 127 |
|
|
"${D}"/etc/opendkim/opendkim.conf |
| 128 |
|
|
fi |
| 129 |
|
|
fi |
| 130 |
|
|
|
| 131 |
|
|
use static-libs || find "${D}" -name "*.la" -delete |
| 132 |
|
|
} |
| 133 |
|
|
|
| 134 |
|
|
pkg_postinst() { |
| 135 |
|
|
elog "If you want to sign your mail messages and need some help" |
| 136 |
|
|
elog "please run:" |
| 137 |
|
|
elog " emerge --config ${CATEGORY}/${PN}" |
| 138 |
|
|
elog "It will help you create your key and give you hints on how" |
| 139 |
|
|
elog "to configure your DNS and MTA." |
| 140 |
|
|
|
| 141 |
|
|
ewarn "Make sure your MTA has r/w access to the socket file." |
| 142 |
|
|
ewarn "This can be done either by setting UMask to 002 and adding MTA's user" |
| 143 |
|
|
ewarn "to milter group or you can simply set UMask to 000." |
| 144 |
|
|
} |
| 145 |
|
|
|
| 146 |
|
|
pkg_config() { |
| 147 |
|
|
local selector keysize pubkey |
| 148 |
|
|
|
| 149 |
|
|
read -p "Enter the selector name (default ${HOSTNAME}): " selector |
| 150 |
|
|
[[ -n "${selector}" ]] || selector=${HOSTNAME} |
| 151 |
|
|
if [[ -z "${selector}" ]]; then |
| 152 |
|
|
eerror "Oddly enough, you don't have a HOSTNAME." |
| 153 |
|
|
return 1 |
| 154 |
|
|
fi |
| 155 |
|
|
if [[ -f "${ROOT}"etc/opendkim/${selector}.private ]]; then |
| 156 |
|
|
ewarn "The private key for this selector already exists." |
| 157 |
|
|
else |
| 158 |
|
|
keysize=1024 |
| 159 |
|
|
# generate the private and public keys |
| 160 |
|
|
opendkim-genkey -b ${keysize} -D "${ROOT}"etc/opendkim/ \ |
| 161 |
|
|
-s ${selector} -d '(your domain)' && \ |
| 162 |
|
|
chown milter:milter \ |
| 163 |
|
|
"${ROOT}"etc/opendkim/"${selector}".private || \ |
| 164 |
|
|
{ eerror "Failed to create private and public keys." ; return 1; } |
| 165 |
|
|
chmod go-r "${ROOT}"etc/opendkim/"${selector}".private |
| 166 |
|
|
fi |
| 167 |
|
|
|
| 168 |
|
|
# opendkim selector configuration |
| 169 |
|
|
echo |
| 170 |
|
|
einfo "Make sure you have the following settings in your /etc/opendkim/opendkim.conf:" |
| 171 |
|
|
einfo " Keyfile /etc/opendkim/${selector}.private" |
| 172 |
|
|
einfo " Selector ${selector}" |
| 173 |
|
|
|
| 174 |
|
|
# MTA configuration |
| 175 |
|
|
echo |
| 176 |
|
|
einfo "If you are using Postfix, add following lines to your main.cf:" |
| 177 |
|
|
einfo " smtpd_milters = unix:/var/run/opendkim/opendkim.sock" |
| 178 |
|
|
einfo " non_smtpd_milters = unix:/var/run/opendkim/opendkim.sock" |
| 179 |
|
|
einfo " and read http://www.postfix.org/MILTER_README.html" |
| 180 |
|
|
|
| 181 |
|
|
# DNS configuration |
| 182 |
|
|
einfo "After you configured your MTA, publish your key by adding this TXT record to your domain:" |
| 183 |
|
|
cat "${ROOT}"etc/opendkim/${selector}.txt |
| 184 |
|
|
einfo "t=y signifies you only test the DKIM on your domain. See following page for the complete list of tags:" |
| 185 |
|
|
einfo " http://www.dkim.org/specs/rfc4871-dkimbase.html#key-text" |
| 186 |
|
|
einfo |
| 187 |
|
|
einfo "Also look at the ADSP http://tools.ietf.org/html/rfc5617" |
| 188 |
|
|
} |