簡體   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