2015-12-30 15:31:55 +00:00
|
|
|
# openssl
|
|
|
|
|
2016-01-20 18:11:47 +00:00
|
|
|
> OpenSSL cryptographic toolkit.
|
2015-12-30 15:31:55 +00:00
|
|
|
|
2016-01-20 18:11:47 +00:00
|
|
|
- Generate a 2048bit RSA private key and save it to a file:
|
2015-12-30 15:31:55 +00:00
|
|
|
|
2016-01-20 18:11:47 +00:00
|
|
|
`openssl genrsa -out {{filename.key}} 2048`
|
2015-12-30 15:31:55 +00:00
|
|
|
|
2016-01-20 18:11:47 +00:00
|
|
|
- Generate a certificate signing request to be sent to a certificate authority:
|
2015-12-30 15:31:55 +00:00
|
|
|
|
2016-01-20 18:11:47 +00:00
|
|
|
`openssl req -new -sha256 -key {{filename.key}} -out {{filename.csr}}`
|
2015-12-30 15:31:55 +00:00
|
|
|
|
2016-01-22 22:03:08 +00:00
|
|
|
- Generate a self-signed certificate from a certificate signing request valid for some number of days:
|
2015-12-30 15:31:55 +00:00
|
|
|
|
2016-01-22 22:03:08 +00:00
|
|
|
`openssl x509 -req -days {{days}} -in {{filename.csr}} -signkey {{filename.key}} -out {{filename.crt}}`
|
2016-01-05 14:26:54 +00:00
|
|
|
|
2018-02-15 22:44:09 +00:00
|
|
|
- Display certificate information:
|
|
|
|
|
|
|
|
`openssl x509 -in {{filename.crt}} -noout -text`
|
|
|
|
|
2017-09-14 19:56:37 +01:00
|
|
|
- Display the start and expiry dates for a domain's certificate:
|
|
|
|
|
|
|
|
`openssl s_client -connect {{host}}:{{port}} 2>/dev/null | openssl x509 -noout -dates`
|
|
|
|
|
2016-01-20 18:11:47 +00:00
|
|
|
- Display the certificate presented by an SSL/TLS server:
|
2016-01-05 14:26:54 +00:00
|
|
|
|
2016-01-20 18:11:47 +00:00
|
|
|
`openssl s_client -connect {{host}}:{{port}} </dev/null`
|
2016-01-05 14:26:54 +00:00
|
|
|
|
2016-01-20 18:11:47 +00:00
|
|
|
- Display the complete certificate chain of an HTTPS server:
|
2016-01-05 14:26:54 +00:00
|
|
|
|
2016-02-10 04:58:44 +00:00
|
|
|
`openssl s_client -connect {{host}}:443 -showcerts </dev/null`
|