openssl工具无法从CloudFront获得证书,有谁知道为什么?

我写一个脚本来检查所有我的域的SSL到期date。

这适用于我的正常站点:

echo | openssl s_client -connect $domain:443 2> /dev/null | openssl x509 -noout -enddate

但是,它不适用于AWS CloudFront。 我已经将自己的证书上传到CF,并使用CNAME。

输出是:

 CONNECTED(00000003) 15336:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure 

有谁知道为什么?

我已经尝试了-ssl2-no_ssl3选项。

谢谢!

添加-servername $domain固定它:

openssl s_client -connect $domain:443 -servername $domain 2> /dev/null < /dev/null | openssl x509 -noout -enddate

非常感谢Steffen Ullrich对Q的评论。