简体   繁体   English

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

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

So I am trying to get some domains certificates using: (port is first retrieved from a nmap and secondly I try to use 443)所以我正在尝试使用以下方法获取一些域证书:(首先从 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. 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。 For this subdomains and many other ones I am getting a bunch of different errors:对于这个子域和许多其他子域,我收到了一堆不同的错误:

  • [SSL: WRONG_VERSION_NUMBER] wrong version number [SSL: WRONG_VERSION_NUMBER] 错误的版本号
  • timed out时间到
  • EOF occurred in violation of protocol EOF 发生违反协议
  • [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 警报握手失败

I need to mention that for a lot of other subdomains (somewhere around 1000), everything works fine and I can get their certificate.我需要提一下,对于许多其他子域(大约 1000 个),一切正常,我可以获得他们的证书。 But for ~200 of them I am getting the errors from above repeatedly and I can not find their source on the internet.但是对于其中约 200 个,我反复从上面得到错误,我无法在互联网上找到它们的来源。

Do you happen to know why I can not use ssl.get_server_certificate on those website or where am I doing something wrong?您是否知道为什么我不能在这些网站上使用 ssl.get_server_certificate 或者我在哪里做错了什么?

Thanks!谢谢!

Most if the sites here require SNI.大多数如果这里的网站需要 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 . 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 . It is finally solved with 3.10:终于用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
...

For older Python versions see the answers to this question on how to get the certificate without using ssl.get_server_certificate .对于较旧的 Python 版本,请参阅此问题的答案,了解如何在不使用ssl.get_server_certificate的情况下获取证书。

As for smg20.redbull.com and ssmg11-q.redbull.com - these sites do not seem to be reachable from the internet in the first place, ie they are also not accessible by other tools or the browser.至于 smg20.redbull.com 和 ssmg11-q.redbull.com - 首先似乎无法从互联网访问这些站点,即其他工具或浏览器也无法访问它们。

暂无
暂无

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

相关问题 Python ssl.get_server_certificate 下载错误的证书? - Python ssl.get_server_certificate downloads wrong certificate? python的ssl.get_server_certificate安全吗? - Is python's ssl.get_server_certificate safe? 具有SNI的站点的ssl.get_server_certificate(服务器名称指示) - ssl.get_server_certificate for sites with SNI (Server Name Indication) Python Twisted:SSL例程,ssl3_get_server_certificate错误 - Python Twisted : SSL routines , ssl3_get_server_certificate errors 在python中抑制'SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败'错误 - Suppress 'SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed' errors in python url open 在某些网站上返回错误,而在其他网站上则没有 - url open returns errors on some websites and not others 身份验证失败:[Errno 1] _ssl.c:510:错误:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败 - Authentication failed: [Errno 1] _ssl.c:510: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed SSL错误:例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败 - SSL error : routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed SSLError:[Errno 1] _ssl.c:510:错误:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败 - SSLError: [Errno 1] _ssl.c:510: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed Python-SSL客户端/服务器证书 - Python - SSL Client/Server Certificate
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM