2012年10月5日金曜日

面倒なSSLの更新手順

手順

1.CSRの生成 CSRの提出→証明書受け取り
2.証明書をインストール

1. CSRの生成

擬似乱数の情報を生成
openssl md5 * > rand.dat
(読み込み可能なファイルがあるディレクトリにて実行)

秘密鍵を作成(パスフレーズの入力を求められる)
openssl genrsa -rand rand.dat -des3 2048 > secure.example.com.key
パスフレーズなしパターン
openssl genrsa -out secure.example.com.key 2048

CSRの生成
openssl req -new -key secure.example.com.key -out secure.example.com.csr

アルファベットにて入力
Country Name (2 letter code) [GB]:JP                                 
State or Province Name (full name) [Berkshire]:Tokyo 
Locality Name (eg, city) [Newbury]: Chuo-ku 市区町村
Organization Name (eg, company) [My Company Ltd]:Company Co.,Ltd.  正式英語組織名 会社名
Organizational Unit Name (eg, section) []:○◯事業部  部門名・部署名
Common Name (eg, your name or your server's hostname) []:secure.example.com  SSL利用のドメイン
Email Address []:  

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

CSRの生成完了。
VeriSignなどにSSL証明書発行の申請(各管理画面にCSRの貼り付けなど)

内容の確認
openssl req -in secure.example.com.csr -noout -text



補足
鍵がこのままだとhttpdを起動時にパスワードが聞かれるので
自動で立ち上がらなくなる。
以下パスワード無効にする方法(自己責任で)

鍵をコピー
cp -p secure.example.com.key secure.example.com.key.org
新しく鍵を生成
openssl rsa -in secure.example.com.key.org -out secure.example.com.key
Enter pass phrase for secure.example.com.key.org:
writing RSA key

※パスフレーズが設定されているかを確認する方法
openssl rsa -in secure.example.com.key
これでパスフレーズの入力を求められないなら設定されていない


2.証明書をインストール


証明書ファイル(メール等から貼り付けて保存)
secure.example.com.cert

中間CA証明書・クロスルート設定用証明書(貼り付けて保存)
secure.example.com.ca

ssl.conf等を修正
SSLCertificateFile  /path/to/secure.example.com.cert
SSLCertificateKeyFile  /path/to/secure.example.com.key
#SSLCertificateChainFile  /path/to/secure.example.com.ca
SSLCACertificateFile  /path/to/secure.example.com.ca

以上。

参考ベリサイン
https://www.verisign.co.jp/ssl/help/install/index.html#app

0 件のコメント:

コメントを投稿