Gentoo Archives: gentoo-commits

From: Christian Ruppert <idl0r@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-dns/bind/
Date: Tue, 09 May 2017 07:25:18
Message-Id: 1494314705.17fae22e4b853988b929ce84739899ef8605c593.idl0r@gentoo
1 commit: 17fae22e4b853988b929ce84739899ef8605c593
2 Author: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
3 AuthorDate: Tue May 9 07:20:22 2017 +0000
4 Commit: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
5 CommitDate: Tue May 9 07:25:05 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=17fae22e
7
8 net-dns/bind: Version bumps, re bug 615420 - CVE-2017-3136, CVE-2017-3137, CVE-2017-3138
9
10 Package-Manager: Portage-2.3.5, Repoman-2.3.2
11
12 net-dns/bind/Manifest | 2 +
13 net-dns/bind/bind-9.10.5.ebuild | 415 ++++++++++++++++++++++++++++++++++++
14 net-dns/bind/bind-9.11.0_p5.ebuild | 423 +++++++++++++++++++++++++++++++++++++
15 3 files changed, 840 insertions(+)
16
17 diff --git a/net-dns/bind/Manifest b/net-dns/bind/Manifest
18 index d50e5a2d616..6611c858871 100644
19 --- a/net-dns/bind/Manifest
20 +++ b/net-dns/bind/Manifest
21 @@ -1,4 +1,6 @@
22 DIST bind-9.10.4-P4.tar.gz 9299638 SHA256 a41ce7518e1d0faa40312cc89f4ca42246906b2718099d992e87a5d3ce9a9d86 SHA512 a662053f2052eb2d7ea61b4ecbd4e92980c808080598f7c4590c746e8e5d6545a9f965a8aeece57ce92b17545844cf8565719f697eaef6e2ade8106d810d2799 WHIRLPOOL 31b8e7b7a7c35d9894d91d2caf7428935f28c319c0af5176aaa8bfabac38882c658fa45f5548387295502013b2cba2de624279531d9b79f4c120b4da62c46b1b
23 +DIST bind-9.10.5.tar.gz 9431916 SHA256 71688d2e134e42205075eef93cc1b78b42a140a2d61bf8263afc9c92fc872b0e SHA512 4050cffeecf5d4d2f34f202a7c4459671f882feaf4901d7d0be257e6beba36bcfe3e4d9428fd44c3e44141d368bd2a8380e1c517c322bc683e4b9563e340497f WHIRLPOOL 489178be5f88b7e36628aa2a17ff1992f0fd1e7aab0e9679d2607280e8de1509435346669d35f87189fab8be73d3ff6e3da5f2a0041d88549ee640fbdd3ab8a4
24 DIST bind-9.11.0-P2.tar.gz 9677204 SHA256 d651f83ce1c08c83d6ac8201685c4f2b5fdb79794f3a4f93c3948e0ef439c1e5 SHA512 19ba809814d42afdbd7cab291b006ac23d08a4aabfcbed101bc269a68597e70f2f89e1da27b719ceb4c94741702df2b95b2d8fce46b2a33a65ff242d5a3b298d WHIRLPOOL c79adae68a970e43100b6ed3a446dd872ffcf7ce8439bd86e721bf9555f309d0004efb0c9b577d17a7cde59a143e034f86287f544abb2596457d3e55f0f6632b
25 DIST bind-9.11.0-P3.tar.gz 9691935 SHA256 0feee0374bcbdee73a9d4277f3c5007622279572d520d7c27a4b64015d8ca9e9 SHA512 fd5818ea36d7d4aa754a69ced675485cdb80b82f871b3f175c24715c0bd57fc78d4566657996f86ab32cb4158a974e97bb941ff9920cc3718b3484c161164b45 WHIRLPOOL 34db478ddd0841f8be244835c1d4b4149b4bda37707d56f697c544e836000aba0b0fa33c12ba8b86ebf9ca358cf7706db546570fe6371d94f93dca277dae1069
26 +DIST bind-9.11.0-P5.tar.gz 9698446 SHA256 1e283f0567b484687dfd7b936e26c9af4f64043daf73cbd8f3eb1122c9fb71f5 SHA512 142407db35a7bba6e676f2b3dc726a3a6ece9df8a27722f108ec309e24c4614da097b6cd31675c4925e68ff147896bc0a16dd71aa74dd73753ba86a2dbd7d3bd WHIRLPOOL a2aba3a52ad3610891733a3c8d93c0f5b263f706e36178a6f642b18e607a665ad0b15bdf679b9a5d149e9262eb5f718e23a09e989b63a418ee8fdfcb7f435186
27 DIST dyndns-samples.tbz2 22866 SHA256 92fb06a92ca99cbbe96b90bcca229ef9c12397db57ae17e199dad9f1218fdbe8 SHA512 83b0bf99f8e9ff709e8e9336d8c5231b98a4b5f0c60c10792f34931e32cc638d261967dfa5a83151ec3740977d94ddd6e21e9ce91267b3e279b88affdbc18cac WHIRLPOOL 08d4e6a817f1d02597631e18152dbd55ea1bc4c82174be150cc77efc9e1f0f03b6471d1cefbe4229cd3161de752ef232a43ca274a07b78e9c974ceb04cfe99a2
28
29 diff --git a/net-dns/bind/bind-9.10.5.ebuild b/net-dns/bind/bind-9.10.5.ebuild
30 new file mode 100644
31 index 00000000000..92c79819e66
32 --- /dev/null
33 +++ b/net-dns/bind/bind-9.10.5.ebuild
34 @@ -0,0 +1,415 @@
35 +# Copyright 1999-2017 Gentoo Foundation
36 +# Distributed under the terms of the GNU General Public License v2
37 +
38 +# Re dlz/mysql and threads, needs to be verified..
39 +# MySQL uses thread local storage in its C api. Thus MySQL
40 +# requires that each thread of an application execute a MySQL
41 +# thread initialization to setup the thread local storage.
42 +# This is impossible to do safely while staying within the DLZ
43 +# driver API. This is a limitation caused by MySQL, and not the DLZ API.
44 +# Because of this BIND MUST only run with a single thread when
45 +# using the MySQL driver.
46 +
47 +EAPI="5"
48 +
49 +PYTHON_COMPAT=( python2_7 python3_4 )
50 +
51 +inherit python-r1 eutils autotools toolchain-funcs flag-o-matic multilib db-use user systemd
52 +
53 +MY_PV="${PV/_p/-P}"
54 +MY_PV="${MY_PV/_rc/rc}"
55 +MY_P="${PN}-${MY_PV}"
56 +
57 +SDB_LDAP_VER="1.1.0-fc14"
58 +
59 +RRL_PV="${MY_PV}"
60 +
61 +NSLINT_DIR="contrib/nslint-3.0a2/"
62 +
63 +# SDB-LDAP: http://bind9-ldap.bayour.com/
64 +
65 +DESCRIPTION="BIND - Berkeley Internet Name Domain - Name Server"
66 +HOMEPAGE="http://www.isc.org/software/bind"
67 +SRC_URI="ftp://ftp.isc.org/isc/bind9/${MY_PV}/${MY_P}.tar.gz
68 + doc? ( mirror://gentoo/dyndns-samples.tbz2 )"
69 +# sdb-ldap? (
70 +# http://ftp.disconnected-by-peer.at/pub/bind-sdb-ldap-${SDB_LDAP_VER}.patch.bz2
71 +# )"
72 +
73 +LICENSE="GPL-2 ISC BSD BSD-2 HPND JNIC openssl"
74 +SLOT="0"
75 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
76 +IUSE="berkdb +caps dlz doc fetchlimit filter-aaaa fixed-rrset geoip gost gssapi idn ipv6
77 +json ldap libressl mysql nslint odbc postgres python rpz seccomp selinux sit ssl static-libs
78 ++threads urandom xml"
79 +# sdb-ldap - patch broken
80 +# no PKCS11 currently as it requires OpenSSL to be patched, also see bug 409687
81 +
82 +REQUIRED_USE="postgres? ( dlz )
83 + berkdb? ( dlz )
84 + mysql? ( dlz !threads )
85 + odbc? ( dlz )
86 + ldap? ( dlz )
87 + gost? ( !libressl ssl )
88 + threads? ( caps )
89 + python? ( ${PYTHON_REQUIRED_USE} )"
90 +# sdb-ldap? ( dlz )
91 +
92 +DEPEND="
93 + ssl? (
94 + !libressl? ( dev-libs/openssl:0[-bindist] )
95 + libressl? ( dev-libs/libressl )
96 + )
97 + mysql? ( >=virtual/mysql-4.0 )
98 + odbc? ( >=dev-db/unixODBC-2.2.6 )
99 + ldap? ( net-nds/openldap )
100 + idn? ( net-dns/idnkit )
101 + postgres? ( dev-db/postgresql:= )
102 + caps? ( >=sys-libs/libcap-2.1.0 )
103 + xml? ( dev-libs/libxml2 )
104 + geoip? ( >=dev-libs/geoip-1.4.6 )
105 + gssapi? ( virtual/krb5 )
106 + gost? ( >=dev-libs/openssl-1.0.0:0[-bindist] )
107 + seccomp? ( sys-libs/libseccomp )
108 + json? ( dev-libs/json-c )
109 + python? ( ${PYTHON_DEPS} )"
110 +# sdb-ldap? ( net-nds/openldap )
111 +
112 +RDEPEND="${DEPEND}
113 + selinux? ( sec-policy/selinux-bind )
114 + || ( sys-process/psmisc >=sys-freebsd/freebsd-ubin-9.0_rc sys-process/fuser-bsd )"
115 +
116 +S="${WORKDIR}/${MY_P}"
117 +
118 +# bug 479092, requires networking
119 +RESTRICT="test"
120 +
121 +pkg_setup() {
122 + ebegin "Creating named group and user"
123 + enewgroup named 40
124 + enewuser named 40 -1 /etc/bind named
125 + eend ${?}
126 +}
127 +
128 +src_prepare() {
129 + # Adjusting PATHs in manpages
130 + for i in bin/{named/named.8,check/named-checkconf.8,rndc/rndc.8} ; do
131 + sed -i \
132 + -e 's:/etc/named.conf:/etc/bind/named.conf:g' \
133 + -e 's:/etc/rndc.conf:/etc/bind/rndc.conf:g' \
134 + -e 's:/etc/rndc.key:/etc/bind/rndc.key:g' \
135 + "${i}" || die "sed failed, ${i} doesn't exist"
136 + done
137 +
138 +# if use dlz; then
139 +# # sdb-ldap patch as per bug #160567
140 +# # Upstream URL: http://bind9-ldap.bayour.com/
141 +# # New patch take from bug 302735
142 +# if use sdb-ldap; then
143 +# epatch "${WORKDIR}"/${PN}-sdb-ldap-${SDB_LDAP_VER}.patch
144 +# cp -fp contrib/sdb/ldap/ldapdb.[ch] bin/named/
145 +# cp -fp contrib/sdb/ldap/{ldap2zone.1,ldap2zone.c} bin/tools/
146 +# cp -fp contrib/sdb/ldap/{zone2ldap.1,zone2ldap.c} bin/tools/
147 +# fi
148 +# fi
149 +
150 + # should be installed by bind-tools
151 + sed -i -r -e "s:(nsupdate|dig|delv) ::g" bin/Makefile.in || die
152 +
153 + # Disable tests for now, bug 406399
154 + sed -i '/^SUBDIRS/s:tests::' bin/Makefile.in lib/Makefile.in || die
155 +
156 + if use nslint; then
157 + sed -i -e 's:/etc/named.conf:/etc/bind/named.conf:' ${NSLINT_DIR}/nslint.{c,8} || die
158 + fi
159 +
160 + # bug #220361
161 + rm aclocal.m4
162 + rm -rf libtool.m4/
163 + eautoreconf
164 +}
165 +
166 +src_configure() {
167 + local myconf=""
168 +
169 + if use urandom; then
170 + myconf="${myconf} --with-randomdev=/dev/urandom"
171 + else
172 + myconf="${myconf} --with-randomdev=/dev/random"
173 + fi
174 +
175 + use geoip && myconf="${myconf} --with-geoip"
176 +
177 + # bug #158664
178 +# gcc-specs-ssp && replace-flags -O[23s] -O
179 +
180 + # To include db.h from proper path
181 + use berkdb && append-flags "-I$(db_includedir)"
182 +
183 + export BUILD_CC=$(tc-getBUILD_CC)
184 + econf \
185 + --sysconfdir=/etc/bind \
186 + --localstatedir=/var \
187 + --with-libtool \
188 + --enable-full-report \
189 + --without-readline \
190 + $(use_enable caps linux-caps) \
191 + $(use_enable fetchlimit) \
192 + $(use_enable filter-aaaa) \
193 + $(use_enable fixed-rrset) \
194 + $(use_enable ipv6) \
195 + $(use_enable rpz rpz-nsdname) \
196 + $(use_enable rpz rpz-nsip) \
197 + $(use_enable seccomp) \
198 + $(use_enable sit) \
199 + $(use_enable threads) \
200 + $(use_with berkdb dlz-bdb) \
201 + $(use_with dlz dlopen) \
202 + $(use_with dlz dlz-filesystem) \
203 + $(use_with dlz dlz-stub) \
204 + $(use_with gost) \
205 + $(use_with gssapi) \
206 + $(use_with idn) \
207 + $(use_with json libjson) \
208 + $(use_with ldap dlz-ldap) \
209 + $(use_with mysql dlz-mysql) \
210 + $(use_with odbc dlz-odbc) \
211 + $(use_with postgres dlz-postgres) \
212 + $(use_with python) \
213 + $(use_with ssl ecdsa) \
214 + $(use_with ssl openssl "${EPREFIX}"/usr) \
215 + $(use_with xml libxml2) \
216 + ${myconf}
217 +
218 + # $(use_enable static-libs static) \
219 +
220 + # bug #151839
221 + echo '#undef SO_BSDCOMPAT' >> config.h
222 +
223 + if use nslint; then
224 + cd $NSLINT_DIR
225 + econf
226 + fi
227 +}
228 +
229 +src_compile() {
230 + emake
231 +
232 + if use nslint; then
233 + emake -C $NSLINT_DIR CCOPT="${CFLAGS}"
234 + fi
235 +}
236 +
237 +src_install() {
238 + emake DESTDIR="${D}" install
239 +
240 + if use nslint; then
241 + cd $NSLINT_DIR
242 + dobin nslint
243 + doman nslint.8
244 + cd "${S}"
245 + fi
246 +
247 + dodoc CHANGES FAQ README
248 +
249 + if use idn; then
250 + dodoc contrib/idn/README.idnkit
251 + fi
252 +
253 + if use doc; then
254 + dodoc doc/arm/Bv9ARM.pdf
255 +
256 + docinto misc
257 + dodoc doc/misc/*
258 +
259 + # might a 'html' useflag make sense?
260 + docinto html
261 + dohtml -r doc/arm/*
262 +
263 + docinto contrib
264 + dodoc contrib/scripts/{nanny.pl,named-bootconf.sh}
265 +
266 + # some handy-dandy dynamic dns examples
267 + pushd "${D}"/usr/share/doc/${PF} 1>/dev/null
268 + tar xf "${DISTDIR}"/dyndns-samples.tbz2 || die
269 + popd 1>/dev/null
270 + fi
271 +
272 + insinto /etc/bind
273 + newins "${FILESDIR}"/named.conf-r8 named.conf
274 +
275 + # ftp://ftp.rs.internic.net/domain/named.cache:
276 + insinto /var/bind
277 + newins "${FILESDIR}"/named.cache-r3 named.cache
278 +
279 + insinto /var/bind/pri
280 + newins "${FILESDIR}"/localhost.zone-r3 localhost.zone
281 +
282 + newinitd "${FILESDIR}"/named.init-r13 named
283 + newconfd "${FILESDIR}"/named.confd-r7 named
284 +
285 + if use gost; then
286 + sed -i -e 's/^OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-0}$/OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-1}/' "${D}/etc/init.d/named" || die
287 + else
288 + sed -i -e 's/^OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-1}$/OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-0}/' "${D}/etc/init.d/named" || die
289 + fi
290 +
291 + newenvd "${FILESDIR}"/10bind.env 10bind
292 +
293 + # Let's get rid of those tools and their manpages since they're provided by bind-tools
294 + rm -f "${D}"/usr/share/man/man1/{dig,host,nslookup}.1*
295 + rm -f "${D}"/usr/share/man/man8/nsupdate.8*
296 + rm -f "${D}"/usr/bin/{dig,host,nslookup,nsupdate}
297 + rm -f "${D}"/usr/sbin/{dig,host,nslookup,nsupdate}
298 + for tool in dsfromkey importkey keyfromlabel keygen \
299 + revoke settime signzone verify; do
300 + rm -f "${D}"/usr/{,s}bin/dnssec-"${tool}"
301 + rm -f "${D}"/usr/share/man/man8/dnssec-"${tool}".8*
302 + done
303 +
304 + # bug 405251, library archives aren't properly handled by --enable/disable-static
305 + if ! use static-libs; then
306 + find "${D}" -type f -name '*.a' -delete || die
307 + fi
308 +
309 + # bug 405251
310 + find "${D}" -type f -name '*.la' -delete || die
311 +
312 + if use python; then
313 + install_python_tools() {
314 + dosbin bin/python/dnssec-{checkds,coverage}
315 + }
316 + python_foreach_impl install_python_tools
317 +
318 + python_replicate_script "${D}usr/sbin/dnssec-checkds"
319 + python_replicate_script "${D}usr/sbin/dnssec-coverage"
320 + fi
321 +
322 + # bug 450406
323 + dosym named.cache /var/bind/root.cache
324 +
325 + dosym /var/bind/pri /etc/bind/pri
326 + dosym /var/bind/sec /etc/bind/sec
327 + dosym /var/bind/dyn /etc/bind/dyn
328 + keepdir /var/bind/{pri,sec,dyn}
329 +
330 + dodir /var/log/named
331 +
332 + fowners root:named /{etc,var}/bind /var/log/named /var/bind/{sec,pri,dyn}
333 + fowners root:named /var/bind/named.cache /var/bind/pri/localhost.zone /etc/bind/{bind.keys,named.conf}
334 + fperms 0640 /var/bind/named.cache /var/bind/pri/localhost.zone /etc/bind/{bind.keys,named.conf}
335 + fperms 0750 /etc/bind /var/bind/pri
336 + fperms 0770 /var/log/named /var/bind/{,sec,dyn}
337 +
338 + systemd_newunit "${FILESDIR}/named.service-r1" named.service
339 + systemd_dotmpfilesd "${FILESDIR}"/named.conf
340 + exeinto /usr/libexec
341 + doexe "${FILESDIR}/generate-rndc-key.sh"
342 +}
343 +
344 +pkg_postinst() {
345 + if [ ! -f '/etc/bind/rndc.key' ]; then
346 + if use urandom; then
347 + einfo "Using /dev/urandom for generating rndc.key"
348 + /usr/sbin/rndc-confgen -r /dev/urandom -a
349 + echo
350 + else
351 + einfo "Using /dev/random for generating rndc.key"
352 + /usr/sbin/rndc-confgen -a
353 + echo
354 + fi
355 + chown root:named /etc/bind/rndc.key
356 + chmod 0640 /etc/bind/rndc.key
357 + fi
358 +
359 + einfo
360 + einfo "You can edit /etc/conf.d/named to customize named settings"
361 + einfo
362 + use mysql || use postgres || use ldap && {
363 + elog "If your named depends on MySQL/PostgreSQL or LDAP,"
364 + elog "uncomment the specified rc_named_* lines in your"
365 + elog "/etc/conf.d/named config to ensure they'll start before bind"
366 + einfo
367 + }
368 + einfo "If you'd like to run bind in a chroot AND this is a new"
369 + einfo "install OR your bind doesn't already run in a chroot:"
370 + einfo "1) Uncomment and set the CHROOT variable in /etc/conf.d/named."
371 + einfo "2) Run \`emerge --config '=${CATEGORY}/${PF}'\`"
372 + einfo
373 +
374 + CHROOT=$(source /etc/conf.d/named 2>/dev/null; echo ${CHROOT})
375 + if [[ -n ${CHROOT} ]]; then
376 + elog "NOTE: As of net-dns/bind-9.4.3_p5-r1 the chroot part of the init-script got some major changes!"
377 + elog "To enable the old behaviour (without using mount) uncomment the"
378 + elog "CHROOT_NOMOUNT option in your /etc/conf.d/named config."
379 + elog "If you decide to use the new/default method, ensure to make backup"
380 + elog "first and merge your existing configs/zones to /etc/bind and"
381 + elog "/var/bind because bind will now mount the needed directories into"
382 + elog "the chroot dir."
383 + fi
384 +}
385 +
386 +pkg_config() {
387 + CHROOT=$(source /etc/conf.d/named; echo ${CHROOT})
388 + CHROOT_NOMOUNT=$(source /etc/conf.d/named; echo ${CHROOT_NOMOUNT})
389 + CHROOT_GEOIP=$(source /etc/conf.d/named; echo ${CHROOT_GEOIP})
390 +
391 + if [[ -z "${CHROOT}" ]]; then
392 + eerror "This config script is designed to automate setting up"
393 + eerror "a chrooted bind/named. To do so, please first uncomment"
394 + eerror "and set the CHROOT variable in '/etc/conf.d/named'."
395 + die "Unset CHROOT"
396 + fi
397 + if [[ -d "${CHROOT}" ]]; then
398 + ewarn "NOTE: As of net-dns/bind-9.4.3_p5-r1 the chroot part of the init-script got some major changes!"
399 + ewarn "To enable the old behaviour (without using mount) uncomment the"
400 + ewarn "CHROOT_NOMOUNT option in your /etc/conf.d/named config."
401 + ewarn
402 + ewarn "${CHROOT} already exists... some things might become overridden"
403 + ewarn "press CTRL+C if you don't want to continue"
404 + sleep 10
405 + fi
406 +
407 + echo; einfo "Setting up the chroot directory..."
408 +
409 + mkdir -m 0750 -p ${CHROOT}
410 + mkdir -m 0755 -p ${CHROOT}/{dev,etc,var/log,run}
411 + mkdir -m 0750 -p ${CHROOT}/etc/bind
412 + mkdir -m 0770 -p ${CHROOT}/var/{bind,log/named} ${CHROOT}/run/named/
413 + # As of bind 9.8.0
414 + if has_version net-dns/bind[gost]; then
415 + if [ "$(get_libdir)" = "lib64" ]; then
416 + mkdir -m 0755 -p ${CHROOT}/usr/lib64/engines
417 + ln -s lib64 ${CHROOT}/usr/lib
418 + else
419 + mkdir -m 0755 -p ${CHROOT}/usr/lib/engines
420 + fi
421 + fi
422 + chown root:named ${CHROOT} ${CHROOT}/var/{bind,log/named} ${CHROOT}/run/named/ ${CHROOT}/etc/bind
423 +
424 + mknod ${CHROOT}/dev/null c 1 3
425 + chmod 0666 ${CHROOT}/dev/null
426 +
427 + mknod ${CHROOT}/dev/zero c 1 5
428 + chmod 0666 ${CHROOT}/dev/zero
429 +
430 + if use urandom; then
431 + mknod ${CHROOT}/dev/urandom c 1 9
432 + chmod 0666 ${CHROOT}/dev/urandom
433 + else
434 + mknod ${CHROOT}/dev/random c 1 8
435 + chmod 0666 ${CHROOT}/dev/random
436 + fi
437 +
438 + if [ "${CHROOT_NOMOUNT:-0}" -ne 0 ]; then
439 + cp -a /etc/bind ${CHROOT}/etc/
440 + cp -a /var/bind ${CHROOT}/var/
441 + fi
442 +
443 + if [ "${CHROOT_GEOIP:-0}" -eq 1 ]; then
444 + mkdir -m 0755 -p ${CHROOT}/usr/share/GeoIP
445 + fi
446 +
447 + elog "You may need to add the following line to your syslog-ng.conf:"
448 + elog "source jail { unix-stream(\"${CHROOT}/dev/log\"); };"
449 +}
450
451 diff --git a/net-dns/bind/bind-9.11.0_p5.ebuild b/net-dns/bind/bind-9.11.0_p5.ebuild
452 new file mode 100644
453 index 00000000000..e3163682f19
454 --- /dev/null
455 +++ b/net-dns/bind/bind-9.11.0_p5.ebuild
456 @@ -0,0 +1,423 @@
457 +# Copyright 1999-2017 Gentoo Foundation
458 +# Distributed under the terms of the GNU General Public License v2
459 +
460 +# Re dlz/mysql and threads, needs to be verified..
461 +# MySQL uses thread local storage in its C api. Thus MySQL
462 +# requires that each thread of an application execute a MySQL
463 +# thread initialization to setup the thread local storage.
464 +# This is impossible to do safely while staying within the DLZ
465 +# driver API. This is a limitation caused by MySQL, and not the DLZ API.
466 +# Because of this BIND MUST only run with a single thread when
467 +# using the MySQL driver.
468 +
469 +EAPI="5"
470 +
471 +PYTHON_COMPAT=( python2_7 python3_4 )
472 +
473 +inherit python-r1 eutils autotools toolchain-funcs flag-o-matic multilib db-use user systemd
474 +
475 +MY_PV="${PV/_p/-P}"
476 +MY_PV="${MY_PV/_rc/rc}"
477 +MY_P="${PN}-${MY_PV}"
478 +
479 +SDB_LDAP_VER="1.1.0-fc14"
480 +
481 +RRL_PV="${MY_PV}"
482 +
483 +NSLINT_DIR="contrib/nslint-3.0a2/"
484 +
485 +# SDB-LDAP: http://bind9-ldap.bayour.com/
486 +
487 +DESCRIPTION="BIND - Berkeley Internet Name Domain - Name Server"
488 +HOMEPAGE="http://www.isc.org/software/bind"
489 +SRC_URI="ftp://ftp.isc.org/isc/bind9/${MY_PV}/${MY_P}.tar.gz
490 + doc? ( mirror://gentoo/dyndns-samples.tbz2 )"
491 +# sdb-ldap? (
492 +# http://ftp.disconnected-by-peer.at/pub/bind-sdb-ldap-${SDB_LDAP_VER}.patch.bz2
493 +# )"
494 +
495 +LICENSE="Apache-2.0 BSD BSD-2 GPL-2 HPND ISC MPL-2.0"
496 +SLOT="0"
497 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
498 +# -berkdb by default re bug 602682
499 +IUSE="-berkdb +caps dlz dnstap doc filter-aaaa fixed-rrset geoip gost gssapi idn ipv6
500 +json ldap libressl lmdb mysql nslint odbc postgres python rpz seccomp selinux ssl static-libs
501 ++threads urandom xml +zlib"
502 +# sdb-ldap - patch broken
503 +# no PKCS11 currently as it requires OpenSSL to be patched, also see bug 409687
504 +
505 +REQUIRED_USE="postgres? ( dlz )
506 + berkdb? ( dlz )
507 + mysql? ( dlz !threads )
508 + odbc? ( dlz )
509 + ldap? ( dlz )
510 + gost? ( !libressl ssl )
511 + threads? ( caps )
512 + dnstap? ( threads )
513 + python? ( ${PYTHON_REQUIRED_USE} )"
514 +# sdb-ldap? ( dlz )
515 +
516 +DEPEND="
517 + ssl? (
518 + !libressl? ( dev-libs/openssl:0[-bindist] )
519 + libressl? ( dev-libs/libressl )
520 + )
521 + mysql? ( >=virtual/mysql-4.0 )
522 + odbc? ( >=dev-db/unixODBC-2.2.6 )
523 + ldap? ( net-nds/openldap )
524 + idn? ( net-dns/idnkit )
525 + postgres? ( dev-db/postgresql:= )
526 + caps? ( >=sys-libs/libcap-2.1.0 )
527 + xml? ( dev-libs/libxml2 )
528 + geoip? ( >=dev-libs/geoip-1.4.6 )
529 + gssapi? ( virtual/krb5 )
530 + gost? ( >=dev-libs/openssl-1.0.0:0[-bindist] )
531 + seccomp? ( sys-libs/libseccomp )
532 + json? ( dev-libs/json-c )
533 + lmdb? ( dev-db/lmdb )
534 + zlib? ( sys-libs/zlib )
535 + dnstap? ( dev-libs/fstrm dev-libs/protobuf-c )
536 + python? (
537 + ${PYTHON_DEPS}
538 + dev-python/ply[${PYTHON_USEDEP}]
539 + )"
540 +# sdb-ldap? ( net-nds/openldap )
541 +
542 +RDEPEND="${DEPEND}
543 + selinux? ( sec-policy/selinux-bind )
544 + || ( sys-process/psmisc >=sys-freebsd/freebsd-ubin-9.0_rc sys-process/fuser-bsd )"
545 +
546 +S="${WORKDIR}/${MY_P}"
547 +
548 +# bug 479092, requires networking
549 +RESTRICT="test"
550 +
551 +pkg_setup() {
552 + ebegin "Creating named group and user"
553 + enewgroup named 40
554 + enewuser named 40 -1 /etc/bind named
555 + eend ${?}
556 +}
557 +
558 +src_prepare() {
559 + # Adjusting PATHs in manpages
560 + for i in bin/{named/named.8,check/named-checkconf.8,rndc/rndc.8} ; do
561 + sed -i \
562 + -e 's:/etc/named.conf:/etc/bind/named.conf:g' \
563 + -e 's:/etc/rndc.conf:/etc/bind/rndc.conf:g' \
564 + -e 's:/etc/rndc.key:/etc/bind/rndc.key:g' \
565 + "${i}" || die "sed failed, ${i} doesn't exist"
566 + done
567 +
568 +# if use dlz; then
569 +# # sdb-ldap patch as per bug #160567
570 +# # Upstream URL: http://bind9-ldap.bayour.com/
571 +# # New patch take from bug 302735
572 +# if use sdb-ldap; then
573 +# epatch "${WORKDIR}"/${PN}-sdb-ldap-${SDB_LDAP_VER}.patch
574 +# cp -fp contrib/sdb/ldap/ldapdb.[ch] bin/named/
575 +# cp -fp contrib/sdb/ldap/{ldap2zone.1,ldap2zone.c} bin/tools/
576 +# cp -fp contrib/sdb/ldap/{zone2ldap.1,zone2ldap.c} bin/tools/
577 +# fi
578 +# fi
579 +
580 + # should be installed by bind-tools
581 + sed -i -r -e "s:(nsupdate|dig|delv) ::g" bin/Makefile.in || die
582 +
583 + # Disable tests for now, bug 406399
584 + sed -i '/^SUBDIRS/s:tests::' bin/Makefile.in lib/Makefile.in || die
585 +
586 + if use nslint; then
587 + sed -i -e 's:/etc/named.conf:/etc/bind/named.conf:' ${NSLINT_DIR}/nslint.{c,8} || die
588 + fi
589 +
590 + # bug #220361
591 + rm aclocal.m4
592 + rm -rf libtool.m4/
593 + eautoreconf
594 +}
595 +
596 +src_configure() {
597 + local myconf=""
598 +
599 + if use urandom; then
600 + myconf="${myconf} --with-randomdev=/dev/urandom"
601 + else
602 + myconf="${myconf} --with-randomdev=/dev/random"
603 + fi
604 +
605 + use geoip && myconf="${myconf} --with-geoip"
606 +
607 + # bug #158664
608 +# gcc-specs-ssp && replace-flags -O[23s] -O
609 +
610 + # To include db.h from proper path
611 + use berkdb && append-flags "-I$(db_includedir)"
612 +
613 + export BUILD_CC=$(tc-getBUILD_CC)
614 + econf \
615 + --sysconfdir=/etc/bind \
616 + --localstatedir=/var \
617 + --with-libtool \
618 + --enable-full-report \
619 + --without-readline \
620 + $(use_enable caps linux-caps) \
621 + $(use_enable filter-aaaa) \
622 + $(use_enable fixed-rrset) \
623 + $(use_enable ipv6) \
624 + $(use_enable rpz rpz-nsdname) \
625 + $(use_enable rpz rpz-nsip) \
626 + $(use_enable seccomp) \
627 + $(use_enable threads) \
628 + $(use_with berkdb dlz-bdb) \
629 + $(use_with dlz dlopen) \
630 + $(use_with dlz dlz-filesystem) \
631 + $(use_with dlz dlz-stub) \
632 + $(use_with gost) \
633 + $(use_with gssapi) \
634 + $(use_with idn) \
635 + $(use_with json libjson) \
636 + $(use_with ldap dlz-ldap) \
637 + $(use_with mysql dlz-mysql) \
638 + $(use_with odbc dlz-odbc) \
639 + $(use_with postgres dlz-postgres) \
640 + $(use_with lmdb) \
641 + $(use_with python) \
642 + $(use_with ssl ecdsa) \
643 + $(use_with ssl openssl "${EPREFIX}"/usr) \
644 + $(use_with xml libxml2) \
645 + $(use_with zlib) \
646 + ${myconf}
647 +
648 + # $(use_enable static-libs static) \
649 +
650 + # bug #151839
651 + echo '#undef SO_BSDCOMPAT' >> config.h
652 +
653 + if use nslint; then
654 + cd $NSLINT_DIR
655 + econf
656 + fi
657 +}
658 +
659 +src_compile() {
660 + emake
661 +
662 + if use nslint; then
663 + emake -C $NSLINT_DIR CCOPT="${CFLAGS}"
664 + fi
665 +}
666 +
667 +src_install() {
668 + emake DESTDIR="${D}" install
669 +
670 + if use nslint; then
671 + cd $NSLINT_DIR
672 + dobin nslint
673 + doman nslint.8
674 + cd "${S}"
675 + fi
676 +
677 + dodoc CHANGES FAQ README
678 +
679 + if use idn; then
680 + dodoc contrib/idn/README.idnkit
681 + fi
682 +
683 + if use doc; then
684 + dodoc doc/arm/Bv9ARM.pdf
685 +
686 + docinto misc
687 + dodoc doc/misc/*
688 +
689 + # might a 'html' useflag make sense?
690 + docinto html
691 + dohtml -r doc/arm/*
692 +
693 + docinto contrib
694 + dodoc contrib/scripts/{nanny.pl,named-bootconf.sh}
695 +
696 + # some handy-dandy dynamic dns examples
697 + pushd "${D}"/usr/share/doc/${PF} 1>/dev/null
698 + tar xf "${DISTDIR}"/dyndns-samples.tbz2 || die
699 + popd 1>/dev/null
700 + fi
701 +
702 + insinto /etc/bind
703 + newins "${FILESDIR}"/named.conf-r8 named.conf
704 +
705 + # ftp://ftp.rs.internic.net/domain/named.cache:
706 + insinto /var/bind
707 + newins "${FILESDIR}"/named.cache-r3 named.cache
708 +
709 + insinto /var/bind/pri
710 + newins "${FILESDIR}"/localhost.zone-r3 localhost.zone
711 +
712 + newinitd "${FILESDIR}"/named.init-r13 named
713 + newconfd "${FILESDIR}"/named.confd-r7 named
714 +
715 + if use gost; then
716 + sed -i -e 's/^OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-0}$/OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-1}/' "${D}/etc/init.d/named" || die
717 + else
718 + sed -i -e 's/^OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-1}$/OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-0}/' "${D}/etc/init.d/named" || die
719 + fi
720 +
721 + newenvd "${FILESDIR}"/10bind.env 10bind
722 +
723 + # Let's get rid of those tools and their manpages since they're provided by bind-tools
724 + rm -f "${D}"/usr/share/man/man1/{dig,host,nslookup}.1*
725 + rm -f "${D}"/usr/share/man/man8/nsupdate.8*
726 + rm -f "${D}"/usr/bin/{dig,host,nslookup,nsupdate}
727 + rm -f "${D}"/usr/sbin/{dig,host,nslookup,nsupdate}
728 + for tool in dsfromkey importkey keyfromlabel keygen \
729 + revoke settime signzone verify; do
730 + rm -f "${D}"/usr/{,s}bin/dnssec-"${tool}"
731 + rm -f "${D}"/usr/share/man/man8/dnssec-"${tool}".8*
732 + done
733 +
734 + # bug 405251, library archives aren't properly handled by --enable/disable-static
735 + if ! use static-libs; then
736 + find "${D}" -type f -name '*.a' -delete || die
737 + fi
738 +
739 + # bug 405251
740 + find "${D}" -type f -name '*.la' -delete || die
741 +
742 + if use python; then
743 + install_python_tools() {
744 + dosbin bin/python/dnssec-{checkds,coverage}
745 + }
746 + python_foreach_impl install_python_tools
747 +
748 + python_replicate_script "${D}usr/sbin/dnssec-checkds"
749 + python_replicate_script "${D}usr/sbin/dnssec-coverage"
750 + fi
751 +
752 + # bug 450406
753 + dosym named.cache /var/bind/root.cache
754 +
755 + dosym /var/bind/pri /etc/bind/pri
756 + dosym /var/bind/sec /etc/bind/sec
757 + dosym /var/bind/dyn /etc/bind/dyn
758 + keepdir /var/bind/{pri,sec,dyn}
759 +
760 + dodir /var/log/named
761 +
762 + fowners root:named /{etc,var}/bind /var/log/named /var/bind/{sec,pri,dyn}
763 + fowners root:named /var/bind/named.cache /var/bind/pri/localhost.zone /etc/bind/{bind.keys,named.conf}
764 + fperms 0640 /var/bind/named.cache /var/bind/pri/localhost.zone /etc/bind/{bind.keys,named.conf}
765 + fperms 0750 /etc/bind /var/bind/pri
766 + fperms 0770 /var/log/named /var/bind/{,sec,dyn}
767 +
768 + systemd_newunit "${FILESDIR}/named.service-r1" named.service
769 + systemd_dotmpfilesd "${FILESDIR}"/named.conf
770 + exeinto /usr/libexec
771 + doexe "${FILESDIR}/generate-rndc-key.sh"
772 +}
773 +
774 +pkg_postinst() {
775 + if [ ! -f '/etc/bind/rndc.key' ]; then
776 + if use urandom; then
777 + einfo "Using /dev/urandom for generating rndc.key"
778 + /usr/sbin/rndc-confgen -r /dev/urandom -a
779 + echo
780 + else
781 + einfo "Using /dev/random for generating rndc.key"
782 + /usr/sbin/rndc-confgen -a
783 + echo
784 + fi
785 + chown root:named /etc/bind/rndc.key
786 + chmod 0640 /etc/bind/rndc.key
787 + fi
788 +
789 + einfo
790 + einfo "You can edit /etc/conf.d/named to customize named settings"
791 + einfo
792 + use mysql || use postgres || use ldap && {
793 + elog "If your named depends on MySQL/PostgreSQL or LDAP,"
794 + elog "uncomment the specified rc_named_* lines in your"
795 + elog "/etc/conf.d/named config to ensure they'll start before bind"
796 + einfo
797 + }
798 + einfo "If you'd like to run bind in a chroot AND this is a new"
799 + einfo "install OR your bind doesn't already run in a chroot:"
800 + einfo "1) Uncomment and set the CHROOT variable in /etc/conf.d/named."
801 + einfo "2) Run \`emerge --config '=${CATEGORY}/${PF}'\`"
802 + einfo
803 +
804 + CHROOT=$(source /etc/conf.d/named 2>/dev/null; echo ${CHROOT})
805 + if [[ -n ${CHROOT} ]]; then
806 + elog "NOTE: As of net-dns/bind-9.4.3_p5-r1 the chroot part of the init-script got some major changes!"
807 + elog "To enable the old behaviour (without using mount) uncomment the"
808 + elog "CHROOT_NOMOUNT option in your /etc/conf.d/named config."
809 + elog "If you decide to use the new/default method, ensure to make backup"
810 + elog "first and merge your existing configs/zones to /etc/bind and"
811 + elog "/var/bind because bind will now mount the needed directories into"
812 + elog "the chroot dir."
813 + fi
814 +}
815 +
816 +pkg_config() {
817 + CHROOT=$(source /etc/conf.d/named; echo ${CHROOT})
818 + CHROOT_NOMOUNT=$(source /etc/conf.d/named; echo ${CHROOT_NOMOUNT})
819 + CHROOT_GEOIP=$(source /etc/conf.d/named; echo ${CHROOT_GEOIP})
820 +
821 + if [[ -z "${CHROOT}" ]]; then
822 + eerror "This config script is designed to automate setting up"
823 + eerror "a chrooted bind/named. To do so, please first uncomment"
824 + eerror "and set the CHROOT variable in '/etc/conf.d/named'."
825 + die "Unset CHROOT"
826 + fi
827 + if [[ -d "${CHROOT}" ]]; then
828 + ewarn "NOTE: As of net-dns/bind-9.4.3_p5-r1 the chroot part of the init-script got some major changes!"
829 + ewarn "To enable the old behaviour (without using mount) uncomment the"
830 + ewarn "CHROOT_NOMOUNT option in your /etc/conf.d/named config."
831 + ewarn
832 + ewarn "${CHROOT} already exists... some things might become overridden"
833 + ewarn "press CTRL+C if you don't want to continue"
834 + sleep 10
835 + fi
836 +
837 + echo; einfo "Setting up the chroot directory..."
838 +
839 + mkdir -m 0750 -p ${CHROOT}
840 + mkdir -m 0755 -p ${CHROOT}/{dev,etc,var/log,run}
841 + mkdir -m 0750 -p ${CHROOT}/etc/bind
842 + mkdir -m 0770 -p ${CHROOT}/var/{bind,log/named} ${CHROOT}/run/named/
843 + # As of bind 9.8.0
844 + if has_version net-dns/bind[gost]; then
845 + if [ "$(get_libdir)" = "lib64" ]; then
846 + mkdir -m 0755 -p ${CHROOT}/usr/lib64/engines
847 + ln -s lib64 ${CHROOT}/usr/lib
848 + else
849 + mkdir -m 0755 -p ${CHROOT}/usr/lib/engines
850 + fi
851 + fi
852 + chown root:named ${CHROOT} ${CHROOT}/var/{bind,log/named} ${CHROOT}/run/named/ ${CHROOT}/etc/bind
853 +
854 + mknod ${CHROOT}/dev/null c 1 3
855 + chmod 0666 ${CHROOT}/dev/null
856 +
857 + mknod ${CHROOT}/dev/zero c 1 5
858 + chmod 0666 ${CHROOT}/dev/zero
859 +
860 + if use urandom; then
861 + mknod ${CHROOT}/dev/urandom c 1 9
862 + chmod 0666 ${CHROOT}/dev/urandom
863 + else
864 + mknod ${CHROOT}/dev/random c 1 8
865 + chmod 0666 ${CHROOT}/dev/random
866 + fi
867 +
868 + if [ "${CHROOT_NOMOUNT:-0}" -ne 0 ]; then
869 + cp -a /etc/bind ${CHROOT}/etc/
870 + cp -a /var/bind ${CHROOT}/var/
871 + fi
872 +
873 + if [ "${CHROOT_GEOIP:-0}" -eq 1 ]; then
874 + mkdir -m 0755 -p ${CHROOT}/usr/share/GeoIP
875 + fi
876 +
877 + elog "You may need to add the following line to your syslog-ng.conf:"
878 + elog "source jail { unix-stream(\"${CHROOT}/dev/log\"); };"
879 +}