LPIC-3 331.1: X.509 certificates and public key infrastructures
A two-level CA with OpenSSL: a root, an intermediate run with openssl ca,
a server certificate, a revocation and a CRL, other file formats, and
CFSSL.
Before you start
The lab makes nothing but checks that /root/pki doesn't exist yet. Do
everything as root, in /root/pki, with the file names the tasks give.
Elliptic-curve P-256 keys without a passphrase are fine throughout.
Tasks
- Make a root CA,
root.key(mode 600) and the self-signedroot.crtfor/O=Lab/CN=Lab Root CA, valid for ten years, withbasicConstraintscriticalCA:TRUEandkeyUsagecriticalkeyCertSignandcRLSign. - Make an intermediate CA,
/O=Lab/CN=Lab Issuing CA, inint/: its key inint/private/int.keyand its certificateint/int.crt, signed by the root and allowing no CAs below it (pathlen:0). Set upint/foropenssl cawith a configurationint/ca.cnf, a databaseint/index.txtand serial files starting at 1000. - Request a server certificate for
/O=Lab/CN=www.lab.testwith the nameswww.lab.testandlab.test(www.key,www.csr), and issue it from the intermediate withopenssl caaswww.crt, for server authentication. Check that it verifies against the root only when the intermediate is supplied. - Revoke
www.crtwith reasonkeyCompromise, publish a CRLint.crlfrom the intermediate, and check that verification with the CRL now fails. - Save
www.crtin DER form aswww.der, and bundle the key, the certificate and the intermediate intowww.p12with the passwordlab-only. - Ubuntu: with CFSSL (package
golang-cfssl), make a root CALab CFSSL Root(organizationLab) from a JSON request, written ascfssl-ca.pemandcfssl-ca-key.pem.
Hints
openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-256 -noenc -days ... -subj ... -addext ...;openssl x509 -noout -subject -issuer -ext basicConstraints,keyUsage.openssl x509 -req -CA root.crt -CAkey root.key -CAcreateserial -extfile; a[ ca ]section withdir,database,new_certs_dir,serial,crlnumber,certificate,private_key,policyandcopy_extensions = copy.openssl req -new ... -addext subjectAltName=...;openssl ca -config int/ca.cnf -extensions ...;openssl verify -CAfile root.crt -untrusted int/int.crt www.crt.openssl ca -revoke ... -crl_reason,openssl ca -gencrl;openssl verify -crl_check -CAfile chain.pem -CRLfile int.crl.openssl x509 -outform DER;openssl pkcs12 -export -inkey -in -certfile -passout.cfssl gencert -initca ca.json | cfssljson -bare cfssl-ca;cfssl certinfo -cert.