Libraries
dnf install -y gnutls-utils openssl
SSL/TLS libraries and tooling …most commonly used:
OpenSSL
View content of a certificate
1openssl x509 -in $file -text -noout
2openssl x509 -in $file -inform der -text -noout
# conversion
3openssl x509 -outform der -in $file.pem -out $file.der
4openssl x509 -inform der -in $file.der -out $file.pem
- 1
-
PEM encoded certificates …typical suffix
.pem
,.crt
,.cer
- 2
-
DER encoded certificate k,.typical suffix
.der
- 3
- Convert PEM certificate to DER
- 4
- Convert DER certificates to PEM
GnuTLS
Create a private CA…
# generate a 256-bit ECDSA private key
certtool --generate-privkey --sec-param High --key-type=ecdsa --outfile ca.key
# create a configuration file template
cat > ca.conf <<EOF
organization = "Example Organization"
state = "Example"
country = EX
cn = "Example CA"
serial = 007
expiration_days = 365
ca
cert_signing_key
crl_signing_key
EOF
# generate a self-signed certificate
certtool --generate-self-signed --load-privkey ca.key --template ca.conf --outfile ca.crt
Create a server certificate…
# generate a 256-bit ECDSA private key
certtool --generate-privkey --sec-param High --outfile server.key
# create a configuration file template
cat > server.conf <<EOF
country = "EX"
organization = "Example Organization"
cn = "server.example.org"
signing_key
encryption_key
key_agreement
tls_www_server
dns_name = "example.org"
dns_name = "server.example.org"
ip_address = "192.168.0.1"
ip_address = "::1"
ip_address = "127.0.0.1"
EOF
# create a CSR using the private key
certtool --generate-request --template server.conf --load-privkey server.key \
--outfile server.csr
Use a private CA to issue a certificatek…
cat > server-extensions.conf <<EOF
honor_crq_extensions
ocsp_uri = "http://ocsp.example.com"
EOF
certtool --generate-certificate --load-request server.csr \
--load-ca-privkey ca.key --load-ca-certificate ca.crt \
--template server-extensions.conf --outfile server.crt
Trust
Enterprise Linux …ca-certificates
package 5…
- …upstream project CA certificates chosen by the Mozilla Foundation
- …basically includes well-known CA certificates found in Firefox
Trust model based on hierarchy… root CAs at the top …trusted by default
- Trust Anchors …root CA certificates are known as trust anchors
- Trust chain …verifies end-entity certificates
- …signed by a trusted CA (directly or intermediate CA)
- …checks validity (not expired or revoked)
- …ensures that the certificate matches the domain
trust
# …verify the trust status
trust list --filter=ca-anchors | grep 'label: '
# Store a certificate in the trust-source directory
trust anchor --store $cert
update-ca-trust
# Remove a certificate from the trust-source directory
trust anchor --remove $cert
update-ca-trust
update-ca-trust
Command update-ca-trust
configures CA certificates and associated trust
- Add certificates (PEM format) to a trust anchors source directories…
/etc/pki/ca-trust/source/anchors
…high priority/usr/share/pki/ca-trust-source/
…low priority- …define untrusted CAs in
/etc/pki/ca-trust/source/blocklist/
update-ca-trust extract
based on the source configuration…- …generates
/etc/pki/ca-trust/extracted/
- …generates
Footnotes
Let’s Encrypt
https://letsencrypt.org↩︎Certbot, Electronic Frontier Foundation
https://certbot.eff.org
https://github.com/certbot/certbot↩︎OpenSSL
https://www.openssl.org/docs↩︎CA Certificates, Fedora Wiki
https://fedoraproject.org/wiki/CA-Certificates↩︎