SSL証明書が正しく設定されているか確認

curlコマンドで簡単に確認できます。
たまたまブラウザで見れてても、curl使うようなAPI叩く時にエラー出て、実はおかしかったとか...そんな事にならないように。

中間証明書がおかしいとこんな感じ↓↓↓

$ curl https://example.com/
url: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). The default
 bundle is named curl-ca-bundle.crt; you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

サイバートラスト社のEV[2048bit]証明書の場合、中間証明書が2つあり(apacheの場合)連結して1つのファイルに貼らなければいけないのだが、1つしか設定していなくてもブラウザでは見れていた。
しかし、コマンドを叩くと、上記のようなエラー。
正しく設定されていればコンテンツが返ってきます。


Common Nameが異なる場合はこのような感じ↓↓↓

$ curl https://staging.example.com/
curl: (51) SSL: certificate subject name 'example.com' does not match target host name 'staging.example.com'

example.comで取得してあるのに、staging.example.comでアクセスした時など