Version bump, bug 531998, CVE-2014-8500, CVE-2014-8680
authorChristian Ruppert <idl0r@gentoo.org>
Tue, 9 Dec 2014 20:18:35 +0000 (20:18 +0000)
committerChristian Ruppert <idl0r@gentoo.org>
Tue, 9 Dec 2014 20:18:35 +0000 (20:18 +0000)
Package-Manager: portage-2.2.14/cvs/Linux x86_64
Manifest-Sign-Key: 0xB427ABC8

net-dns/bind/ChangeLog
net-dns/bind/Manifest
net-dns/bind/bind-9.10.1_p1.ebuild [new file with mode: 0644]

index f807d7cf2c48c452796aaae66523520f5845a2ec..2131b3607cc94b8e2fea24accee839c9db6f55e0 100644 (file)
@@ -1,6 +1,11 @@
 # ChangeLog for net-dns/bind
 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/ChangeLog,v 1.512 2014/11/28 13:27:06 pacho Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/ChangeLog,v 1.513 2014/12/09 20:18:26 idl0r Exp $
+
+*bind-9.10.1_p1 (09 Dec 2014)
+
+  09 Dec 2014; Christian Ruppert <idl0r@gentoo.org> +bind-9.10.1_p1.ebuild:
+  Version bump, bug 531998, CVE-2014-8500, CVE-2014-8680
 
   28 Nov 2014; Pacho Ramos <pacho@gentoo.org> bind-9.10.1.ebuild:
   Support python 3.4
index f281771bb27ade94ec638e01b8f9e615626d90cc..a6617f6ae249f9400998f0f0c1e761f33f58d9b9 100644 (file)
@@ -14,6 +14,7 @@ AUX named.confd-r7 1364 SHA256 3cf1ab72446cb9417de916e4cd732f2056fb74d2c6f03da67
 AUX named.init-r13 6083 SHA256 55024fe0e2b491b5cb490a9f575bad3096d446f20f8d52778d778fd26a415d52 SHA512 9d557b1b30989b21d9ae9c3f4e2a886f59de728cd5893a7538be3bc424bf17b249165ed939c87db02f0b760faf46a5503c5bf523386b84ddfe8128e76f79930b WHIRLPOOL 8566abd7dda75fd3be7f3cf21baec149ce280a78ea400709272e6ad419417c14f6b1bc859ae2809a44c24aab382d6e6d10323c8df430884d306243275c35d77d
 AUX named.service-r1 327 SHA256 5c57f181cbb153fe6beb9385c56b874ea56afc19cca105ea3c5cadf2138c349d SHA512 1d3dbf9d1de0c23c398a523b05c0fb266b6b699e54d232818b28205f697ca227acae9f2778d6f41309b117a6cd78eee170b745594b786b1c1571d5f66d6c3de4 WHIRLPOOL fbfbb8ec1bd7bf1796be0daa66ec0918b175f3953b0312c492a09097f4e7c9b60d303330f525c03d1aa7b0934c2bc134e90800afb7e40e06f77f865c8710dd66
 DIST bind-9.10.0-P2.tar.gz 8335644 SHA256 335722ed66ae2cc9ffb2249f47f5cf39c86ebddd0a8ae86ac8282fec17df1e2b SHA512 6595346d6571e3efb070f3edc2ce004906c3950f7ed07fa8e23695a5a4bd1654e7af56c03c4ca96e4e10900ecde9eaff8da74468dd5874798b97f5fb09cebcf1 WHIRLPOOL 749fbe32fc0f713b725e20b1aa502b2bc026b31a59a619551b59397c4a07c50ab6494d164269d3209d8be0535b221499d5f7c4bd33edcbe1a43ca7b733d397ea
