Spikker¶
Kõik vajalikud käsud ühes kohas.
OpenSSL käsud¶
Sertifikaadi info¶
Bash
# Vaata sertifikaadi sisu
openssl x509 -in cert.crt -text -noout
# Kontrolli aegumist
openssl x509 -in cert.crt -noout -dates
# Vaata SAN välja
openssl x509 -in cert.crt -noout -text | grep -A1 "Subject Alternative Name"
Serveri kontrollimine¶
Bash
# Kontrolli serverit
openssl s_client -connect example.com:443 -servername example.com
# Näita sertifikaadiahel
openssl s_client -connect example.com:443 -showcerts
# Kontrolli protokolle
openssl s_client -connect example.com:443 -tls1_2
openssl s_client -connect example.com:443 -tls1_3
Võtme ja sertifikaadi vastavus¶
Bash
# Kas võti ja sert klapivad?
openssl x509 -noout -modulus -in cert.crt | md5sum
openssl rsa -noout -modulus -in key.key | md5sum
# Peavad olema samad!
Formaatide teisendamine¶
Sertifikaadi loomine¶
Ise-allkirjastatud (testimiseks)¶
Bash
# Ühe käsuga
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem \
-days 365 -nodes -subj "/CN=localhost"
CSR + allkirjastamine¶
Bash
# Genereeri võti
openssl genrsa -out server.key 2048
# Loo CSR
openssl req -new -key server.key -out server.csr -subj "/CN=example.com"
# Allkirjasta CA-ga
openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key \
-CAcreateserial -out server.crt -days 365
Vault käsud¶
Bash
# Login
export VAULT_ADDR='http://127.0.0.1:8200'
vault login
# PKI väljastamine
vault write pki/issue/webserver common_name="example.com"
# Sertifikaadi tühistamine
vault write pki/revoke serial_number="..."
Kasulikud tööriistad¶
| Tööriist | URL | Otstarve |
|---|---|---|
| SSL Labs | ssllabs.com/ssltest | Serveri testimine |
| crt.sh | crt.sh | CT logide otsing |
| badssl.com | badssl.com | TLS testimine |
Levinud vead¶
Certificate has expired
Sertifikaat on aegunud. Kontrolli: openssl x509 -in cert.crt -noout -dates
Hostname mismatch
Sertifikaadi nimi ei klapi. Kontrolli SAN välja.
Unable to get local issuer certificate
Ahel on katki - vahesertifikaat puudub.
Key values mismatch
Võti ja sertifikaat ei kuulu kokku. Kontrolli modulus hash'e.