openssl
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| openssl [2024/03/19 08:50] – A User Not Logged in | openssl [2025/04/08 12:41] (current) – [Trust self signed certs] ealmr | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== |
| + | Debian based: | ||
| - | create root private key with password protected: | + | cp $DOMAIN_CRT / |
| + | update-ca-certificates | ||
| - | openssl genpkey | + | Arch Linux: |
| + | |||
| + | trust anchor $DOMAIN_CRT | ||
| + | #to trust non CA cert, see https:// | ||
| + | sed -i ' | ||
| + | update-ca-trust | ||
| + | |||
| + | Alpine: | ||
| + | |||
| + | cp $DOMAIN_CRT / | ||
| + | update-ca-certificates | ||
| + | ls -la / | ||
| + | |||
| + | ====== General commands ====== | ||
| create root private key with password protected: | create root private key with password protected: | ||
| openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits: | openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits: | ||
| - | | ||
| show private key info: | show private key info: | ||
| Line 19: | Line 33: | ||
| openssl pkey -in root.key -pubout -out root-public.key | openssl pkey -in root.key -pubout -out root-public.key | ||
| | | ||
| - | resign from existing | + | sign root CA with new private key: |
| - | openssl x509 -in old-root-cert.crt -out new-root-cert.crt -signkey root.key -days 3650 -copy_extensions copyall | + | openssl x509 -in root.crt -signkey root.key -days 3650 |
| + | |||
| + | add self self signed to trust store: | ||
| + | |||
| + | # save to /etc/ca-certificates/ | ||
| + | sudo trust anchor <path to crt> | ||
| | | ||
| - | create | + | |
| + | ====== Sign fake domain ====== | ||
| + | |||
| + | create | ||
| + | |||
| + | openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits: | ||
| + | openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits: | ||
| + | openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits: | ||
| | | ||
| - | openssl req -new -config fd.cnf -key fd.key -out fd.csr | + | creating root CSR from existing root cert: |
| - | creating CSRs from existing certificates: | + | openssl x509 -x509toreq -in " |
| + | |||
| + | generate new root cert: | ||
| - | openssl x509 -x509toreq | + | openssl x509 -req -in root.csr -out root.crt -signkey |
| + | |||
| + | creating CSRs from existing intermediate cert: | ||
| - | resign intermediate certificate from CSR: | + | openssl x509 -x509toreq -in " |
| + | |||
| + | resign intermediate certificate from CSR with root CA: | ||
| | | ||
| - | openssl x509 -req -in intermediate-cert.csr -CA new-root-cert.crt -CAkey | + | openssl x509 -req -in intermediate.csr -CA root.crt -CAkey |
| + | |||
| + | creating CSRs from existing domain cert: | ||
| - | sign root CA with new private | + | openssl x509 -x509toreq -in " |
| + | |||
| + | resign domain certificate from CSR with intermediate | ||
| + | |||
| + | openssl x509 -req -in domain.csr -CA intermediate.crt -CAkey intermediate.key -CAcreateserial -out domain.crt -copy_extensions copyall -days 3650 | ||
| + | |||
| + | resign domain certificate from CSR directly | ||
| + | |||
| + | openssl x509 -req -in domain.csr -key domain.key -out domain.crt -copy_extensions copyall -days 3650 | ||
| + | |||
| + | ====== Create cert for IP ====== | ||
| + | |||
| + | create config file req.cnf: | ||
| + | |||
| + | < | ||
| + | [req] | ||
| + | default_bits = 4096 | ||
| + | distinguished_name = req_distinguished_name | ||
| + | req_extensions = req_ext | ||
| + | prompt = no | ||
| + | |||
| + | [req_distinguished_name] | ||
| + | commonName = <IP adress> | ||
| + | |||
| + | [req_ext] | ||
| + | subjectAltName = IP:<IP address> | ||
| + | |||
| + | </ | ||
| + | |||
| + | generate key: | ||
| + | |||
| + | openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits: | ||
| + | |||
| + | generate CSR: | ||
| + | |||
| + | openssl req -new -key ip.key -out ip.csr -config req.cnfq | ||
| + | |||
| + | create cert: | ||
| - | openssl x509 -in root-certe.crt -signkey | + | openssl x509 -req -days 3650 -in ip.csr -signkey |
openssl.1710838226.txt.gz · Last modified: by A User Not Logged in