+DIST bind-9.10.1-P1.tar.gz 8356463 SHA256 974343108d32f253a130383d0ba51290fb7bf372092f1451f264a9e3ac09898d SHA512 5fedff46d9cb0ff2544624c6d998f4f4bcd82152730e8e936c2611847fe443018b5c5c1dfb1dc49888dde5e3e30c3814f08369525612f0770575d54a3133ed48 WHIRLPOOL 6f39ff0e15676ed68f6d48d2ec5894b00de5192edbbbff94444f62dcf83e62a1e72019d575da97b6e6cde91b8918da78721c48510dbaad88095d4f2b3af375eb
 DIST bind-9.10.1.tar.gz 8353313 SHA256 5361eca2b8b6bc0b13904b0f964336a478dfbc165711547f6cc3f8752ac60181 SHA512 16b05e3dbda72b6f5b7436271dd9cadbe0da9207b65b5ecbb6abe7042436c1baf740fb04ecaeefcff5f14e9f4747150faf9251deac68437323f05e80631e8723 WHIRLPOOL dd5f18e950d5289b0df96694ee130e3bca0d788f7d5212144f096882195fec054753fac750c405d620d1730709bf5ec221b9d97056a32e666e092870c004394f
 DIST bind-9.9.5-P1-geoip-1.4.patch 60725 SHA256 a23e950c8d60a6ef10b5981c4472d7090f2421e588fdfd3872767c15ac80ffd0 SHA512 ce70996d176df5f135b030d17981a89a3d2523d37df6ea91cfeb1bd9f00704ca4678c2270ca5f05b727f3f30f5ad1dbfbffb674ec9669df275c1fb49f47a788f WHIRLPOOL 52e8abfa9a8b79fe5ce10381fc303ff373e083fe716ec2e6b8a1c5e625a2169a7b8e6aafed56fb37698cd3338276af5ef47a23f8555d19659054d3b521245eb7
 DIST bind-9.9.5-P1.tar.gz 7730150 SHA256 a41f7813f3a6eb0dcae961651ec93896fd82074929bc6c1d8c90b04a2417b850 SHA512 214e94704cfa5c58c71285f4838888233651d789ff31dafdd581369c2b317c0bdb007de96bf13f08a0ce17fb03b5ac5810db847f19ce3a8c1c6a95868a8520bc WHIRLPOOL f045085611946127e4cfce04653550deb8421e4f3ec54e95672e8be1df9e653709b02da582da6684226132d11176aa394c2faa7b22898951b5f747faef5c5637
@@ -24,14 +25,19 @@ DIST bind-sdb-ldap-1.1.0-fc14.patch.bz2 9477 SHA256 fe043a573ba187dcc8b0f7313d44
 DIST dyndns-samples.tbz2 22866 SHA256 92fb06a92ca99cbbe96b90bcca229ef9c12397db57ae17e199dad9f1218fdbe8 SHA512 83b0bf99f8e9ff709e8e9336d8c5231b98a4b5f0c60c10792f34931e32cc638d261967dfa5a83151ec3740977d94ddd6e21e9ce91267b3e279b88affdbc18cac WHIRLPOOL 08d4e6a817f1d02597631e18152dbd55ea1bc4c82174be150cc77efc9e1f0f03b6471d1cefbe4229cd3161de752ef232a43ca274a07b78e9c974ceb04cfe99a2
 EBUILD bind-9.10.0_p2.ebuild 11861 SHA256 010668fad6368c2e76e642f961096586d640cd075248df459e81e83ca01d3301 SHA512 edf818f86ff7a3ca59b7d6acfdbefe0c14730392fa833cdb8184ebf1ce0c0d714ac65af28038ba0336d3d009f137be6e467da90be314e6a2f542aa0eb1436acc WHIRLPOOL 9d38ea3cd69da504f4496f56888d4903ca29794b6e7fa788386d9a16f92760731def71a267399371f33c45fbfdd89201fa4bcdf4b1f6f38e78724bf8610a5e88
 EBUILD bind-9.10.1.ebuild 11862 SHA256 607cc70874427835074dd34d9a3a92d08b6f2368d1953725855f13634ec995f5 SHA512 a6e314ecf4808c469f2d4de0e2c9eb6ab28f2f050c9fdfbd90783eb08dcb1d974bb95c4c3be482361b455c9213daad2966eaa93718b305e95d819e7ee3fa9874 WHIRLPOOL 3071c38cb5c0ff9df17b7e19ce9805ec1f7e1fea0e6603115944d619230f03ded37968938d77f3e7470a24d9d7e3c3ec0677a4f0841d6b5dc8b1c8714a6ad18c
