SSL取得・更新のためのCSR作成手順

いざ更新するときによく忘れるのでめも。

# 一応バージョンを確認しておく
openssl version

# CSRを生成するフォルダに移動(フォルダは事前に作成しておく)
/Users/jba_mn2000002/Desktop/csr

# 秘密鍵を作成(以下ファイル名はsample2022として作成)
openssl genrsa -des3 -out sample2022.key.org 2048
.
.
Enter pass phrase for sample2022.key.org: (任意のパスフレーズを入力)
Verifying - Enter pass phrase for sample2022.key.org: (上記と同じものを入力)

# 作成した.keyファイルのパスフレーズを解除
openssl rsa -in sample2022.key.org -out sample2022.key

# 上記で指定したパスフレーズを入力
Enter pass phrase for sample2022.key.org: (設定したパスフレーズを入力)

# CSRファイルを作成
openssl req -new -key sample2022.key -out sample2022.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]:JP //2文字国コード
State or Province Name (full name) [Some-State]:Osaka //所在地の都道府県名
Locality Name (eg, city) []:Osaka-city //所在地の市区町村名
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Sample inc. //組織、会社名
Organizational Unit Name (eg, section) []: //部署部門名(入力は任意)
Common Name (e.g. server FQDN or YOUR name) []:sample.com //SSLを適用するドメイン
Email Address []: //入力不要

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

ディレクトリ以下、下記のファイルが生成されていれば成功。

sample2022.key.org
sample2022.key
sample2022.csr ←これがCSRファイル

(念のため)CSRの内容を確認するコマンドは下記。

openssl req -text -noout -in sample2022.csr