個人で所有しているドメイン toycode.com のワイルドカード証明書の期限が近づいてきたので新しい物を購入しました。
最近は Let's Encrypt があるので SSL 証明書を自前でもっているメリットは少なくないのですが、それでもワイルドカード証明書を一つ用意しておくと色々実験したりするのに便利です。
前回は namecheap という所から買いましたが、今回はさらに安く買える所がないか調べてみました。
SSL2BUY という所が 2年で $80 (9000円程度) なので、ここで購入することにしました。
なお、日本語で展開しているところは例えば SSLストア だと2年で3万5000円、サイフにやさしいSSL証明書だと 4万4800円 と高いです。
基本的には持っているドメインの admin 等のメールアドレスか、ドメインの whois に登録されているメールアドレスがあれば、
あとはメールと Web サイトの指示に従っていけば良いのですが、CSR と private key は手元で作成する必要があります。
CSR と private key は openssl がインストールされていれば以下のようにして作成することが出来ます。
$ openssl req -new -newkey rsa:2048 -nodes -keyout toycode.key -out toycode.csr
Generating a 2048 bit RSA private key
...............................+++
.........................+++
writing new private key to 'toycode.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) [AU]:JP
State or Province Name (full name) [Some-State]:Tokyo
Locality Name (eg, city) []:Shinjuku
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Hiroshi Okada
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:*.toycode.com
Email Address []:okadahiroshi@miobox.jp
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
なお、SSL の証明書は XXXXXXX: Your SSL Certificate for *.toycode.com has been issued
のような題名の email で送られてきて、添付ファイルでなく、本文中の末尾に
-----BEGIN CERTIFICATE-----
... 30行以上の文字列...
-----END CERTIFICATE-----
というふうに書かれれいるので、この部分をコピペして、例えば toycode.cer
みたいなファイルに保管します。
SSL サーバの起動にはこのファイルと先ほど作ったキーファイル (上記の例だと toycode.key
) が必要です。