+EBUILD bind-9.10.1_p1.ebuild 11865 SHA256 98ec2e17182bfdbcf8aa6a96515dfeffcd9d5edc408d29bbcaece0d1f97578ab SHA512 6e16a0afcbc4861f00253c2659786ace0b48baf946ed742749365d75bd4864386fa593ed70ea67604239c3167af8cd1f92ac376907af7ffdc70cbb732b1303b4 WHIRLPOOL 58bce3d3b0111cb7f842509d4882fb87a7d9aa26de2613ee5e2aac01093778410e3b6a7ffd36a70ceae7ba6d5918584f971cfa8684aa248fbe6a4adf5bcffe9c
 EBUILD bind-9.9.5-r3.ebuild 13834 SHA256 5f44c441c38bc0ab6952189aec266c208f6bde5fc983742624de36e561307eac SHA512 8b426a99d38a7e27b7d5d8390c625b5826e9ffeac979d2a68b1b15949a8c74fe77e0760d9346c17ae143a0e5016f5ae23873e1de9994795808f2384901f22d63 WHIRLPOOL 99fc9c6669aab31b364f0b836b431a8d76a52904deda4cee9a24494f826ff0f52c6f355e9a927e3c72f6de113fda883446cf880692bb6d48499fce5895fd7b7d
 EBUILD bind-9.9.5_p1.ebuild 12824 SHA256 9e66dd23f4e20adcc5f775f1eca6115c9d4113d6c92028dacc07c012362190ce SHA512 c1e021d6456dbb54e585d5038309f2057c3bf064f85bafd47f159af27bfced7e8796a72fd337226a42cf76e1c40ea0cff4f0e0481d87a4c38703747f1bdb3fa6 WHIRLPOOL 4feb43445cba51281effbabe0ea9d3c16e10e00e99b98944b3061cd622cfa5c9e5f269f8d2a8092dfa0c87fe8c00ab16f57437200e0ad5437155ed881126f024
-MISC ChangeLog 81553 SHA256 7fe17572986375808a037df165c333e876cd98af6e2afd0447b313b753871556 SHA512 cae6187255994a84663b2bfdfd95d8794e35255c55aff9e3fed3a585986a4a63055b330c8ef252cfcec591e1bfcf563168b45e7de264b94f921f3f78ea09390e WHIRLPOOL e4f22c6e734972a74b251fd474c7bade0a4a6c77c3cdb89957e83e60472fa7634241f5f53df8451f5fc34da1e9c6fb77ec5da7f53d43f67c7684a3d1059281cd
+MISC ChangeLog 81718 SHA256 77db793f8436de67d4f68bfe26c8676150271ac5515f963924e919899c179c11 SHA512 53b153b2dc062e05d541d36cde43ef085e0278c69de98afb11cd852a1d5826f3281f2c085515a04af79dc5d13b7b8978774d5286a8607b52b8396715ec2d0fbc WHIRLPOOL 8f29f582fe915e765728b68ca8e4d5b6cbf743a17e05d73cf52fbd673882c8bfc9992d5eadc192f146d07214c48f735f0c20fde6e682486b922da4c60d9411e6
 MISC metadata.xml 1091 SHA256 0cbbcee4db61f456c451c9fbc25566eb6fa1a3a98511e31311ff2ef14591d5ee SHA512 c7fcce7b0d1a9424780c19ba8cf891de57c41d5b0ea0ef5d4b44012a6ffc6bfb130912852dba9b1f72e7d31c08391007e3ac81258ab50ef28de83210786780ad WHIRLPOOL f46f4e8a9f897c9de5f9fefe838cf2c71ef8bbc57f3f712874400678b260fc19f7a3d2222d0f9948a3addae7b9e13cb5f625f46e81508f5f69171a7971de65c8
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
-iEYEAREIAAYFAlR4eCwACgkQCaWpQKGI+9QjhACdF41k2+PEq2ysDNe+eX+yNZR7
-exkAn2CUWCUURh7OXBXbRdqIHUjI8oWX
-=a4yt
+iQEcBAEBCAAGBQJUh1kbAAoJEMOx0zmdw4Z1h7sIAI8lKLGcM+84B7v9WeBmc8Wz
+jJ0sF1hfDKgnlNAKyty7onO7kF2AGgkmBQ/uDAZ2G8k/l2Sq3dlWJU4lxeQ1Mqp5
+ed4oRB2qsO4iA5Ruq/FM82Iok1eUtx/eb2Mvld0cb6k5qnjNxXBoyf47z2i5VADF
+VDYmJYKeB53n++NpNtqYfm6YzAek5JgicnnEgRH6bcw9gBckEeb/oACXgddpYd5s
+FTRzii/fvVHA+1ug0O1gigi3SHclr/bkneZJ0leeHU26FVM0Y8hsk9KPQur5MSRO
+GoiL3WmnstXW4lJ1LXs3OWSPWDurSSWQKxk/fbkFYlyqyzW5QHu0fHX5L8xetRY=
+=846J
 -----END PGP SIGNATURE-----
