source: postlfs/security/cacerts.xml@ f1c2a4f

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 12.2 7.10 7.4 7.5 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gimp3 gnome kde5-13430 kde5-14269 kde5-14686 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts krejzi/svn lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition systemd-11177 systemd-13485 trunk upgradedb xry111/for-12.3 xry111/intltool xry111/llvm18 xry111/soup3 xry111/spidermonkey128 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since f1c2a4f was c9b953e6, checked in by Bruce Dubbs <bdubbs@…>, 13 years ago

Add a separate page for CA certificates.
Update to openssl-1.0.0e.
Update to bc-1.06.95.

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@8900 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 9.5 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6
7 <!ENTITY certhost "http://mxr.mozilla.org">
8 <!ENTITY certdir "/mozilla/source/security/nss/lib/ckfw/builtins">
9 <!ENTITY ca-bundle-download "&certhost;&certdir;/certdata.txt?raw=1">
10 <!ENTITY ca-bundle-size "1.2 MB">
11 <!ENTITY cacerts-buildsize "1.2 MB">
12 <!ENTITY cacerts-time "less than 0.1 SBU">
13]>
14
15<sect1 id="cacerts" xreflabel="Certificate Authority Certificates">
16 <?dbhtml filename="cacerts.html"?>
17
18 <sect1info>
19 <othername>$LastChangedBy$</othername>
20 <date>$Date$</date>
21 </sect1info>
22
23 <title>Certificate Authority Certificates</title>
24
25 <para>The Public Key Inrastructure is used for many security issues in a
26 Linux system. In order for a certificate to be trusted, it must be signed by
27 a trusted agent called a Certificate Authority (CA). The certificates loaded
28 by this section are from the list on the Mozilla version control system and
29 formats it into a form used by <xref linkend='openssl'/>. The certificates
30 can also be used by other applications either directly of indirectly through
31 <application>openssl</application>.</para>
32
33 &lfs70_checked;
34
35 <indexterm zone="cacerts">
36 <primary sortas="a-cacerts">Certificate Authority Certificates</primary>
37 </indexterm>
38
39 <sect2 role="package">
40 <title>Introduction to Certificate Authorities</title>
41
42 <bridgehead renderas="sect3">Package Information</bridgehead>
43 <itemizedlist spacing="compact">
44 <listitem>
45 <para>CA Certificate Download: <ulink url="&ca-bundle-download;"/></para>
46 </listitem>
47 <listitem>
48 <para>CA Bundle size: &ca-bundle-size;</para>
49 </listitem>
50 <listitem>
51 <para>Estimated disk space required: &cacerts-buildsize;</para>
52 </listitem>
53 <listitem>
54 <para>Estimated build time: &cacerts-time;</para>
55 </listitem>
56 </itemizedlist>
57
58 <bridgehead renderas="sect3">Certificate Authority Certificates Dependencies</bridgehead>
59
60 <bridgehead renderas="sect4">Required</bridgehead>
61 <para role="required"><xref linkend="openssl"/></para>
62
63 <para condition="html" role="usernotes">User Notes:
64 <ulink url='&blfs-wiki;/cacerts'/></para>
65 </sect2>
66
67 <sect2 role="installation">
68 <title>Installation of Certificate Authority Certificates</title>
69
70 <para>First create a script to reformat a certificate into a
71 form needed by <application>openssl</application>. As the <systemitem
72 class="username">root</systemitem> user:</para>
73
74 <screen><userinput>cat > /bin/make-cert.pl &lt;&lt; "EOF"
75#!/usr/bin/perl -w
76
77# Used to generate PEM encoded files from Mozilla certdata.txt.
78# Run as ./mkcrt.pl > certificate.crt
79#
80# Parts of this script courtesy of RedHat (mkcabundle.pl)
81#
82# This script modified for use with single file data (tempfile.cer) extracted
83# from certdata.txt, taken from the latest version in the Mozilla NSS source.
84# mozilla/security/nss/lib/ckfw/builtins/certdata.txt
85#
86# Authors: DJ Lucas
87# Bruce Dubbs
88
89my $certdata = './tempfile.cer';
90
91open( IN, "cat $certdata|" )
92 || die "could not open $certdata";
93
94my $incert = 0;
95
96while ( &lt;IN&gt; )
97{
98 if ( /^CKA_VALUE MULTILINE_OCTAL/ )
99 {
100 $incert = 1;
101 open( OUT, "|openssl x509 -text -inform DER -fingerprint" )
102 || die "could not pipe to openssl x509";
103 }
104
105 elsif ( /^END/ &amp;&amp; $incert )
106 {
107 close( OUT );
108 $incert = 0;
109 print "\n\n";
110 }
111
112 elsif ($incert)
113 {
114 my @bs = split( /\\/ );
115 foreach my $b (@bs)
116 {
117 chomp $b;
118 printf( OUT "%c", oct($b) ) unless $b eq '';
119 }
120 }
121}
122EOF
123
124chmod +x /bin/make-cert.pl</userinput></screen>
125
126 <para>The following script creates the certificates and a bundle of all the
127 certificates. It creates a <filename class='directory'>./certs</filename>
128 directory and <filename>./BLFS-ca-bundle-${VERSION}.crt</filename>. Again
129 create this script as the <systemitem class="username">root</systemitem>
130 user:</para>
131
132 <screen><userinput>cat > /bin/make-ca.sh &lt;&lt; "EOF"
133#!/bin/bash
134# Begin make-ca.sh
135# Script to populate OpenSSL's CApath from a bundle of PEM formatted CAs
136#
137# The file certdata.txt must exist in the local directory
138# Version number is obtained from the version of the data.
139#
140# Authors: DJ Lucas
141# Bruce Dubbs
142
143certdata="certdata.txt"
144
145if [ ! -r $certdata ]; then
146 echo "$certdata must be in the local directory"
147 exit 1
148fi
149
150REVISION=$(grep CVS_ID $certdata | cut -f4 -d'$')
151
152if [ -z "${REVISION}" ]; then
153 echo "$certfile has no 'Revision' in CVS_ID"
154 exit 1
155fi
156
157VERSION=$(echo $REVISION | cut -f2 -d" ")
158
159TEMPDIR=$(mktemp -d)
160TRUSTATTRIBUTES="CKA_TRUST_SERVER_AUTH"
161BUNDLE="BLFS-ca-bundle-${VERSION}.crt"
162CONVERTSCRIPT="make-cert.pl"
163SSLDIR="/etc/ssl"
164
165mkdir "${TEMPDIR}/certs"
166
167# Get a list of staring lines for each cert
168CERTBEGINLIST=$(grep -n "^# Certificate" "${certdata}" | cut -d ":" -f1)
169
170# Get a list of ending lines for each cert
171CERTENDLIST=`grep -n "^CKA_TRUST_STEP_UP_APPROVED" "${certdata}" | cut -d ":" -f 1`
172
173# Start a loop
174for certbegin in ${CERTBEGINLIST}; do
175 for certend in ${CERTENDLIST}; do
176 if test "${certend}" -gt "${certbegin}"; then
177 break
178 fi
179 done
180
181 # Dump to a temp file with the name of the file as the beginning line number
182 sed -n "${certbegin},${certend}p" "${certdata}" > "${TEMPDIR}/certs/${certbegin}.tmp"
183done
184
185unset CERTBEGINLIST CERTDATA CERTENDLIST certebegin certend
186
187mkdir -p certs
188rm certs/* # Make sure the directory is clean
189
190for tempfile in ${TEMPDIR}/certs/*.tmp; do
191 # Make sure that the cert is trusted...
192 grep "CKA_TRUST_SERVER_AUTH" "${tempfile}" | \
193 grep "CKT_NETSCAPE_TRUST_UNKNOWN" > /dev/null
194
195 if test "${?}" = "0"; then
196 # Throw a meaningful error and remove the file
197 cp "${tempfile}" tempfile.cer
198 "${CONVERTSCRIPT}" > tempfile.crt
199 keyhash=$(openssl x509 -noout -in tempfile.crt -hash)
200 echo "Certificate ${keyhash} is not trusted! Removing..."
201 rm -f tempfile.cer tempfile.crt "${tempfile}"
202 continue
203 fi
204
205 # If execution made it to here in the loop, the temp cert is trusted
206 # Find the cert data and generate a cert file for it
207
208 cp "${tempfile}" tempfile.cer
209 "${CONVERTSCRIPT}" > tempfile.crt
210 keyhash=$(openssl x509 -noout -in tempfile.crt -hash)
211 mv tempfile.crt "certs/${keyhash}.pem"
212 rm -f tempfile.cer "${tempfile}"
213 echo "Created ${keyhash}.pem"
214done
215
216# Remove blacklisted files
217# MD5 Collision Proof of Concept CA
218if test -f certs/8f111d69.pem; then
219 echo "Certificate 8f111d69 is not trusted! Removing..."
220 rm -f certs/8f111d69.pem
221fi
222
223# Finally, generate the bundle and clean up.
224cat certs/*.pem > ${BUNDLE}
225rm -r "${TEMPDIR}"
226EOF
227
228chmod +x /bin/make-ca.sh</userinput></screen>
229
230 <para>The following commands will fetch the certificates and convert them to
231 the correct format. If desired, a web browser may be used instead of
232 <application>wget</application> but the file will need to be saved with the
233 name <filename>certdata.txt</filename>. These commands can be repeated as
234 necessary to update the CA Certificates.</para>
235
236 <screen><userinput>certhost='http://mxr.mozilla.org' &amp;&amp;
237certdir='/mozilla/source/security/nss/lib/ckfw/builtins' &amp;&amp;
238url="$certhost$certdir/certdata.txt?raw=1" &amp;&amp;
239
240wget --output-document certdata.txt $url &amp;&amp;
241unset certhost certdir url &amp;&amp;
242make-ca.sh</userinput></screen>
243
244 <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
245
246<screen><userinput>install -d ${SSLDIR}/certs &amp;&amp;
247cp -v certs/*.pem ${SSLDIR}/certs &amp;&amp;
248c_rehash &amp;&amp;
249install ca-bundle.crt ${SSLDIR}</userinput></screen>
250
251 <para>Finally, clean up the current directory:</para>
252
253<screen><userinput>rm -r certs BLFS-ca-bundle*</userinput></screen>
254
255 </sect2>
256
257 <sect2 role="content">
258 <title>Contents</title>
259
260 <segmentedlist>
261 <segtitle>Installed Programs</segtitle>
262 <segtitle>Installed Libraries</segtitle>
263 <segtitle>Installed Directories</segtitle>
264
265 <seglistitem>
266 <seg>make-ca.sh and make-cert.pl</seg>
267 <seg>None</seg>
268 <seg>/etc/ssl/certs</seg>
269 </seglistitem>
270 </segmentedlist>
271
272 <variablelist>
273 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
274 <?dbfo list-presentation="list"?>
275 <?dbhtml list-presentation="table"?>
276
277 <varlistentry id="make-ca">
278 <term><command>make-ca.sh</command></term>
279 <listitem>
280 <para>is a <application>bash</application> script that reformats
281 the <filename>certdata.txt</filename> file for use by
282 <application>openssl</application>.</para>
283 <indexterm zone="cacerts make-ca">
284 <primary sortas="b-make-ca">make-ca</primary>
285 </indexterm>
286 </listitem>
287 </varlistentry>
288
289 <varlistentry id="make-cert">
290 <term><command>make-cert.pl</command></term>
291 <listitem>
292 <para>is a utility <application>perl</application> script that
293 converts a single binary certificate (.der format) into .pem format.</para>
294 <indexterm zone="cacerts make-cert">
295 <primary sortas="b-make-cert">make-cert</primary>
296 </indexterm>
297 </listitem>
298 </varlistentry>
299 </variablelist>
300
301 </sect2>
302</sect1>
Note: See TracBrowser for help on using the repository browser.