繁体   English   中英

SSL 错误 ssl.get_server_certificate 在某些网站上但在其他网站上没有

[英]SSL Errors for ssl.get_server_certificate on some websites but not on others

所以我正在尝试使用以下方法获取一些域证书:(首先从 nmap 检索端口,然后我尝试使用 443)

ssl.get_server_certificate((hostname, port))

But for some domains, like the following ones(only a couple of them): q1.insightsnow.redbull.com, mib-cdn.redbull.com, internalauditdb-uux-d.redbull.com, smg20.redbull.com, ssmg11 -q.redbull.com,pm.redbull.com。 对于这个子域和许多其他子域,我收到了一堆不同的错误:

  • [SSL: WRONG_VERSION_NUMBER] 错误的版本号
  • 时间到
  • EOF 发生违反协议
  • [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 警报握手失败

我需要提一下,对于许多其他子域(大约 1000 个),一切正常,我可以获得他们的证书。 但是对于其中约 200 个,我反复从上面得到错误,我无法在互联网上找到它们的来源。

您是否知道为什么我不能在这些网站上使用 ssl.get_server_certificate 或者我在哪里做错了什么?

谢谢!

大多数如果这里的网站需要 SNI。 It was a long standing issue that SNI was not done with ssl.get_server_certificate - see ssl.get_server_certificate for sites with SNI (Server Name Indication) and Python issue 36076 . 终于用3.10解决了:

$ python3.8 -c 'import ssl; print(ssl.get_server_certificate(("q1.insightsnow.redbull.com", 443)))'
...
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)


$ python3.10 -c 'import ssl; print(ssl.get_server_certificate(("q1.insightsnow.redbull.com", 443)))'
-----BEGIN CERTIFICATE-----
MIIHnjCCBoagAwIBAgIRAPcBO50Fz5QaF+JxeyoL1vEwDQYJKoZIhvcNAQELBQAw
gZUxCzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAO
...

对于较旧的 Python 版本,请参阅此问题的答案,了解如何在不使用ssl.get_server_certificate的情况下获取证书。

至于 smg20.redbull.com 和 ssmg11-q.redbull.com - 首先似乎无法从互联网访问这些站点,即其他工具或浏览器也无法访问它们。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM