コスギデンサン >> 情報系メモ >> CentOS7

SSL CSR を発行する 2016/9

秘密鍵を作成する
$ openssl genrsa -aes256 -out (秘密鍵ファイルパス) 2048
※ 要パスワード入力

秘密鍵の確認
$ openssl rsa -text -noout -in (秘密鍵のファイルパス)

CSRの作成
$ openssl req -new -key (秘密鍵ファイルパス) -out (CSRファイルパス)
Enter pass phrase for rep.kosdech.com.key:
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) [XX]:JP
State or Province Name (full name) []:Kanagawa
Locality Name (eg, city) [Default City]:Kawasaki
Organization Name (eg, company) [Default Company Ltd]:Hoge Comapany
Organizational Unit Name (eg, section) []:Hoge-Unit
Common Name (eg, your name or your server's hostname) []:host.hoge.com
Email Address []:info@hoge.com

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

CSRの確認
$ openssl req -text -noout -in (CSRのファイルパス)
※ ここで作成したCSRでSSL証明書を発行する。

パスフレーズ無し秘密鍵を生成する
$ openssl rsa -in (秘密鍵のファイルパス) -out (パス無し秘密鍵のファイルパス)

(SSL証明書が発行されたら)SSL証明書の確認
$ openssl x509 -text -noout -in (証明書のファイルパス)