Jak wygenerować certyfikat SSL.

1) Generujemy klucz prywatny RSA o długosci 2048 bitów:

openssl genrsa -out private.key 2048

2) Jeśli to potrzebne, generujemy opcjonalny certyfikat jednostki wlasnej (dla self-sign):

openssl req -new -x509 -days 3650 -key private.key -out private.crt

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:PL
State or Province Name (full name) [Some-State]:Slaskie
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) []:Adam Kubica
Email Address []:caffecoder@kaizen-step.com

3) Generujemy CSR (Certificate Signing Request) dla domeny:

openssl req -new -key private.key -out kaizen-step.com.csr

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:PL
State or Province Name (full name) [Some-State]:Slaskie
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:KAIZEN-STEP.COM
Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) []:*.kaizen-step.com
Email Address []:support@kaizen-step.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

Wyświetlenie informacji na temat wygenerowanego CSR:

openssl req -text -noout -verify -in kaizen-step.com.csr

4) Opcjonalny self-signed jeśli nie kupujemy:

openssl x509 -req -days 3650 -in kaizen-step.com.csr -CA private.crt -CAkey private.key -set_serial 01 -out kaizen-step.com.crt

5) Informacje o certyfikacie:

openssl x509 -noout -text -in kaizen-step.com.crt

6) Generujemy plik PEM:

Jeśli mamy certyfikat self-signed:

cat kaizen-step.com.crt private.crt > kaizen-step.com.pem

Jeśli mamy certyfikat od wystawcy:

cat kaizen-step.com.crt intermediate_certificate.crt > kaizen-step.com.pem

Napisano dnia: r.