1.5 KiB
1.5 KiB
Linux+ 3.5.3: Hashing and certificates
A checksum that catches a change, a private CA and a server certificate it signs, and trusting the CA system-wide.
Before you start
Nothing is set up. Work as root (sudo -i), in root's home directory
/root, so the files are where the check looks: /root/f.txt,
/root/f.sha256 and /root/pki/.
Tasks
- Write
version 1tof.txt, save its SHA-256 checksum inf.sha256, and check it. Then change the file toversion 2and see the check fail. Leave it like that. - In
/root/pki, make a private CA (ca.key,ca.crt, subjectCN=Lab CA), and a server key and certificate (www.key,www.crt) forlab.example.test, with that name in its subject alternative names, signed by the CA. Verify the certificate against the CA. - Serve the certificate with
openssl s_serveron port 8443 and see curl reject it, then accept it with--cacert. Then add the CA to the system's trust store, and see curl accept it without--cacert.
Hints
sha256sum FILE > FILE.sha256,sha256sum -c.openssl req -x509 -newkey rsa:3072 -nodes,openssl req -new,openssl x509 -req -CA -CAkey -CAcreateserial -extfilewithsubjectAltName=DNS:...;openssl verify -CAfile.curl --resolve lab.example.test:8443:127.0.0.1. RHEL family:/etc/pki/ca-trust/source/anchors/andupdate-ca-trust; Ubuntu:/usr/local/share/ca-certificates/(the name must end in.crt) andupdate-ca-certificates.