Part2と言うか、StartSSLからあと2週間で有効期限が切れるというメールが来てしまったので更新しなければいけないので来年の為にメモ!!
こちらで登録&設定方法を記述しましたが同じようにやったら問題発生!! 何が問題かと言うとセキュリティーが上がったようで、「公開鍵(CSR)が安全ではありません、やり直してください」みたいな警告が表示されてしまい更新できませんでした・・・・(TOT)
そこで、ちゃんと通る秘密鍵と公開鍵の作成方法をメモっておくことに!!
秘密鍵の生成
[root@Linux root]# cd /usr/share/ssl/certs ← フォルダ移動
[root@Linux certs]# openssl genrsa -des3 -rand randfile1:randfile2:randfile3 2048 >server. key ← 2048ビットで秘密鍵を作成
0 semi-random bytes loaded
Generating RSA private key, 2048 bit long modulus
...........+++
.......+++
e is 65537 (0x10001)
Enter pass phrase: ← パス・フレーズを入力
Verifying - Enter pass phrase: ← 再度パス・フレーズを入力
これで2048ビットの秘密鍵が完成[root@Linux certs]# openssl genrsa -des3 -rand randfile1:randfile2:randfile3 2048 >server. key ← 2048ビットで秘密鍵を作成
0 semi-random bytes loaded
Generating RSA private key, 2048 bit long modulus
...........+++
.......+++
e is 65537 (0x10001)
Enter pass phrase: ← パス・フレーズを入力
Verifying - Enter pass phrase: ← 再度パス・フレーズを入力
秘密鍵からパス・フレーズの削除
サーバー起動時にパス・フレーズを毎回要求されないように秘密鍵からパスを削除しておきます。[root@Linux certs]# openssl rsa -in server.key -out server.key ← Apache起動時にパス・フレーズを要求されないように秘密鍵からパス・フレーズを削除
Enter pass phrase for server.key: ← 秘密鍵作成時のパス・フレーズを入力
writing RSA key
これでパスフレーズが削除されましたEnter pass phrase for server.key: ← 秘密鍵作成時のパス・フレーズを入力
writing RSA key
※ server.key のアクセス権は必ず 400 に設定してください。
公開鍵の生成
[root@Linux certs]# openssl req -new -key server.key -out server.csr -sha1 ← SHA1で公開鍵を作成
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 ← 国名
State or Province Name (full name) [Some-State]:Gunma ← 都道府県名
Locality Name (eg, city) []:Maebashi-city ← 市区郡町村名
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Company-name ← 組織名
Organizational Unit Name (eg, section) []: ← 部署名(空でOK)
Common Name (eg, YOUR name) []:example.com ← ホスト名
Email Address []:email-address@example.com ← メールアドレス
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: ← 空でOK
An optional company name []: ← 空でOK
これで公開鍵の完成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 ← 国名
State or Province Name (full name) [Some-State]:Gunma ← 都道府県名
Locality Name (eg, city) []:Maebashi-city ← 市区郡町村名
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Company-name ← 組織名
Organizational Unit Name (eg, section) []: ← 部署名(空でOK)
Common Name (eg, YOUR name) []:example.com ← ホスト名
Email Address []:email-address@example.com ← メールアドレス
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: ← 空でOK
An optional company name []: ← 空でOK
あとは、できた公開鍵(CSR)をStartSSLにコピペして証明書を作成すれば完成です。 (詳しくはこちら)