当浏览器显示正确的证书时,OpenSSL返回过期的证书

我正在使用RHEL上的Certbot进行encryption,为我的服务器获取SSL。 最近我不得不更新我的证书,我做了。 一切顺利certbot更新干运行,我更新了我的证书。 现在,如果我打开这个网站,它会显示新的证书在三个月内到期,但是当我使用这个命令检查证书到期时:

echo | openssl s_client -connect mysite.com:443 2>/dev/null | openssl x509 -noout -dates 

它显示证书已经过期(旧的)。 我不知道我错过了什么? 为什么浏览器可以find正确的证书,而openssl不能?

谢谢

浏览器可能使用SNI,而你写的openssl不会。 尝试这个:

回声| openssl s_client -connect mysite.com:443 -servername mysite.com 2> / dev / null | openssl x509 -noout -dates