SSL証明書の発行手順
Webサーバとかに配置するSSL証明書。毎度手作業なので自分用にメモ。
いつも「ドメイン名.拡張子」というファイル名で秘密鍵、CSR、証明書を作っています。
作業手順
$ openssl genrsa -out example.co.jp.key 2048
$ openssl req -new -key example.co.jp.key -out example.co.jp.csr
Country Name (2 letter code) [GB]:JP State or Province Name (full name) [Berkshire]:Tokyo Locality Name (eg, city) [Newbury]:shinjuku-ku Organization Name (eg, company) [Internet Widgits Pty Ltd]:your company name Organizational Unit Name (eg, section) []: your section Common Name (eg, your name or your server's hostname) []:example.co.jp Email Address []: Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []:
CSRから自己署名で証明書を作成(本番の時は認証局にCSRを提出)。
$ openssl req -in example.co.jp.csr -key example.co.jp.key -x509 -out example.co.jp.crt
メモ
- 更新時、鍵に変更がなければCSRは使いまわせる。
- そろそろLet's Encryptについても触っておきたい。。。