ca-certificates: Unify with mingw version

This commit is contained in:
Alexpux 2014-08-30 22:59:48 +04:00
parent 44589c10ac
commit 99cbe81c43
16 changed files with 518 additions and 30133 deletions

View File

@ -1,57 +1,38 @@
# Maintainer: Alexey Pavlov <alexpux@gmail.com>
pkgname=ca-certificates
pkgver=1.97
pkgver=20140325
pkgrel=1
pkgdesc='Common CA certificates'
arch=('any')
url='http://www.mozilla.org/projects/security/certs/'
license=('MPL' 'GPL')
source=(blacklist.txt
certdata.txt
nssckbi.h
trust-fixes
certdata2pem.py
update-ca-trust
update-ca-trust.8.txt
README.usr
README.etc
README.extr
README.java
README.openssl
README.pem
README.src)
source=("http://ftp.debian.org/debian/pool/main/c/${pkgname}/${pkgname}_${pkgver}.tar.xz"
'certdata2pem-redhat.patch'
'trust-fixes'
'update-ca-trust'
'update-ca-trust.8')
depends=('bash' 'openssl' 'findutils' 'coreutils' 'sed' 'p11-kit')
makedepends=('asciidoc' 'python2' 'libxslt' 'sed' 'grep')
install='ca-certificates.install'
sha256sums=('e18ee0638a626a992a56332e1fb3657f22f9dd074f2b60beea5fef4be9774672'
'37ee5e82b1d3358c68a50141f942303958ff182e05f1a1a24fe6756eb7b60a7e'
'ae450070c2bc5b24facf3f6c939ce8421bfa99e0f1580736a40d615ae17d6974'
sha256sums=('c0e3d8c517995db2737f7f1a9b69d654b8823fa6d337871c6ce111fcf083454a'
'87bab93ca70a8517d84ce4680d77c51108e37b69e9be0edc49c9872b36f9e47b'
'eeebba0de2635ba4115c05b2acc95d475d47aa58796bb0868203805212f50381'
'af13c30801a8a27623948206458432a4cf98061b75ff6e5b5e03912f93c034ee'
'75ef2f4b0fddd2ca3c69b234a6abb66fd732e4af96814b65dcedb0dd52018381'
'd31ac2bb5f1941aea0ac1e51861af7be224b6bb85820e30bb30793112aa785ba'
'0d2e90b6cf575678cd9d4f409d92258ef0d676995d4d733acdb2425309a38ff8'
'6c7b9287c41c171c64b358fc7331b8a9ae969fc2d00d997d88bcbf4da0de598a'
'146ff96c60a8ee32bbcf2da59d624d6ecfbab7ef7442529d46d8d63064d8ca58'
'7bb8781320fb3ff84e76c7e7e4a9c3813879c4f1943710a3b0140b31efacfd32'
'6c812d1ec8ce5bde2216cc42be33021d6345fbea05c14f50c52191a38c175ea9'
'c5825472162ab8459b9acc0bc7480866c1209ea0fef098f734938474df9c6586'
'86184318d451bec55d70c84e618cbfe10c8adb7dc893964ce4aaecff99d83433')
'a73c6430e734178b9aa4d303709470383bc2b1cfbeb0d44fe34615df812f479d')
prepare() {
mkdir -p $srcdir/$pkgname-$pkgver/
local file=
for file in ${source[@]}; do
cp -f ${file} $srcdir/$pkgname-$pkgver/
done
cd ${srcdir}/${pkgname}
cp ${srcdir}/trust-fixes mozilla/
cp ${srcdir}/update-ca-trust sbin/
cp ${srcdir}/update-ca-trust.8 sbin/
patch -p1 -i ${srcdir}/certdata2pem-redhat.patch
sed "s|/usr/bin/python|/usr/bin/python2|g" -i mozilla/certdata2pem.py
}
build() {
cd $srcdir/$pkgname-$pkgver/
python2 certdata2pem.py
cd ${srcdir}/${pkgname}/mozilla
/usr/bin/python2 certdata2pem.py
(
cat <<EOF
@ -64,9 +45,9 @@ build() {
#
# Generated from:
EOF
grep -w NSS_BUILTINS_LIBRARY_VERSION ${S}/nssckbi.h | awk '{print "# " $2 " " $3}';
grep -w NSS_BUILTINS_LIBRARY_VERSION nssckbi.h | awk '{print "# " $2 " " $3}';
echo '#';
) > ca-bundle.trust.crt
) > ${srcdir}/${pkgname}/ca-bundle.trust.crt
# Make sure repeat runs don't accumulate duplicate certs.
if [ -f ca-bundle.neutral-trust.crt ]; then
@ -105,61 +86,47 @@ EOF
if [ -n "$targs" ]
then
echo "trust flags $targs for $f" >> info.trust
openssl x509 -text -in "$f" -trustout $targs -setalias "$alias" >> ca-bundle.trust.crt
openssl x509 -text -in "$f" -trustout $targs -setalias "$alias" >> ${srcdir}/${pkgname}/ca-bundle.trust.crt
else
echo "no trust flags for $f" >> tee -a info.notrust
openssl x509 -text -in "$f" -setalias "$alias" >> ca-bundle.neutral-trust.crt
openssl x509 -text -in "$f" -setalias "$alias" >> ${srcdir}/${pkgname}/ca-bundle.neutral-trust.crt
fi
done
for p in *.p11-kit
do
cat $p >> ca-bundle.supplement.p11-kit
cat $p >> ${srcdir}/${pkgname}/ca-bundle.supplement.p11-kit
done
cat trust-fixes >> ca-bundle.supplement.p11-kit
asciidoc -v -d manpage -b docbook -o update-ca-trust.8.xml update-ca-trust.8.txt
xsltproc --nonet -o update-ca-trust.8 /etc/asciidoc/docbook-xsl/manpage.xsl update-ca-trust.8.xml
cat trust-fixes >> ${srcdir}/${pkgname}/ca-bundle.supplement.p11-kit
}
package() {
cd $srcdir/$pkgname-$pkgver/
cd ${srcdir}/${pkgname}
mkdir -p ${pkgdir}/usr/{bin,lib,share}
mkdir -p ${pkgdir}/etc
mkdir -p ${pkgdir}/usr/share/man/man8
cp -f update-ca-trust ${pkgdir}/usr/bin/
cp -f update-ca-trust.8 ${pkgdir}/usr/share/man/man8/
cp -f sbin/update-ca-trust ${pkgdir}/usr/bin/
cp -f sbin/update-ca-trust.8 ${pkgdir}/usr/share/man/man8/
# for p11-kit
mkdir -p ${pkgdir}/usr/lib/p11-kit
cp -f update-ca-trust ${pkgdir}/usr/lib/p11-kit/p11-kit-extract-trust
cp -f sbin/update-ca-trust ${pkgdir}/usr/lib/p11-kit/p11-kit-extract-trust
mkdir -p ${pkgdir}/usr/share/pki/ca-trust-source
for file in ca-bundle.{trust.crt,neutral-trust.crt,supplement.p11-kit}
do
cp -f $file ${pkgdir}/usr/share/pki/ca-trust-source
done
cp -f README.usr ${D}/usr/share/pki/ca-trust-source/README
# touch all files overwritten by update-ca-trust for easy cleanup
mkdir -p ${pkgdir}/etc/pki/ca-trust/{extracted,source}
mkdir -p ${pkgdir}/etc/pki/ca-trust/source/{anchors,blacklist}
mkdir -p ${pkgdir}/etc/pki/ca-trust/extracted/{openssl,pem,java}
cp -f README.extr ${pkgdir}/etc/pki/ca-trust/extracted/README
cp -f README.openssl ${pkgdir}/etc/pki/ca-trust/extracted/openssl/README
touch ${pkgdir}/etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt
cp -f README.pem ${pkgdir}/etc/pki/ca-trust/extracted/pem/README
touch ${pkgdir}/etc/pki/ca-trust/extracted/pem/{tls,email,objsign}-ca-bundle.pem
cp -f README.java ${pkgdir}/etc/pki/ca-trust/extracted/java/README
touch ${pkgdir}/etc/pki/ca-trust/extracted/java/cacerts
cp -f README.src ${pkgdir}/etc/pki/ca-trust/source/README
# for OpenSSL and static ca-certificates consumers
mkdir -p ${pkgdir}/usr/ssl/certs
cp -f ${pkgdir}/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem ${pkgdir}/usr/ssl/certs/ca-bundle.crt

View File

@ -1,4 +0,0 @@
This directory /etc/pki/ca-trust is used by a system of consolidated
CA certificates.
Please refer to the update-ca-trust(8) manual page for additional information.

View File

@ -1,12 +0,0 @@
This directory /etc/pki/ca-trust/extracted/ contains
CA certificate bundle files which are automatically created.
If your application isn't able to load the PKCS#11 module p11-kit-trust.so,
then you can use these files in your application to load a list of global
root CA certificates.
Please never manually edit the files stored in this directory,
because your changes will be lost and the files automatically overwritten,
each time the update-ca-trust command gets executed.
Please refer to the update-ca-trust(8) manual page for additional information.

View File

@ -1,17 +0,0 @@
This directory /etc/pki/ca-trust/extracted/java/ contains
CA certificate bundle files which are automatically created
based on the information found in the
/usr/share/pki/ca-trust-source/ and /etc/pki/ca-trust/source/
directories.
All files are in the java keystore file format.
If your application isn't able to load the PKCS#11 module p11-kit-trust.so,
then you can use these files in your application to load a list of global
root CA certificates.
Please never manually edit the files stored in this directory,
because your changes will be lost and the files automatically overwritten,
each time the update-ca-trust command gets executed.
Please refer to the update-ca-trust(8) manual page for additional information.

View File

@ -1,18 +0,0 @@
This directory /etc/pki/ca-trust/extracted/openssl/ contains
CA certificate bundle files which are automatically created
based on the information found in the
/usr/share/pki/ca-trust-source/ and /etc/pki/ca-trust/source/
directories.
All files are in the BEGIN/END TRUSTED CERTIFICATE file format,
as described in the x509(1) manual page.
If your application isn't able to load the PKCS#11 module p11-kit-trust.so,
then you can use these files in your application to load a list of global
root CA certificates.
Please never manually edit the files stored in this directory,
because your changes will be lost and the files automatically overwritten,
each time the update-ca-trust command gets executed.
Please refer to the update-ca-trust(8) manual page for additional information.

View File

@ -1,21 +0,0 @@
This directory /etc/pki/ca-trust/extracted/pem/ contains
CA certificate bundle files which are automatically created
based on the information found in the
/usr/share/pki/ca-trust-source/ and /etc/pki/ca-trust/source/
directories.
All files are in the BEGIN/END CERTIFICATE file format,
as decribed in the x509(1) manual page.
Distrust information cannot be represented in this file format,
and distrusted certificates are missing from these files.
If your application isn't able to load the PKCS#11 module p11-kit-trust.so,
then you can use these files in your application to load a list of global
root CA certificates.
Please never manually edit the files stored in this directory,
because your changes will be lost and the files automatically overwritten,
each time the update-ca-trust command gets executed.
Please refer to the update-ca-trust(8) manual page for additional information.

View File

@ -1,20 +0,0 @@
This directory /etc/pki/ca-trust/source/ contains CA certificates and
trust settings in the PEM file format. The trust settings found here will be
interpreted with a high priority - higher than the ones found in
/usr/share/pki/ca-trust-source/.
=============================================================================
QUICK HELP: To add a certificate in the simple PEM or DER file formats to the
list of CAs trusted on the system:
Copy it to the
/etc/pki/ca-trust/source/anchors/
subdirectory, and run the
update-ca-trust
command.
If your certificate is in the extended BEGIN TRUSTED file format,
then place it into the main source/ directory instead.
=============================================================================
Please refer to the update-ca-trust(8) manual page for additional information.

View File

@ -1,20 +0,0 @@
This directory /usr/share/pki/ca-trust-source/ contains CA certificates and
trust settings in the PEM file format. The trust settings found here will be
interpreted with a low priority - lower than the ones found in
/etc/pki/ca-trust/source/ .
=============================================================================
QUICK HELP: To add a certificate in the simple PEM or DER file formats to the
list of CAs trusted on the system:
Copy it to the
/usr/share/pki/ca-trust-source/anchors/
subdirectory, and run the
update-ca-trust
command.
If your certificate is in the extended BEGIN TRUSTED file format,
then place it into the main source/ directory instead.
=============================================================================
Please refer to the update-ca-trust(8) manual page for additional information.

View File

@ -1,30 +0,0 @@
# One blacklist entry per line, corresponding to the label in certdata.txt.
# MD5 Collision Proof of Concept CA
"MD5 Collisions Forged Rogue CA 25c3"
# Obtained from certdata.txt version 1.86 on Wed Oct 24 13:49:41 EDT 2012 by Paul Wouters <pwouters@redhat.com>
"Bogus Mozilla Addons"
"Bogus Global Trustee"
"Bogus GMail"
"Bogus Google"
"Bogus Skype"
"Bogus Yahoo 1"
"Bogus Yahoo 2"
"Bogus Yahoo 3"
"Bogus live.com"
"Bogus kuix.de"
"Explicitly Distrust DigiNotar Root CA"
"Explicitly Distrust DigiNotar Services 1024 CA"
"Explicitly Distrust DigiNotar Cyber CA"
"Explicitly Distrust DigiNotar Cyber CA 2nd"
"Explicitly Distrusted DigiNotar PKIoverheid"
"Explicitly Distrusted DigiNotar PKIoverheid G2"
"Explicitly Distrusted Malaysian Digicert Sdn. Bhd. (cyb)"
"Explicitly Distrusted Malaysian Digicert Sdn. Bhd. (en)"
"MITM subCA 1 issued by Trustwave"
"MITM subCA 2 issued by Trustwave"
# From certdata.txt version 1.87 on Fri Jan 4 17:45:13 UTC 2013, added by Mozilla on Dec 29 2012
"TURKTRUST Mis-issued Intermediate CA 1"
"TURKTRUST Mis-issued Intermediate CA 2"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,197 @@
--- ca-certificates/mozilla/certdata2pem.py.orig 2014-03-13 16:43:00.000000000 +0400
+++ ca-certificates/mozilla/certdata2pem.py 2014-07-26 01:53:07.583600000 +0400
@@ -4,6 +4,7 @@
# certdata2pem.py - splits certdata.txt into multiple files
#
# Copyright (C) 2009 Philipp Kern <pkern@debian.org>
+# Copyright (C) 2013 Kai Engert <kaie@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,9 +26,13 @@
import re
import sys
import textwrap
+import urllib
objects = []
+def printable_serial(obj):
+ return ".".join(map(lambda x:str(ord(x)), obj['CKA_SERIAL_NUMBER']))
+
# Dirty file parser.
in_data, in_multiline, in_obj = False, False, False
field, type, value, obj = None, None, None, dict()
@@ -70,7 +75,7 @@
field, type = line_parts
value = None
else:
- raise NotImplementedError, 'line_parts < 2 not supported.'
+ raise NotImplementedError, 'line_parts < 2 not supported.\n' + line
if type == 'MULTILINE_OCTAL':
in_multiline = True
value = ""
@@ -79,55 +84,117 @@
if len(obj.items()) > 0:
objects.append(obj)
-# Read blacklist.
-blacklist = []
-if os.path.exists('blacklist.txt'):
- for line in open('blacklist.txt', 'r'):
- line = line.strip()
- if line.startswith('#') or len(line) == 0:
- continue
- item = line.split('#', 1)[0].strip()
- blacklist.append(item)
-
# Build up trust database.
-trust = dict()
+trustmap = dict()
for obj in objects:
- if obj['CKA_CLASS'] not in ('CKO_NETSCAPE_TRUST', 'CKO_NSS_TRUST'):
+ if obj['CKA_CLASS'] != 'CKO_NSS_TRUST':
continue
- if obj['CKA_LABEL'] in blacklist:
- print "Certificate %s blacklisted, ignoring." % obj['CKA_LABEL']
- elif obj['CKA_TRUST_SERVER_AUTH'] in ('CKT_NETSCAPE_TRUSTED_DELEGATOR',
- 'CKT_NSS_TRUSTED_DELEGATOR'):
- trust[obj['CKA_LABEL']] = True
- elif obj['CKA_TRUST_EMAIL_PROTECTION'] in ('CKT_NETSCAPE_TRUSTED_DELEGATOR',
- 'CKT_NSS_TRUSTED_DELEGATOR'):
- trust[obj['CKA_LABEL']] = True
- elif obj['CKA_TRUST_SERVER_AUTH'] in ('CKT_NETSCAPE_UNTRUSTED',
- 'CKT_NSS_NOT_TRUSTED'):
- print '!'*74
- print "UNTRUSTED BUT NOT BLACKLISTED CERTIFICATE FOUND: %s" % obj['CKA_LABEL']
- print '!'*74
- else:
- print "Ignoring certificate %s. SAUTH=%s, EPROT=%s" % \
- (obj['CKA_LABEL'], obj['CKA_TRUST_SERVER_AUTH'],
- obj['CKA_TRUST_EMAIL_PROTECTION'])
+ key = obj['CKA_LABEL'] + printable_serial(obj)
+ trustmap[key] = obj
+ print " added trust", key
+# Build up cert database.
+certmap = dict()
for obj in objects:
- if obj['CKA_CLASS'] == 'CKO_CERTIFICATE':
- if not obj['CKA_LABEL'] in trust or not trust[obj['CKA_LABEL']]:
- continue
- bname = obj['CKA_LABEL'][1:-1].replace('/', '_')\
- .replace(' ', '_')\
- .replace('(', '=')\
- .replace(')', '=')\
- .replace(',', '_')
- bname = bname.decode('string_escape')
- fname = bname + '.crt'
- if os.path.exists(fname):
- print "Found duplicate certificate name %s, renaming." % bname
- fname = bname + '_2.crt'
- f = open(fname, 'w')
- f.write("-----BEGIN CERTIFICATE-----\n")
- f.write("\n".join(textwrap.wrap(base64.b64encode(obj['CKA_VALUE']), 64)))
- f.write("\n-----END CERTIFICATE-----\n")
+ if obj['CKA_CLASS'] != 'CKO_CERTIFICATE':
+ continue
+ key = obj['CKA_LABEL'] + printable_serial(obj)
+ certmap[key] = obj
+ print " added cert", key
+
+def obj_to_filename(obj):
+ label = obj['CKA_LABEL'][1:-1]
+ label = label.replace('/', '_')\
+ .replace(' ', '_')\
+ .replace(':', '_')\
+ .replace('(', '=')\
+ .replace(')', '=')\
+ .replace(',', '_')
+ label = re.sub(r'\\x[0-9a-fA-F]{2}', lambda m:chr(int(m.group(0)[2:], 16)), label)
+ serial = printable_serial(obj)
+ return label + "_" + serial
+
+trust_types = {
+ "CKA_TRUST_DIGITAL_SIGNATURE": "digital-signature",
+ "CKA_TRUST_NON_REPUDIATION": "non-repudiation",
+ "CKA_TRUST_KEY_ENCIPHERMENT": "key-encipherment",
+ "CKA_TRUST_DATA_ENCIPHERMENT": "data-encipherment",
+ "CKA_TRUST_KEY_AGREEMENT": "key-agreement",
+ "CKA_TRUST_KEY_CERT_SIGN": "cert-sign",
+ "CKA_TRUST_CRL_SIGN": "crl-sign",
+ "CKA_TRUST_SERVER_AUTH": "server-auth",
+ "CKA_TRUST_CLIENT_AUTH": "client-auth",
+ "CKA_TRUST_CODE_SIGNING": "code-signing",
+ "CKA_TRUST_EMAIL_PROTECTION": "email-protection",
+ "CKA_TRUST_IPSEC_END_SYSTEM": "ipsec-end-system",
+ "CKA_TRUST_IPSEC_TUNNEL": "ipsec-tunnel",
+ "CKA_TRUST_IPSEC_USER": "ipsec-user",
+ "CKA_TRUST_TIME_STAMPING": "time-stamping",
+ "CKA_TRUST_STEP_UP_APPROVED": "step-up-approved",
+}
+
+openssl_trust = {
+ "CKA_TRUST_SERVER_AUTH": "serverAuth",
+ "CKA_TRUST_CLIENT_AUTH": "clientAuth",
+ "CKA_TRUST_CODE_SIGNING": "codeSigning",
+ "CKA_TRUST_EMAIL_PROTECTION": "emailProtection",
+}
+
+for tobj in objects:
+ if tobj['CKA_CLASS'] == 'CKO_NSS_TRUST':
+ key = tobj['CKA_LABEL'] + printable_serial(tobj)
+ print "producing trust for " + key
+ trustbits = []
+ distrustbits = []
+ openssl_trustflags = []
+ openssl_distrustflags = []
+ for t in trust_types.keys():
+ if tobj.has_key(t) and tobj[t] == 'CKT_NSS_TRUSTED_DELEGATOR':
+ trustbits.append(t)
+ if t in openssl_trust:
+ openssl_trustflags.append(openssl_trust[t])
+ if tobj.has_key(t) and tobj[t] == 'CKT_NSS_NOT_TRUSTED':
+ distrustbits.append(t)
+ if t in openssl_trust:
+ openssl_distrustflags.append(openssl_trust[t])
+
+ fname = obj_to_filename(tobj)
+ try:
+ obj = certmap[key]
+ except:
+ obj = None
+
+ if obj != None:
+ fname += ".crt"
+ else:
+ fname += ".p11-kit"
+ f = open(fname, 'w')
+ if obj != None:
+ f.write("# alias=%s\n"%tobj['CKA_LABEL'])
+ f.write("# trust=" + " ".join(trustbits) + "\n")
+ f.write("# distrust=" + " ".join(distrustbits) + "\n")
+ if openssl_trustflags:
+ f.write("# openssl-trust=" + " ".join(openssl_trustflags) + "\n")
+ if openssl_distrustflags:
+ f.write("# openssl-distrust=" + " ".join(openssl_distrustflags) + "\n")
+ f.write("-----BEGIN CERTIFICATE-----\n")
+ f.write("\n".join(textwrap.wrap(base64.b64encode(obj['CKA_VALUE']), 64)))
+ f.write("\n-----END CERTIFICATE-----\n")
+ else:
+ f.write("[p11-kit-object-v1]\n")
+ f.write("label: ");
+ f.write(tobj['CKA_LABEL']);
+ f.write("\n")
+ f.write("class: certificate\n")
+ f.write("certificate-type: x-509\n")
+ f.write("issuer: \"");
+ f.write(urllib.quote(tobj['CKA_ISSUER']));
+ f.write("\"\n")
+ f.write("serial-number: \"");
+ f.write(urllib.quote(tobj['CKA_SERIAL_NUMBER']));
+ f.write("\"\n")
+ if (tobj['CKA_TRUST_SERVER_AUTH'] == 'CKT_NSS_NOT_TRUSTED') or (tobj['CKA_TRUST_EMAIL_PROTECTION'] == 'CKT_NSS_NOT_TRUSTED') or (tobj['CKA_TRUST_CODE_SIGNING'] == 'CKT_NSS_NOT_TRUSTED'):
+ f.write("x-distrusted: true\n")
+ f.write("\n\n")
+ print " -> written as '%s', trust = %s, openssl-trust = %s, distrust = %s, openssl-distrust = %s" % (fname, trustbits, openssl_trustflags, distrustbits, openssl_distrustflags)

View File

@ -1,199 +0,0 @@
#!/usr/bin/python
# vim:set et sw=4:
#
# certdata2pem.py - splits certdata.txt into multiple files
#
# Copyright (C) 2009 Philipp Kern <pkern@debian.org>
# Copyright (C) 2013 Kai Engert <kaie@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
# USA.
import base64
import os.path
import re
import sys
import textwrap
import urllib
objects = []
def printable_serial(obj):
return ".".join(map(lambda x:str(ord(x)), obj['CKA_SERIAL_NUMBER']))
# Dirty file parser.
in_data, in_multiline, in_obj = False, False, False
field, type, value, obj = None, None, None, dict()
for line in open('certdata.txt', 'r'):
# Ignore the file header.
if not in_data:
if line.startswith('BEGINDATA'):
in_data = True
continue
# Ignore comment lines.
if line.startswith('#'):
continue
# Empty lines are significant if we are inside an object.
if in_obj and len(line.strip()) == 0:
objects.append(obj)
obj = dict()
in_obj = False
continue
if len(line.strip()) == 0:
continue
if in_multiline:
if not line.startswith('END'):
if type == 'MULTILINE_OCTAL':
line = line.strip()
for i in re.finditer(r'\\([0-3][0-7][0-7])', line):
value += chr(int(i.group(1), 8))
else:
value += line
continue
obj[field] = value
in_multiline = False
continue
if line.startswith('CKA_CLASS'):
in_obj = True
line_parts = line.strip().split(' ', 2)
if len(line_parts) > 2:
field, type = line_parts[0:2]
value = ' '.join(line_parts[2:])
elif len(line_parts) == 2:
field, type = line_parts
value = None
else:
raise NotImplementedError, 'line_parts < 2 not supported.\n' + line
if type == 'MULTILINE_OCTAL':
in_multiline = True
value = ""
continue
obj[field] = value
if len(obj.items()) > 0:
objects.append(obj)
# Build up trust database.
trustmap = dict()
for obj in objects:
if obj['CKA_CLASS'] != 'CKO_NSS_TRUST':
continue
key = obj['CKA_LABEL'] + printable_serial(obj)
trustmap[key] = obj
print " added trust", key
# Build up cert database.
certmap = dict()
for obj in objects:
if obj['CKA_CLASS'] != 'CKO_CERTIFICATE':
continue
key = obj['CKA_LABEL'] + printable_serial(obj)
certmap[key] = obj
print " added cert", key
def obj_to_filename(obj):
label = obj['CKA_LABEL'][1:-1]
label = label.replace('/', '_')\
.replace(' ', '_')\
.replace('(', '=')\
.replace(')', '=')\
.replace(',', '_')
label = re.sub(r'\\x[0-9a-fA-F]{2}', lambda m:chr(int(m.group(0)[2:], 16)), label)
serial = printable_serial(obj)
return label + ":" + serial
trust_types = {
"CKA_TRUST_DIGITAL_SIGNATURE": "digital-signature",
"CKA_TRUST_NON_REPUDIATION": "non-repudiation",
"CKA_TRUST_KEY_ENCIPHERMENT": "key-encipherment",
"CKA_TRUST_DATA_ENCIPHERMENT": "data-encipherment",
"CKA_TRUST_KEY_AGREEMENT": "key-agreement",
"CKA_TRUST_KEY_CERT_SIGN": "cert-sign",
"CKA_TRUST_CRL_SIGN": "crl-sign",
"CKA_TRUST_SERVER_AUTH": "server-auth",
"CKA_TRUST_CLIENT_AUTH": "client-auth",
"CKA_TRUST_CODE_SIGNING": "code-signing",
"CKA_TRUST_EMAIL_PROTECTION": "email-protection",
"CKA_TRUST_IPSEC_END_SYSTEM": "ipsec-end-system",
"CKA_TRUST_IPSEC_TUNNEL": "ipsec-tunnel",
"CKA_TRUST_IPSEC_USER": "ipsec-user",
"CKA_TRUST_TIME_STAMPING": "time-stamping",
"CKA_TRUST_STEP_UP_APPROVED": "step-up-approved",
}
openssl_trust = {
"CKA_TRUST_SERVER_AUTH": "serverAuth",
"CKA_TRUST_CLIENT_AUTH": "clientAuth",
"CKA_TRUST_CODE_SIGNING": "codeSigning",
"CKA_TRUST_EMAIL_PROTECTION": "emailProtection",
}
for tobj in objects:
if tobj['CKA_CLASS'] == 'CKO_NSS_TRUST':
key = tobj['CKA_LABEL'] + printable_serial(tobj)
print "producing trust for " + key
trustbits = []
distrustbits = []
openssl_trustflags = []
openssl_distrustflags = []
for t in trust_types.keys():
if tobj.has_key(t) and tobj[t] == 'CKT_NSS_TRUSTED_DELEGATOR':
trustbits.append(t)
if t in openssl_trust:
openssl_trustflags.append(openssl_trust[t])
if tobj.has_key(t) and tobj[t] == 'CKT_NSS_NOT_TRUSTED':
distrustbits.append(t)
if t in openssl_trust:
openssl_distrustflags.append(openssl_trust[t])
fname = obj_to_filename(tobj)
try:
obj = certmap[key]
except:
obj = None
if obj != None:
fname += ".crt"
else:
fname += ".p11-kit"
f = open(fname, 'w')
if obj != None:
f.write("# alias=%s\n"%tobj['CKA_LABEL'])
f.write("# trust=" + " ".join(trustbits) + "\n")
f.write("# distrust=" + " ".join(distrustbits) + "\n")
if openssl_trustflags:
f.write("# openssl-trust=" + " ".join(openssl_trustflags) + "\n")
if openssl_distrustflags:
f.write("# openssl-distrust=" + " ".join(openssl_distrustflags) + "\n")
f.write("-----BEGIN CERTIFICATE-----\n")
f.write("\n".join(textwrap.wrap(base64.b64encode(obj['CKA_VALUE']), 64)))
f.write("\n-----END CERTIFICATE-----\n")
else:
f.write("[p11-kit-object-v1]\n")
f.write("label: ");
f.write(tobj['CKA_LABEL']);
f.write("\n")
f.write("class: certificate\n")
f.write("certificate-type: x-509\n")
f.write("issuer: \"");
f.write(urllib.quote(tobj['CKA_ISSUER']));
f.write("\"\n")
f.write("serial-number: \"");
f.write(urllib.quote(tobj['CKA_SERIAL_NUMBER']));
f.write("\"\n")
if (tobj['CKA_TRUST_SERVER_AUTH'] == 'CKT_NSS_NOT_TRUSTED') or (tobj['CKA_TRUST_EMAIL_PROTECTION'] == 'CKT_NSS_NOT_TRUSTED') or (tobj['CKA_TRUST_CODE_SIGNING'] == 'CKT_NSS_NOT_TRUSTED'):
f.write("x-distrusted: true\n")
f.write("\n\n")
print " -> written as '%s', trust = %s, openssl-trust = %s, distrust = %s, openssl-distrust = %s" % (fname, trustbits, openssl_trustflags, distrustbits, openssl_distrustflags)

View File

@ -1,4 +0,0 @@
#!/bin/sh
exec cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot \
co -p mozilla/security/nss/lib/ckfw/builtins/certdata.txt \
> certdata.txt

View File

@ -1,60 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef NSSCKBI_H
#define NSSCKBI_H
/*
* NSS BUILTINS Version numbers.
*
* These are the version numbers for the builtins module packaged with
* this release on NSS. To determine the version numbers of the builtin
* module you are using, use the appropriate PKCS #11 calls.
*
* These version numbers detail changes to the PKCS #11 interface. They map
* to the PKCS #11 spec versions.
*/
#define NSS_BUILTINS_CRYPTOKI_VERSION_MAJOR 2
#define NSS_BUILTINS_CRYPTOKI_VERSION_MINOR 20
/* These version numbers detail the changes
* to the list of trusted certificates.
*
* The NSS_BUILTINS_LIBRARY_VERSION_MINOR macro needs to be bumped
* for each NSS minor release AND whenever we change the list of
* trusted certificates. 10 minor versions are allocated for each
* NSS 3.x branch as follows, allowing us to change the list of
* trusted certificates up to 9 times on each branch.
* - NSS 3.5 branch: 3-9
* - NSS 3.6 branch: 10-19
* - NSS 3.7 branch: 20-29
* - NSS 3.8 branch: 30-39
* - NSS 3.9 branch: 40-49
* - NSS 3.10 branch: 50-59
* - NSS 3.11 branch: 60-69
* ...
* - NSS 3.12 branch: 70-89
* - NSS 3.13 branch: 90-99
* - NSS 3.14 branch: 100-109
* ...
* - NSS 3.29 branch: 250-255
*
* NSS_BUILTINS_LIBRARY_VERSION_MINOR is a CK_BYTE. It's not clear
* whether we may use its full range (0-255) or only 0-99 because
* of the comment in the CK_VERSION type definition.
*/
#define NSS_BUILTINS_LIBRARY_VERSION_MAJOR 1
#define NSS_BUILTINS_LIBRARY_VERSION_MINOR 97
#define NSS_BUILTINS_LIBRARY_VERSION "1.97"
/* These version numbers detail the semantic changes to the ckfw engine. */
#define NSS_BUILTINS_HARDWARE_VERSION_MAJOR 1
#define NSS_BUILTINS_HARDWARE_VERSION_MINOR 0
/* These version numbers detail the semantic changes to ckbi itself
* (new PKCS #11 objects), etc. */
#define NSS_BUILTINS_FIRMWARE_VERSION_MAJOR 1
#define NSS_BUILTINS_FIRMWARE_VERSION_MINOR 0
#endif /* NSSCKBI_H */

View File

@ -0,0 +1,293 @@
'\" t
.\" Title: update-ca-trust
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 08/04/2014
.\" Manual: \ \&
.\" Source: update-ca-trust
.\" Language: English
.\"
.TH "UPDATE\-CA\-TRUST" "8" "08/04/2014" "update\-ca\-trust" "\ \&"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
update-ca-trust \- manage consolidated and dynamic configuration of CA certificates and associated trust
.SH "SYNOPSIS"
.sp
\fBupdate\-ca\-trust\fR [\fICOMMAND\fR]
.SH "DESCRIPTION"
.sp
update\-ca\-trust(8) is used to manage a consolidated and dynamic configuration feature of Certificate Authority (CA) certificates and associated trust\&.
.sp
The feature is available for new applications that read the consolidated configuration files found in the /etc/pki/ca\-trust/extracted directory or that load the PKCS#11 module p11\-kit\-trust\&.so
.sp
Parts of the new feature are also provided in a way to make it useful for legacy applications\&.
.sp
Many legacy applications expect CA certificates and trust configuration in a fixed location, contained in files with particular path and name, or by referring to a classic PKCS#11 trust module provided by the NSS cryptographic library\&.
.sp
The dynamic configuration feature provides functionally compatible replacements for classic configuration files and for the classic NSS trust module named libnssckbi\&.
.sp
In order to enable legacy applications, that read the classic files or access the classic module, to make use of the new consolidated and dynamic configuration feature, the classic filenames have been changed to symbolic links\&. The symbolic links refer to dynamically created and consolidated output stored below the /etc/pki/ca\-trust/extracted directory hierarchy\&.
.sp
The output is produced using the \fIupdate\-ca\-trust\fR command (without parameters), or using the \fIupdate\-ca\-trust extract\fR command\&. In order to produce the output, a flexible set of source configuration is read, as described in section SOURCE CONFIGURATION\&.
.sp
In addition, the classic PKCS#11 module is replaced with a new PKCS#11 module (p11\-kit\-trust\&.so) that dynamically reads the same source configuration\&.
.SH "SOURCE CONFIGURATION"
.sp
The dynamic configuration feature uses several source directories that will be scanned for any number of source files\&. \fBIt is important to select the correct subdirectory for adding files, as the subdirectory defines how contained certificates will be trusted or distrusted, and which file formats are read\&.\fR
.sp
Files in \fBsubdirectories below the directory hierarchy /usr/share/pki/ca\-trust\-source/\fR contain CA certificates and trust settings in the PEM file format\&. The trust settings found here will be interpreted with a \fBlow priority\fR\&.
.sp
Files in \fBsubdirectories below the directory hierarchy /etc/pki/ca\-trust/source/\fR contain CA certificates and trust settings in the PEM file format\&. The trust settings found here will be interpreted with a \fBhigh priority\fR\&.
.PP
\fBYou may use the following rules of thumb to decide, whether your configuration files should be added to the /etc or rather to the /usr directory hierarchy:\fR
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
If you are manually adding a configuration file to a system, you probably want it to override any other default configuration, and you most likely should add it to the respective subdirectory in the /etc hierarchy\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
If you are creating a package that provides additional root CA certificates, that is intended for distribution to several computer systems, but you still want to allow the administrator to override your list, then your package should add your files to the respective subdirectory in the /usr hierarchy\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
If you are creating a package that is supposed to override the default system trust settings, that is intended for distribution to several computer systems, then your package should install the files to the respective subdirectory in the /etc hierarchy\&.
.RE
.PP
\fBQUICK HELP 1\fR\fB: To add a certificate in the simple PEM or DER file formats to the list of CAs trusted on the system:\fR
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
add it as a new file to directory /etc/pki/ca\-trust/source/anchors/
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
run
\fIupdate\-ca\-trust extract\fR
.RE
.PP
\fBQUICK HELP 2\fR\fB: If your certificate is in the extended BEGIN TRUSTED file format (which may contain distrust/blacklist trust flags, or trust flags for usages other than TLS) then:\fR
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
add it as a new file to directory /etc/pki/ca\-trust/source/
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
run
\fIupdate\-ca\-trust extract\fR
.RE
.PP
\fBIn order to offer simplicity and flexibility, the way certificate files are treated depends on the subdirectory they are installed to\&.\fR
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
simple trust anchors subdirectory: /usr/share/pki/ca\-trust\-source/anchors/ or /etc/pki/ca\-trust/source/anchors/
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
simple blacklist (distrust) subdirectory: /usr/share/pki/ca\-trust\-source/blacklist/ or /etc/pki/ca\-trust/source/blacklist/
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
extended format directory: /usr/share/pki/ca\-trust\-source/ or /etc/pki/ca\-trust/source/
.RE
.PP
\fBIn the main directories /usr/share/pki/ca\-trust\-source/ or /etc/pki/ca\-trust/source/ you may install one or multiple files in the following file formats:\fR
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
certificate files that include trust flags, in the BEGIN/END TRUSTED CERTIFICATE file format (any file name), which have been created using the openssl x509 tool and the \-addreject \-addtrust options\&. Bundle files with multiple certificates are supported\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
files in the p11\-kit file format using the \&.p11\-kit file name extension, which can (e\&.g\&.) be used to distrust certificates based on serial number and issuer name, without having the full certificate available\&. (This is currently an undocumented format, to be extended later\&. For examples of the supported formats, see the files shipped with the ca\-certificates package\&.)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
certificate files without trust flags in either the DER file format or in the PEM (BEGIN/END CERTIFICATE) file format (any file name)\&. Such files will be added with neutral trust, neither trusted nor distrusted\&. They will simply be known to the system, which might be helpful to assist cryptographic software in constructing chains of certificates\&. (If you want a CA certificate in these file formats to be trusted, you should remove it from this directory and move it to the \&./anchors subdirectory instead\&.)
.RE
.sp
In the anchors subdirectories /usr/share/pki/ca\-trust\-source/anchors/ or /etc/pki/ca\-trust/source/anchors/ you may install one or multiple certificates in either the DER file format or in the PEM (BEGIN/END CERTIFICATE) file format\&. Each certificate will be treated as \fBtrusted\fR for all purposes\&.
.sp
In the blacklist subdirectories /usr/share/pki/ca\-trust\-source/blacklist/ or /etc/pki/ca\-trust/source/blacklist/ you may install one or multiple certificates in either the DER file format or in the PEM (BEGIN/END CERTIFICATE) file format\&. Each certificate will be treated as \fBdistrusted\fR for all purposes\&.
.sp
Please refer to the x509(1) manual page for the documentation of the BEGIN/END CERTIFICATE and BEGIN/END TRUSTED CERTIFICATE file formats\&.
.sp
Applications that rely on a static file for a list of trusted CAs may load one of the files found in the /etc/pki/ca\-trust/extracted directory\&. After modifying any file in the /usr/share/pki/ca\-trust\-source/ or /etc/pki/ca\-trust/source/ directories or in any of their subdirectories, or after adding a file, it is necessary to run the \fIupdate\-ca\-trust extract\fR command, in order to update the consolidated files in /etc/pki/ca\-trust/extracted/ \&.
.sp
Applications that load the classic PKCS#11 module using filename libnssckbi\&.so (which has been converted into a symbolic link pointing to the new module) and any application capable of loading PKCS#11 modules and loading p11\-kit\-trust\&.so, will benefit from the dynamically merged set of certificates and trust information stored in the /usr/share/pki/ca\-trust\-source/ and /etc/pki/ca\-trust/source/ directories\&.
.SH "EXTRACTED CONFIGURATION"
.sp
The directory /etc/pki/ca\-trust/extracted/ contains generated CA certificate bundle files which are created and updated, based on the SOURCE CONFIGURATION by running the \fIupdate\-ca\-trust extract\fR command\&.
.sp
If your application isn\(cqt able to load the PKCS#11 module p11\-kit\-trust\&.so, then you can use these files in your application to load a list of global root CA certificates\&.
.sp
Please never manually edit the files stored in this directory, because your changes will be lost and the files automatically overwritten, each time the \fIupdate\-ca\-trust extract\fR command gets executed\&.
.sp
In order to install new trusted or distrusted certificates, please rather install them in the respective subdirectory below the /usr/share/pki/ca\-trust\-source/ or /etc/pki/ca\-trust/source/ directories, as described in the SOURCE CONFIGURATION section\&.
.sp
The directory /etc/pki/ca\-trust/extracted/java/ contains a CA certificate bundle in the java keystore file format\&. Distrust information cannot be represented in this file format, and distrusted certificates are missing from these files\&. File cacerts contains CA certificates trusted for TLS server authentication\&.
.sp
The directory /etc/pki/ca\-trust/extracted/openssl/ contains CA certificate bundle files in the extended BEGIN/END TRUSTED CERTIFICATE file format, as described in the x509(1) manual page\&. File ca\-bundle\&.trust\&.crt contains the full set of all trusted or distrusted certificates, including the associated trust flags\&.
.sp
The directory /etc/pki/ca\-trust/extracted/pem/ contains CA certificate bundle files in the simple BEGIN/END CERTIFICATE file format, as decribed in the x509(1) manual page\&. Distrust information cannot be represented in this file format, and distrusted certificates are missing from these files\&. File tls\-ca\-bundle\&.pem contains CA certificates trusted for TLS server authentication\&. File email\-ca\-bundle\&.pem contains CA certificates trusted for E\-Mail protection\&. File objsign\-ca\-bundle\&.pem contains CA certificates trusted for code signing\&.
.SH "COMMANDS"
.PP
(absent/empty command)
.RS 4
Same as the
\fBextract\fR
command described below\&. (However, the command may print fewer warnings, as this command is being run during rpm package installation, where non\-fatal status output is undesired\&.)
.RE
.PP
\fBextract\fR
.RS 4
Instruct update\-ca\-trust to scan the
SOURCE CONFIGURATION
and produce updated versions of the consolidated configuration files stored below the /etc/pki/ca\-trust/extracted directory hierarchy\&.
.RE
.SH "FILES"
.PP
/etc/pki/tls/certs/ca\-bundle\&.crt
.RS 4
Classic filename, file contains a list of CA certificates trusted for TLS server authentication usage, in the simple BEGIN/END CERTIFICATE file format, without distrust information\&. This file is a symbolic link that refers to the consolidated output created by the update\-ca\-trust command\&.
.RE
.PP
/etc/pki/tls/certs/ca\-bundle\&.trust\&.crt
.RS 4
Classic filename, file contains a list of CA certificates in the extended BEGIN/END TRUSTED CERTIFICATE file format, which includes trust (and/or distrust) flags specific to certificate usage\&. This file is a symbolic link that refers to the consolidated output created by the update\-ca\-trust command\&.
.RE
.PP
/etc/pki/java/cacerts
.RS 4
Classic filename, file contains a list of CA certificates trusted for TLS server authentication usage, in the Java keystore file format, without distrust information\&. This file is a symbolic link that refers to the consolidated output created by the update\-ca\-trust command\&.
.RE
.PP
/usr/share/pki/ca\-trust\-source
.RS 4
Contains multiple, low priority source configuration files as explained in section
SOURCE CONFIGURATION\&. Please pay attention to the specific meanings of the respective subdirectories\&.
.RE
.PP
/etc/pki/ca\-trust/source
.RS 4
Contains multiple, high priority source configuration files as explained in section
SOURCE CONFIGURATION\&. Please pay attention to the specific meanings of the respective subdirectories\&.
.RE
.PP
/etc/pki/ca\-trust/extracted
.RS 4
Contains consolidated and automatically generated configuration files for consumption by applications, which are created using the
\fIupdate\-ca\-trust extract\fR
command\&. Don\(cqt edit files in this directory, because they will be overwritten\&. See section
EXTRACTED CONFIGURATION
for additional details\&.
.RE
.SH "AUTHOR"
.sp
Written by Kai Engert and Stef Walter\&.

View File

@ -1,245 +0,0 @@
////
Copyright (C) 2013 Red Hat, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
////
update-ca-trust(8)
==================
:doctype: manpage
:man source: update-ca-trust
NAME
----
update-ca-trust - manage consolidated and dynamic configuration of CA
certificates and associated trust
SYNOPSIS
--------
*update-ca-trust* ['COMMAND']
DESCRIPTION
-----------
update-ca-trust(8) is used to manage a consolidated and dynamic configuration
feature of Certificate Authority (CA) certificates and associated trust.
The feature is available for new applications that read the
consolidated configuration files found in the /etc/pki/ca-trust/extracted directory
or that load the PKCS#11 module p11-kit-trust.so
Parts of the new feature are also provided in a way to make it useful
for legacy applications.
Many legacy applications expect CA certificates and trust configuration
in a fixed location, contained in files with particular path and name,
or by referring to a classic PKCS#11 trust module provided by the
NSS cryptographic library.
The dynamic configuration feature provides functionally compatible replacements
for classic configuration files and for the classic NSS trust module named libnssckbi.
In order to enable legacy applications, that read the classic files or
access the classic module, to make use of the new consolidated and dynamic configuration
feature, the classic filenames have been changed to symbolic links.
The symbolic links refer to dynamically created and consolidated
output stored below the /etc/pki/ca-trust/extracted directory hierarchy.
The output is produced using the 'update-ca-trust' command (without parameters),
or using the 'update-ca-trust extract' command.
In order to produce the output, a flexible set of source configuration
is read, as described in section <<sourceconf,SOURCE CONFIGURATION>>.
In addition, the classic PKCS#11 module
is replaced with a new PKCS#11 module (p11-kit-trust.so) that dynamically
reads the same source configuration.
[[sourceconf]]
SOURCE CONFIGURATION
--------------------
The dynamic configuration feature uses several source directories that
will be scanned for any number of source files. *It is important to select
the correct subdirectory for adding files, as the subdirectory defines how
contained certificates will be trusted or distrusted, and which file formats are read.*
Files in *subdirectories below the directory hierarchy /usr/share/pki/ca-trust-source/* contain CA certificates and
trust settings in the PEM file format. The trust settings found here will be
interpreted with a *low priority*.
Files in *subdirectories below the directory hierarchy /etc/pki/ca-trust/source/* contain CA certificates and
trust settings in the PEM file format. The trust settings found here will be
interpreted with a *high priority*.
.You may use the following rules of thumb to decide, whether your configuration files should be added to the /etc or rather to the /usr directory hierarchy:
* If you are manually adding a configuration file to a system, you probably
want it to override any other default configuration, and you most likely should
add it to the respective subdirectory in the /etc hierarchy.
* If you are creating a package that provides additional root CA certificates,
that is intended for distribution to several computer systems, but you still
want to allow the administrator to override your list, then your package should
add your files to the respective subdirectory in the /usr hierarchy.
* If you are creating a package that is supposed to override the default system
trust settings, that is intended for distribution to several computer systems, then your package should install the files to the respective
subdirectory in the /etc hierarchy.
.*QUICK HELP 1*: To add a certificate in the simple PEM or DER file formats to the list of CAs trusted on the system:
* add it as a new file to directory /etc/pki/ca-trust/source/anchors/
* run 'update-ca-trust extract'
.*QUICK HELP 2*: If your certificate is in the extended BEGIN TRUSTED file format (which may contain distrust/blacklist trust flags, or trust flags for usages other than TLS) then:
* add it as a new file to directory /etc/pki/ca-trust/source/
* run 'update-ca-trust extract'
.In order to offer simplicity and flexibility, the way certificate files are treated depends on the subdirectory they are installed to.
* simple trust anchors subdirectory: /usr/share/pki/ca-trust-source/anchors/ or /etc/pki/ca-trust/source/anchors/
* simple blacklist (distrust) subdirectory: /usr/share/pki/ca-trust-source/blacklist/ or /etc/pki/ca-trust/source/blacklist/
* extended format directory: /usr/share/pki/ca-trust-source/ or /etc/pki/ca-trust/source/
.In the main directories /usr/share/pki/ca-trust-source/ or /etc/pki/ca-trust/source/ you may install one or multiple files in the following file formats:
* certificate files that include trust flags,
in the BEGIN/END TRUSTED CERTIFICATE file format
(any file name), which have been created using the openssl x509 tool
and the -addreject -addtrust options.
Bundle files with multiple certificates are supported.
* files in the p11-kit file format using the .p11-kit file name
extension, which can (e.g.) be used to distrust certificates
based on serial number and issuer name, without having the
full certificate available.
(This is currently an undocumented format, to be extended later.
For examples of the supported formats, see the files
shipped with the ca-certificates package.)
* certificate files without trust flags in either the DER file format or in
the PEM (BEGIN/END CERTIFICATE) file format (any file name). Such files
will be added with neutral trust, neither trusted nor distrusted.
They will simply be known to the system, which might be helpful to
assist cryptographic software in constructing chains of certificates.
(If you want a CA certificate in these file formats to be trusted, you
should remove it from this directory and move it to the
./anchors subdirectory instead.)
In the anchors subdirectories /usr/share/pki/ca-trust-source/anchors/ or /etc/pki/ca-trust/source/anchors/
you may install one or multiple certificates in either the DER file
format or in the PEM (BEGIN/END CERTIFICATE) file format.
Each certificate will be treated as *trusted* for all purposes.
In the blacklist subdirectories /usr/share/pki/ca-trust-source/blacklist/ or /etc/pki/ca-trust/source/blacklist/
you may install one or multiple certificates in either the DER file
format or in the PEM (BEGIN/END CERTIFICATE) file format.
Each certificate will be treated as *distrusted* for all purposes.
Please refer to the x509(1) manual page for the documentation of the
BEGIN/END CERTIFICATE and BEGIN/END TRUSTED CERTIFICATE file formats.
Applications that rely on a static file for a list of trusted CAs
may load one of the files found in the /etc/pki/ca-trust/extracted
directory. After modifying any file in the
/usr/share/pki/ca-trust-source/ or /etc/pki/ca-trust/source/
directories or in any of their subdirectories, or after adding a file,
it is necessary to run the 'update-ca-trust extract' command,
in order to update the consolidated files in /etc/pki/ca-trust/extracted/ .
Applications that load the classic PKCS#11 module using filename libnssckbi.so
(which has been converted into a symbolic link pointing to the new module)
and any application capable of
loading PKCS#11 modules and loading p11-kit-trust.so, will benefit from
the dynamically merged set of certificates and trust information stored in the
/usr/share/pki/ca-trust-source/ and /etc/pki/ca-trust/source/ directories.
[[extractconf]]
EXTRACTED CONFIGURATION
-----------------------
The directory /etc/pki/ca-trust/extracted/ contains generated CA certificate
bundle files which are created and updated, based on the <<sourceconf,SOURCE CONFIGURATION>>
by running the 'update-ca-trust extract' command.
If your application isn't able to load the PKCS#11 module p11-kit-trust.so,
then you can use these files in your application to load a list of global
root CA certificates.
Please never manually edit the files stored in this directory,
because your changes will be lost and the files automatically overwritten,
each time the 'update-ca-trust extract' command gets executed.
In order to install new trusted or distrusted certificates,
please rather install them in the respective subdirectory below the
/usr/share/pki/ca-trust-source/ or /etc/pki/ca-trust/source/
directories, as described in the <<sourceconf,SOURCE CONFIGURATION>> section.
The directory /etc/pki/ca-trust/extracted/java/ contains
a CA certificate bundle in the java keystore file format.
Distrust information cannot be represented in this file format,
and distrusted certificates are missing from these files.
File cacerts contains CA certificates trusted for TLS server authentication.
The directory /etc/pki/ca-trust/extracted/openssl/ contains
CA certificate bundle files in the extended BEGIN/END TRUSTED CERTIFICATE file format,
as described in the x509(1) manual page.
File ca-bundle.trust.crt contains the full set of all trusted
or distrusted certificates, including the associated trust flags.
The directory /etc/pki/ca-trust/extracted/pem/ contains
CA certificate bundle files in the simple BEGIN/END CERTIFICATE file format,
as decribed in the x509(1) manual page.
Distrust information cannot be represented in this file format,
and distrusted certificates are missing from these files.
File tls-ca-bundle.pem contains CA certificates
trusted for TLS server authentication.
File email-ca-bundle.pem contains CA certificates
trusted for E-Mail protection.
File objsign-ca-bundle.pem contains CA certificates
trusted for code signing.
COMMANDS
--------
(absent/empty command)::
Same as the *extract* command described below. (However, the command may
print fewer warnings, as this command is being run during rpm package
installation, where non-fatal status output is undesired.)
*extract*::
Instruct update-ca-trust to scan the <<sourceconf,SOURCE CONFIGURATION>> and produce
updated versions of the consolidated configuration files stored below
the /etc/pki/ca-trust/extracted directory hierarchy.
FILES
-----
/etc/pki/tls/certs/ca-bundle.crt::
Classic filename, file contains a list of CA certificates trusted for TLS server authentication usage, in the simple BEGIN/END CERTIFICATE file format, without distrust information.
This file is a symbolic link that refers to the consolidated output created by the update-ca-trust command.
/etc/pki/tls/certs/ca-bundle.trust.crt::
Classic filename, file contains a list of CA certificates in the extended BEGIN/END TRUSTED CERTIFICATE file format, which includes trust (and/or distrust) flags specific to certificate usage.
This file is a symbolic link that refers to the consolidated output created by the update-ca-trust command.
/etc/pki/java/cacerts::
Classic filename, file contains a list of CA certificates trusted for TLS server authentication usage, in the Java keystore file format, without distrust information.
This file is a symbolic link that refers to the consolidated output created by the update-ca-trust command.
/usr/share/pki/ca-trust-source::
Contains multiple, low priority source configuration files as explained in section <<sourceconf,SOURCE CONFIGURATION>>. Please pay attention to the specific meanings of the respective subdirectories.
/etc/pki/ca-trust/source::
Contains multiple, high priority source configuration files as explained in section <<sourceconf,SOURCE CONFIGURATION>>. Please pay attention to the specific meanings of the respective subdirectories.
/etc/pki/ca-trust/extracted::
Contains consolidated and automatically generated configuration files for consumption by applications,
which are created using the 'update-ca-trust extract' command. Don't edit files in this directory, because they will be overwritten.
See section <<extractconf,EXTRACTED CONFIGURATION>> for additional details.
AUTHOR
------
Written by Kai Engert and Stef Walter.