linux:verschluesselung:openssl
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
linux:verschluesselung:openssl [2024/02/17 19:03] – external edit 127.0.0.1 | linux:verschluesselung:openssl [2025/05/06 11:48] (current) – gsys | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== OpenSSL ====== | ====== OpenSSL ====== | ||
+ | |||
===== Nützliche Befehle ===== | ===== Nützliche Befehle ===== | ||
< | < | ||
- | update-ca-certificates --fresh | + | update-ca-certificates --fresh |
+ | |||
+ | openssl x509 -in mail.example.com.pem -noout -text # Check contents of cert file | ||
+ | |||
+ | openssl s_client -connect mail.example.com: | ||
+ | openssl s_client -connect mail.example.com: | ||
+ | openssl s_client -connect mail.example.com: | ||
</ | </ | ||
===== CSR erstellen ===== | ===== CSR erstellen ===== | ||
Line 65: | Line 72: | ||
===== Zertifikate konvertieren ===== | ===== Zertifikate konvertieren ===== | ||
+ | |||
+ | ==== Reihenfolge einer Chain ==== | ||
+ | Optimal: | ||
+ | < | ||
+ | -----BEGIN CERTIFICATE----- | ||
+ | [Server Certificate] | ||
+ | -----END CERTIFICATE----- | ||
+ | -----BEGIN CERTIFICATE----- | ||
+ | [Intermediate certificate L1] | ||
+ | -----END CERTIFICATE----- | ||
+ | -----BEGIN CERTIFICATE----- | ||
+ | [Intermediate certificate L2] | ||
+ | -----END CERTIFICATE----- | ||
+ | </ | ||
+ | Unnötig da Root in Browser/OS Cert store bereits enthalten: | ||
+ | < | ||
+ | -----BEGIN CERTIFICATE----- | ||
+ | [Server Certificate] | ||
+ | -----END CERTIFICATE----- | ||
+ | -----BEGIN CERTIFICATE----- | ||
+ | [Intermediate certificate L1] | ||
+ | -----END CERTIFICATE----- | ||
+ | -----BEGIN CERTIFICATE----- | ||
+ | [Intermediate certificate L2] | ||
+ | -----END CERTIFICATE----- | ||
+ | -----BEGIN CERTIFICATE----- | ||
+ | [Root Certificate] | ||
+ | -----END CERTIFICATE----- | ||
+ | </ | ||
+ | https:// | ||
+ | https:// | ||
+ | |||
+ | ==== Befehle ==== | ||
+ | |||
+ | '' | ||
+ | |||
+ | FIXME PEM vs CRT | ||
< | < | ||
openssl pkcs12 -export -in cert_bundle.pem -inkey privkey.key -out cert_bundle.p12 #pem in p12 | openssl pkcs12 -export -in cert_bundle.pem -inkey privkey.key -out cert_bundle.p12 #pem in p12 | ||
cat cert.pem intermediate.pem > chain.pem | cat cert.pem intermediate.pem > chain.pem | ||
cat root.pem intermediate.pem > ocsp-chain.pem | cat root.pem intermediate.pem > ocsp-chain.pem | ||
- | openssl pkcs12 -in cert_bundle.p12 -clcerts | + | openssl pkcs12 -in cert_bundle.p12 -chain -nokeys -out cert_bundle.pem |
+ | openssl pkcs12 -in cert_bundle.p12 -cacerts -nokeys -out cert_cacerts.pem | ||
+ | openssl pkcs12 -in cert_bundle.p12 -clcerts -nokeys -out cert.pem | ||
openssl pkcs12 -in cert_bundle.p12 -nocerts -out privkey_encr.key | openssl pkcs12 -in cert_bundle.p12 -nocerts -out privkey_encr.key | ||
openssl rsa -in privkey_encr.key -out privkey.key | openssl rsa -in privkey_encr.key -out privkey.key | ||
openssl x509 -inform der -in certificate.cer -out certificate.pem | openssl x509 -inform der -in certificate.cer -out certificate.pem | ||
openssl pkcs7 -inform der -in cacert.p7b -out cacert.pem | openssl pkcs7 -inform der -in cacert.p7b -out cacert.pem | ||
+ | </ | ||
+ | |||
+ | Permissions | ||
+ | < | ||
+ | chmod 700 private | ||
+ | chmod 600 private.key | ||
+ | chmod 755 certs #public certs folder | ||
+ | chmod 644 cert.pem | ||
</ | </ | ||
linux/verschluesselung/openssl.1708193020.txt.gz · Last modified: 2024/02/17 19:03 by 127.0.0.1