From 171217a85eefea54a12de02af2bf684af0ff042e Mon Sep 17 00:00:00 2001 From: Lars Wendler Date: Fri, 28 Oct 2016 11:28:33 +0200 Subject: app-misc/ca-certificates: Make removal of untrusted certs optional. Package-Manager: portage-2.3.2 Signed-off-by: Lars Wendler --- .../ca-certificates-20160104.3.27.1-r1.ebuild | 179 -------------------- .../ca-certificates-20160104.3.27.1-r2.ebuild | 181 +++++++++++++++++++++ app-misc/ca-certificates/metadata.xml | 3 + 3 files changed, 184 insertions(+), 179 deletions(-) delete mode 100644 app-misc/ca-certificates/ca-certificates-20160104.3.27.1-r1.ebuild create mode 100644 app-misc/ca-certificates/ca-certificates-20160104.3.27.1-r2.ebuild (limited to 'app-misc/ca-certificates') diff --git a/app-misc/ca-certificates/ca-certificates-20160104.3.27.1-r1.ebuild b/app-misc/ca-certificates/ca-certificates-20160104.3.27.1-r1.ebuild deleted file mode 100644 index 93d3a8f0095e..000000000000 --- a/app-misc/ca-certificates/ca-certificates-20160104.3.27.1-r1.ebuild +++ /dev/null @@ -1,179 +0,0 @@ -# Copyright 1999-2016 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -# The Debian ca-certificates package merely takes the CA database as it exists -# in the nss package and repackages it for use by openssl. -# -# The issue with using the compiled debs directly is two fold: -# - they do not update frequently enough for us to rely on them -# - they pull the CA database from nss tip of tree rather than the release -# -# So we take the Debian source tools and combine them with the latest nss -# release to produce (largely) the same end result. The difference is that -# now we know our cert database is kept in sync with nss and, if need be, -# can be sync with nss tip of tree more frequently to respond to bugs. - -# When triaging bugs from users, here's some handy tips: -# - To see what cert is hitting errors, use openssl: -# openssl s_client -port 443 -CApath /etc/ssl/certs/ -host $HOSTNAME -# Focus on the errors written to stderr. -# -# - Look at the upstream log as to why certs were added/removed: -# https://hg.mozilla.org/projects/nss/log/tip/lib/ckfw/builtins/certdata.txt -# -# - If people want to add/remove certs, tell them to file w/mozilla: -# https://bugzilla.mozilla.org/enter_bug.cgi?product=NSS&component=CA%20Certificates&version=trunk - -EAPI="5" -PYTHON_COMPAT=( python{2_7,3_3,3_4,3_5} ) - -inherit eutils python-any-r1 - -if [[ ${PV} == *.* ]] ; then - # Compile from source ourselves. - PRECOMPILED=false - inherit versionator - - DEB_VER=$(get_version_component_range 1) - NSS_VER=$(get_version_component_range 2-) - RTM_NAME="NSS_${NSS_VER//./_}_RTM" -else - # Debian precompiled version. - PRECOMPILED=true - inherit unpacker -fi - -DESCRIPTION="Common CA Certificates PEM files" -HOMEPAGE="http://packages.debian.org/sid/ca-certificates" -NMU_PR="" -if ${PRECOMPILED} ; then - SRC_URI="mirror://debian/pool/main/c/${PN}/${PN}_${PV}${NMU_PR:++nmu}${NMU_PR}_all.deb" -else - SRC_URI="mirror://debian/pool/main/c/${PN}/${PN}_${DEB_VER}${NMU_PR:++nmu}${NMU_PR}.tar.xz - https://archive.mozilla.org/pub/security/nss/releases/${RTM_NAME}/src/nss-${NSS_VER}.tar.gz - cacert? ( https://dev.gentoo.org/~anarchy/patches/nss-3.14.1-add_spi+cacerts_ca_certs.patch )" -fi - -LICENSE="MPL-1.1" -SLOT="0" -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt" -IUSE="" -${PRECOMPILED} || IUSE+=" cacert" - -DEPEND="" -if ${PRECOMPILED} ; then - DEPEND+=" !/dev/null - epatch "${DISTDIR}"/nss-3.14.1-add_spi+cacerts_ca_certs.patch - popd >/dev/null - fi - fi - - epatch "${FILESDIR}"/${PN}-20150426-root.patch - local relp=$(echo "${EPREFIX}" | sed -e 's:[^/]\+:..:g') - sed -i \ - -e '/="$ROOT/s:ROOT:ROOT'"${EPREFIX}"':' \ - -e '/RELPATH="\.\./s:"$:'"${relp}"'":' \ - usr/sbin/update-ca-certificates || die -} - -src_compile() { - cd "image/${EPREFIX}" || die - if ! ${PRECOMPILED} ; then - python_setup - local d="${S}/${PN}/mozilla" c="usr/share/${PN}" - # Grab the database from the nss sources. - cp "${S}"/nss-${NSS_VER}/nss/lib/ckfw/builtins/{certdata.txt,nssckbi.h} "${d}" || die - emake -C "${d}" - - # Now move the files to the same places that the precompiled would. - mkdir -p etc/ssl/certs etc/ca-certificates/update.d "${c}"/mozilla - if use cacert ; then - mkdir -p "${c}"/cacert.org - mv "${d}"/CAcert_Inc..crt "${c}"/cacert.org/cacert.org_root.crt || die - fi - mv "${d}"/*.crt "${c}"/mozilla/ || die - else - mv usr/share/doc/{ca-certificates,${PF}} || die - fi - - # Remove untrusted certs from StartCom and WoSign (bug #598072) - rm "${c}"/mozilla/StartCom* || die - rm "${c}"/mozilla/WoSign* || die - - ( - echo "# Automatically generated by ${CATEGORY}/${PF}" - echo "# $(date -u)" - echo "# Do not edit." - cd "${c}" - find * -name '*.crt' | LC_ALL=C sort - ) > etc/ca-certificates.conf - - sh usr/sbin/update-ca-certificates --root "${S}/image" || die -} - -src_install() { - cp -pPR image/* "${D}"/ || die - if ! ${PRECOMPILED} ; then - cd ca-certificates - doman sbin/*.8 - dodoc debian/README.* examples/ca-certificates-local/README - fi - - echo 'CONFIG_PROTECT_MASK="/etc/ca-certificates.conf"' > 98ca-certificates - doenvd 98ca-certificates -} - -pkg_postinst() { - if [ -d "${EROOT}/usr/local/share/ca-certificates" ] ; then - # if the user has local certs, we need to rebuild again - # to include their stuff in the db. - # However it's too overzealous when the user has custom certs in place. - # --fresh is to clean up dangling symlinks - "${EROOT}"/usr/sbin/update-ca-certificates --root "${ROOT}" - fi - - if [ -n "$(find -L "${EROOT}"etc/ssl/certs/ -type l)" ] ; then - ewarn "Removing the following broken symlinks:" - ewarn "$(find -L "${EROOT}"/etc/ssl/certs/ -type l -printf '%p -> %l\n' -delete)" - fi -} diff --git a/app-misc/ca-certificates/ca-certificates-20160104.3.27.1-r2.ebuild b/app-misc/ca-certificates/ca-certificates-20160104.3.27.1-r2.ebuild new file mode 100644 index 000000000000..c1d332aec3c9 --- /dev/null +++ b/app-misc/ca-certificates/ca-certificates-20160104.3.27.1-r2.ebuild @@ -0,0 +1,181 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# The Debian ca-certificates package merely takes the CA database as it exists +# in the nss package and repackages it for use by openssl. +# +# The issue with using the compiled debs directly is two fold: +# - they do not update frequently enough for us to rely on them +# - they pull the CA database from nss tip of tree rather than the release +# +# So we take the Debian source tools and combine them with the latest nss +# release to produce (largely) the same end result. The difference is that +# now we know our cert database is kept in sync with nss and, if need be, +# can be sync with nss tip of tree more frequently to respond to bugs. + +# When triaging bugs from users, here's some handy tips: +# - To see what cert is hitting errors, use openssl: +# openssl s_client -port 443 -CApath /etc/ssl/certs/ -host $HOSTNAME +# Focus on the errors written to stderr. +# +# - Look at the upstream log as to why certs were added/removed: +# https://hg.mozilla.org/projects/nss/log/tip/lib/ckfw/builtins/certdata.txt +# +# - If people want to add/remove certs, tell them to file w/mozilla: +# https://bugzilla.mozilla.org/enter_bug.cgi?product=NSS&component=CA%20Certificates&version=trunk + +EAPI="5" +PYTHON_COMPAT=( python{2_7,3_3,3_4,3_5} ) + +inherit eutils python-any-r1 + +if [[ ${PV} == *.* ]] ; then + # Compile from source ourselves. + PRECOMPILED=false + inherit versionator + + DEB_VER=$(get_version_component_range 1) + NSS_VER=$(get_version_component_range 2-) + RTM_NAME="NSS_${NSS_VER//./_}_RTM" +else + # Debian precompiled version. + PRECOMPILED=true + inherit unpacker +fi + +DESCRIPTION="Common CA Certificates PEM files" +HOMEPAGE="http://packages.debian.org/sid/ca-certificates" +NMU_PR="" +if ${PRECOMPILED} ; then + SRC_URI="mirror://debian/pool/main/c/${PN}/${PN}_${PV}${NMU_PR:++nmu}${NMU_PR}_all.deb" +else + SRC_URI="mirror://debian/pool/main/c/${PN}/${PN}_${DEB_VER}${NMU_PR:++nmu}${NMU_PR}.tar.xz + https://archive.mozilla.org/pub/security/nss/releases/${RTM_NAME}/src/nss-${NSS_VER}.tar.gz + cacert? ( https://dev.gentoo.org/~anarchy/patches/nss-3.14.1-add_spi+cacerts_ca_certs.patch )" +fi + +LICENSE="MPL-1.1" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt" +IUSE="insecure_certs" +${PRECOMPILED} || IUSE+=" cacert" + +DEPEND="" +if ${PRECOMPILED} ; then + DEPEND+=" !/dev/null + epatch "${DISTDIR}"/nss-3.14.1-add_spi+cacerts_ca_certs.patch + popd >/dev/null + fi + fi + + epatch "${FILESDIR}"/${PN}-20150426-root.patch + local relp=$(echo "${EPREFIX}" | sed -e 's:[^/]\+:..:g') + sed -i \ + -e '/="$ROOT/s:ROOT:ROOT'"${EPREFIX}"':' \ + -e '/RELPATH="\.\./s:"$:'"${relp}"'":' \ + usr/sbin/update-ca-certificates || die +} + +src_compile() { + cd "image/${EPREFIX}" || die + if ! ${PRECOMPILED} ; then + python_setup + local d="${S}/${PN}/mozilla" c="usr/share/${PN}" + # Grab the database from the nss sources. + cp "${S}"/nss-${NSS_VER}/nss/lib/ckfw/builtins/{certdata.txt,nssckbi.h} "${d}" || die + emake -C "${d}" + + # Now move the files to the same places that the precompiled would. + mkdir -p etc/ssl/certs etc/ca-certificates/update.d "${c}"/mozilla + if use cacert ; then + mkdir -p "${c}"/cacert.org + mv "${d}"/CAcert_Inc..crt "${c}"/cacert.org/cacert.org_root.crt || die + fi + mv "${d}"/*.crt "${c}"/mozilla/ || die + else + mv usr/share/doc/{ca-certificates,${PF}} || die + fi + + if ! use insecure_certs ; then + # Remove untrusted certs from StartCom and WoSign (bug #598072) + rm "${c}"/mozilla/StartCom* || die + rm "${c}"/mozilla/WoSign* || die + fi + + ( + echo "# Automatically generated by ${CATEGORY}/${PF}" + echo "# $(date -u)" + echo "# Do not edit." + cd "${c}" + find * -name '*.crt' | LC_ALL=C sort + ) > etc/ca-certificates.conf + + sh usr/sbin/update-ca-certificates --root "${S}/image" || die +} + +src_install() { + cp -pPR image/* "${D}"/ || die + if ! ${PRECOMPILED} ; then + cd ca-certificates + doman sbin/*.8 + dodoc debian/README.* examples/ca-certificates-local/README + fi + + echo 'CONFIG_PROTECT_MASK="/etc/ca-certificates.conf"' > 98ca-certificates + doenvd 98ca-certificates +} + +pkg_postinst() { + if [ -d "${EROOT}/usr/local/share/ca-certificates" ] ; then + # if the user has local certs, we need to rebuild again + # to include their stuff in the db. + # However it's too overzealous when the user has custom certs in place. + # --fresh is to clean up dangling symlinks + "${EROOT}"/usr/sbin/update-ca-certificates --root "${ROOT}" + fi + + if [ -n "$(find -L "${EROOT}"etc/ssl/certs/ -type l)" ] ; then + ewarn "Removing the following broken symlinks:" + ewarn "$(find -L "${EROOT}"/etc/ssl/certs/ -type l -printf '%p -> %l\n' -delete)" + fi +} diff --git a/app-misc/ca-certificates/metadata.xml b/app-misc/ca-certificates/metadata.xml index f11c10f84792..f516f0769776 100644 --- a/app-misc/ca-certificates/metadata.xml +++ b/app-misc/ca-certificates/metadata.xml @@ -10,5 +10,8 @@ Include root certs from CAcert (http://www.cacert.org/) and Software in the Public Interest (http://www.spi-inc.org/) + + Install certs which are known to *not* being trustworthy. + -- cgit v1.2.3-65-gdbad