diff --git a/net-dns/bind/bind-9.10.1_p1.ebuild b/net-dns/bind/bind-9.10.1_p1.ebuild
new file mode 100644 (file)
index 0000000..3c02a98
--- /dev/null
@@ -0,0 +1,400 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/bind-9.10.1_p1.ebuild,v 1.1 2014/12/09 20:18:26 idl0r Exp $
+
+# Re dlz/mysql and threads, needs to be verified..
+# MySQL uses thread local storage in its C api. Thus MySQL
+# requires that each thread of an application execute a MySQL
+# thread initialization to setup the thread local storage.
+# This is impossible to do safely while staying within the DLZ
+# driver API. This is a limitation caused by MySQL, and not the DLZ API.
+# Because of this BIND MUST only run with a single thread when
+# using the MySQL driver.
+
+EAPI="5"
+
+PYTHON_COMPAT=( python2_7 python3_2 python3_3 python3_4 )
+
+inherit python-r1 eutils autotools toolchain-funcs flag-o-matic multilib db-use user systemd
+
+MY_PV="${PV/_p/-P}"
+MY_PV="${MY_PV/_rc/rc}"
+MY_P="${PN}-${MY_PV}"
+
+SDB_LDAP_VER="1.1.0-fc14"
+
+RRL_PV="${MY_PV}"
+
+NSLINT_DIR="contrib/nslint-3.0a2/"
+
+# SDB-LDAP: http://bind9-ldap.bayour.com/
+
+DESCRIPTION="BIND - Berkeley Internet Name Domain - Name Server"
+HOMEPAGE="http://www.isc.org/software/bind"
+SRC_URI="ftp://ftp.isc.org/isc/bind9/${MY_PV}/${MY_P}.tar.gz
+       doc? ( mirror://gentoo/dyndns-samples.tbz2 )"
+#      sdb-ldap? (
+#              http://ftp.disconnected-by-peer.at/pub/bind-sdb-ldap-${SDB_LDAP_VER}.patch.bz2
+#      )"
+
+LICENSE="GPL-2 ISC BSD BSD-2 HPND JNIC openssl"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~s390 ~sh ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="berkdb caps dlz doc filter-aaaa fixed-rrset geoip gost gssapi idn ipv6
+ldap mysql nslint odbc postgres python rpz seccomp selinux ssl static-libs
++threads urandom xml"
+# sdb-ldap - patch broken
+# no PKCS11 currently as it requires OpenSSL to be patched, also see bug 409687
+
+REQUIRED_USE="postgres? ( dlz )
+       berkdb? ( dlz )
+       mysql? ( dlz !threads )
+       odbc? ( dlz )
+       ldap? ( dlz )
+       gost? ( ssl )
+       threads? ( caps )"
+# sdb-ldap? ( dlz )
+
+DEPEND="ssl? ( dev-libs/openssl:0[-bindist] )
+       mysql? ( >=virtual/mysql-4.0 )
+       odbc? ( >=dev-db/unixODBC-2.2.6 )
+       ldap? ( net-nds/openldap )
+       idn? ( net-dns/idnkit )
+       postgres? ( virtual/postgresql )
+       caps? ( >=sys-libs/libcap-2.1.0 )
+       xml? ( dev-libs/libxml2 )
+       geoip? ( >=dev-libs/geoip-1.4.6 )
+       gssapi? ( virtual/krb5 )
+       gost? ( >=dev-libs/openssl-1.0.0:0[-bindist] )
+       seccomp? ( sys-libs/libseccomp )"
+#      sdb-ldap? ( net-nds/openldap )
+
+RDEPEND="${DEPEND}
+       selinux? ( sec-policy/selinux-bind )
+       || ( sys-process/psmisc >=sys-freebsd/freebsd-ubin-9.0_rc sys-process/fuser-bsd )"
+
+S="${WORKDIR}/${MY_P}"
+
+# bug 479092, requires networking
+RESTRICT="test"
+
+pkg_setup() {
+       ebegin "Creating named group and user"
+       enewgroup named 40
+       enewuser named 40 -1 /etc/bind named
+       eend ${?}
+}
+
+src_prepare() {
+       # Adjusting PATHs in manpages
+       for i in bin/{named/named.8,check/named-checkconf.8,rndc/rndc.8} ; do
+               sed -i \
+                       -e 's:/etc/named.conf:/etc/bind/named.conf:g' \
+                       -e 's:/etc/rndc.conf:/etc/bind/rndc.conf:g' \
+                       -e 's:/etc/rndc.key:/etc/bind/rndc.key:g' \
+                       "${i}" || die "sed failed, ${i} doesn't exist"
+       done
+
+#      if use dlz; then
+#              # sdb-ldap patch as per  bug #160567
+#              # Upstream URL: http://bind9-ldap.bayour.com/
+#              # New patch take from bug 302735
+#              if use sdb-ldap; then
+#                      epatch "${WORKDIR}"/${PN}-sdb-ldap-${SDB_LDAP_VER}.patch
+#                      cp -fp contrib/sdb/ldap/ldapdb.[ch] bin/named/
+#                      cp -fp contrib/sdb/ldap/{ldap2zone.1,ldap2zone.c} bin/tools/
+#                      cp -fp contrib/sdb/ldap/{zone2ldap.1,zone2ldap.c} bin/tools/
+#              fi
+#      fi
+
+       # should be installed by bind-tools
+       sed -i -r -e "s:(nsupdate|dig|delv) ::g" bin/Makefile.in || die
+
+       # Disable tests for now, bug 406399
+       sed -i '/^SUBDIRS/s:tests::' bin/Makefile.in lib/Makefile.in || die
+
+       if use nslint; then
+               sed -i -e 's:/etc/named.conf:/etc/bind/named.conf:' ${NSLINT_DIR}/nslint.{c,8} || die
+       fi
+
+       # bug #220361
+       rm aclocal.m4
+       rm -rf libtool.m4/
+       eautoreconf
+}
+
+src_configure() {
+       local myconf=""
+
+       if use urandom; then
+               myconf="${myconf} --with-randomdev=/dev/urandom"
+       else
+               myconf="${myconf} --with-randomdev=/dev/random"
+       fi
+
+       use geoip && myconf="${myconf} --with-geoip"
+
+       # bug #158664
+#      gcc-specs-ssp && replace-flags -O[23s] -O
+
+       # To include db.h from proper path
+       use berkdb && append-flags "-I$(db_includedir)"
+
+       export BUILD_CC=$(tc-getBUILD_CC)
+       econf \
+               --sysconfdir=/etc/bind \
+               --localstatedir=/var \
+               --with-libtool \
+               --enable-full-report \
+               $(use_enable threads) \
+               $(use_with dlz dlopen) \
+               $(use_with dlz dlz-filesystem) \
+               $(use_with dlz dlz-stub) \
+               $(use_with postgres dlz-postgres) \
+               $(use_with mysql dlz-mysql) \
+               $(use_with berkdb dlz-bdb) \
+               $(use_with ldap dlz-ldap) \
+               $(use_with odbc dlz-odbc) \
+               $(use_with ssl openssl "${EPREFIX}"/usr) \
+               $(use_with ssl ecdsa) \
+               $(use_with idn) \
+               $(use_enable ipv6) \
+               $(use_with xml libxml2) \
+               $(use_with gssapi) \
+               $(use_enable rpz rpz-nsip) \
+               $(use_enable rpz rpz-nsdname) \
+               $(use_enable caps linux-caps) \
+               $(use_with gost) \
+               $(use_enable filter-aaaa) \
+               $(use_enable fixed-rrset) \
+               $(use_with python) \
+               $(use_enable seccomp) \
+               --without-readline \
+               ${myconf}
+
+       # $(use_enable static-libs static) \
+
+       # bug #151839
+       echo '#undef SO_BSDCOMPAT' >> config.h
+
+       if use nslint; then
+               cd $NSLINT_DIR
+               econf
+       fi
+}
+
+src_compile() {
+       emake
+
+       if use nslint; then
+               emake -C $NSLINT_DIR CCOPT="${CFLAGS}"
+       fi
+}
+
+src_install() {
+       emake DESTDIR="${D}" install
+
+       if use nslint; then
+               cd $NSLINT_DIR
+               dobin nslint
+               doman nslint.8
+               cd "${S}"
+       fi
+
+       dodoc CHANGES FAQ README
+
+       if use idn; then
+               dodoc contrib/idn/README.idnkit
+       fi
+
+       if use doc; then
+               dodoc doc/arm/Bv9ARM.pdf
+
+               docinto misc
+               dodoc doc/misc/*
+
+               # might a 'html' useflag make sense?
+               docinto html
+               dohtml -r doc/arm/*
+
+               docinto contrib
+               dodoc contrib/scripts/{nanny.pl,named-bootconf.sh}
+
+               # some handy-dandy dynamic dns examples
+               pushd "${D}"/usr/share/doc/${PF} 1>/dev/null
+               tar xf "${DISTDIR}"/dyndns-samples.tbz2 || die
+               popd 1>/dev/null
+       fi
+
+       insinto /etc/bind
+       newins "${FILESDIR}"/named.conf-r8 named.conf
+
+       # ftp://ftp.rs.internic.net/domain/named.cache:
+       insinto /var/bind
+       doins "${FILESDIR}"/named.cache
+
+       insinto /var/bind/pri
+       newins "${FILESDIR}"/localhost.zone-r3 localhost.zone
+
+       newinitd "${FILESDIR}"/named.init-r13 named
+       newconfd "${FILESDIR}"/named.confd-r7 named
+
+       if use gost; then
+               sed -i -e 's/^OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-0}$/OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-1}/' "${D}/etc/init.d/named" || die
+       else
+               sed -i -e 's/^OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-1}$/OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-0}/' "${D}/etc/init.d/named" || die
+       fi
+
+       newenvd "${FILESDIR}"/10bind.env 10bind
+
+       # Let's get rid of those tools and their manpages since they're provided by bind-tools
+       rm -f "${D}"/usr/share/man/man1/{dig,host,nslookup}.1*
+       rm -f "${D}"/usr/share/man/man8/{dnssec-keygen,nsupdate}.8*
+       rm -f "${D}"/usr/bin/{dig,host,nslookup,dnssec-keygen,nsupdate}
+       rm -f "${D}"/usr/sbin/{dig,host,nslookup,dnssec-keygen,nsupdate}
+
+       # bug 405251, library archives aren't properly handled by --enable/disable-static
+       if ! use static-libs; then
+               find "${D}" -type f -name '*.a' -delete || die
+       fi
+
+       # bug 405251
+       find "${D}" -type f -name '*.la' -delete || die
+
+       if use python; then
+               install_python_tools() {
+                       dosbin bin/python/dnssec-{checkds,coverage}
+               }
+               python_foreach_impl install_python_tools
+
+               python_replicate_script "${D}usr/sbin/dnssec-checkds"
+               python_replicate_script "${D}usr/sbin/dnssec-coverage"
+       fi
+
+       # bug 450406
+       dosym named.cache /var/bind/root.cache
+
+       dosym /var/bind/pri /etc/bind/pri
+       dosym /var/bind/sec /etc/bind/sec
+       dosym /var/bind/dyn /etc/bind/dyn
+       keepdir /var/bind/{pri,sec,dyn}
+
+       dodir /var/log/named
+
+       fowners root:named /{etc,var}/bind /var/log/named /var/bind/{sec,pri,dyn}
+       fowners root:named /var/bind/named.cache /var/bind/pri/localhost.zone /etc/bind/{bind.keys,named.conf}
+       fperms 0640 /var/bind/named.cache /var/bind/pri/localhost.zone /etc/bind/{bind.keys,named.conf}
+       fperms 0750 /etc/bind /var/bind/pri
+       fperms 0770 /var/log/named /var/bind/{,sec,dyn}
+
+       systemd_newunit "${FILESDIR}/named.service-r1" named.service
+       exeinto /usr/libexec
+       doexe "${FILESDIR}/generate-rndc-key.sh"
+}
+
+pkg_postinst() {
+       if [ ! -f '/etc/bind/rndc.key' ]; then
+               if use urandom; then
+                       einfo "Using /dev/urandom for generating rndc.key"
+                       /usr/sbin/rndc-confgen -r /dev/urandom -a
+                       echo
+               else
+                       einfo "Using /dev/random for generating rndc.key"
+                       /usr/sbin/rndc-confgen -a
+                       echo
+               fi
+               chown root:named /etc/bind/rndc.key
+               chmod 0640 /etc/bind/rndc.key
+       fi
+
+       einfo
+       einfo "You can edit /etc/conf.d/named to customize named settings"
+       einfo
+       use mysql || use postgres || use ldap && {
+               elog "If your named depends on MySQL/PostgreSQL or LDAP,"
+               elog "uncomment the specified rc_named_* lines in your"
+               elog "/etc/conf.d/named config to ensure they'll start before bind"
+               einfo
+       }
+       einfo "If you'd like to run bind in a chroot AND this is a new"
+       einfo "install OR your bind doesn't already run in a chroot:"
+       einfo "1) Uncomment and set the CHROOT variable in /etc/conf.d/named."
+       einfo "2) Run \`emerge --config '=${CATEGORY}/${PF}'\`"
+       einfo
+
+       CHROOT=$(source /etc/conf.d/named 2>/dev/null; echo ${CHROOT})
+       if [[ -n ${CHROOT} ]]; then
+               elog "NOTE: As of net-dns/bind-9.4.3_p5-r1 the chroot part of the init-script got some major changes!"
+               elog "To enable the old behaviour (without using mount) uncomment the"
+               elog "CHROOT_NOMOUNT option in your /etc/conf.d/named config."
+               elog "If you decide to use the new/default method, ensure to make backup"
+               elog "first and merge your existing configs/zones to /etc/bind and"
+               elog "/var/bind because bind will now mount the needed directories into"
+               elog "the chroot dir."
+       fi
+}
+
+pkg_config() {
+       CHROOT=$(source /etc/conf.d/named; echo ${CHROOT})
+       CHROOT_NOMOUNT=$(source /etc/conf.d/named; echo ${CHROOT_NOMOUNT})
+       CHROOT_GEOIP=$(source /etc/conf.d/named; echo ${CHROOT_GEOIP})
+
+       if [[ -z "${CHROOT}" ]]; then
+               eerror "This config script is designed to automate setting up"
+               eerror "a chrooted bind/named. To do so, please first uncomment"
+               eerror "and set the CHROOT variable in '/etc/conf.d/named'."
+               die "Unset CHROOT"
+       fi
+       if [[ -d "${CHROOT}" ]]; then
+               ewarn "NOTE: As of net-dns/bind-9.4.3_p5-r1 the chroot part of the init-script got some major changes!"
+               ewarn "To enable the old behaviour (without using mount) uncomment the"
+               ewarn "CHROOT_NOMOUNT option in your /etc/conf.d/named config."
+               ewarn
+               ewarn "${CHROOT} already exists... some things might become overridden"
+               ewarn "press CTRL+C if you don't want to continue"
+               sleep 10
+       fi
+
+       echo; einfo "Setting up the chroot directory..."
+
+       mkdir -m 0750 -p ${CHROOT}
+       mkdir -m 0755 -p ${CHROOT}/{dev,etc,var/log,run}
+       mkdir -m 0750 -p ${CHROOT}/etc/bind
+       mkdir -m 0770 -p ${CHROOT}/var/{bind,log/named} ${CHROOT}/run/named/
+       # As of bind 9.8.0
+       if has_version net-dns/bind[gost]; then
+               if [ "$(get_libdir)" = "lib64" ]; then
+                       mkdir -m 0755 -p ${CHROOT}/usr/lib64/engines
+                       ln -s lib64 ${CHROOT}/usr/lib
+               else
+                       mkdir -m 0755 -p ${CHROOT}/usr/lib/engines
+               fi
+       fi
+       chown root:named ${CHROOT} ${CHROOT}/var/{bind,log/named} ${CHROOT}/run/named/ ${CHROOT}/etc/bind
+
+       mknod ${CHROOT}/dev/null c 1 3
+       chmod 0666 ${CHROOT}/dev/null
+
+       mknod ${CHROOT}/dev/zero c 1 5
+       chmod 0666 ${CHROOT}/dev/zero
+
+       if use urandom; then
+               mknod ${CHROOT}/dev/urandom c 1 9
+               chmod 0666 ${CHROOT}/dev/urandom
+       else
+               mknod ${CHROOT}/dev/random c 1 8
+               chmod 0666 ${CHROOT}/dev/random
+       fi
+
+       if [ "${CHROOT_NOMOUNT:-0}" -ne 0 ]; then
+               cp -a /etc/bind ${CHROOT}/etc/
+               cp -a /var/bind ${CHROOT}/var/
+       fi
+
+       if [ "${CHROOT_GEOIP:-0}" -eq 1 ]; then
+               mkdir -m 0755 -p ${CHROOT}/usr/share/GeoIP
+       fi
+
+       elog "You may need to add the following line to your syslog-ng.conf:"
+       elog "source jail { unix-stream(\"${CHROOT}/dev/log\"); };"
+}