Revisit certificate identity verification in OpenSSL::SSL
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 8/100
- Issue 類型
- 功能
- 描述清晰度
- 需要釐清
- 活躍度
- 活躍
研究方向
Start with the three entry points named in the issue and the current implementation in lib/openssl/ssl.rb around lines 293-375. Read RFC 9525 and the linked PR #12 before deciding whether to remove partial wildcards and CN fallback, and whether to delegate to OpenSSL X509_VERIFY_PARAM or X509_check_host/X509_check_ip. This is a design discussion, so “done” means maintainers agree on the matching rules and the DNS/IP interface before any patch is written.
由索引模型根據 Issue 內容生成。
描述
In 2015, https://github.com/ruby/openssl/pull/12 updated the certificate identity checking logic in ruby/openssl to follow RFC 6125, as a fix for https://bugs.ruby-lang.org/issues/9644.
We currently have 3 entry points for this check:
- During certificate chain validation, as part of
verify_callback, whenOpenSSL::SSL::SSLContext#verify_hostnameis enabled andOpenSSL::SSL::SSLSocket#hostname=(the SNI hostname) has been set OpenSSL::SSL::SSLSocket#post_connection_check(string), which can be called after#connectfinishesOpenSSL::SSL.verify_certificate_identity(cert, string)(undocumented, thoughgem-codesearchshows several usages)
Matching rules
Should we adopt the RFC 9525 rules? RFC 9525 was published in 2023-11, obsoleting RFC 6125:
https://www.rfc-editor.org/rfc/rfc9525
It removed rules that have long been deprecated:
- The subject Common Name (CN-ID) is no longer checked. Major browsers and libraries have already stopped checking it:
- Firefox 48 (2016): https://bugzilla.mozilla.org/show_bug.cgi?id=1245280
- Google Chrome 58 (2017): https://issues.chromium.org/issues/40078252
- Go 1.15 (2020) disabled it by default in crypto/tls: https://go.dev/doc/go1.15#commonname
- curl plans to remove CN fallback: https://github.com/curl/curl/pull/23986
- This mentions a breaking change in OpenSSL 4.1 that weakened certificate validation compared to OpenSSL 4.0. This also affects ruby/openssl: https://github.com/openssl/openssl/issues/33890
[ Checking DNS name constraints against subject CN started in OpenSSL 1.1.0, apparently: https://github.com/openssl/openssl/commit/5bd5dcd49605ca2aa7931599894302a3ac4b0b04 ]
- This mentions a breaking change in OpenSSL 4.1 that weakened certificate validation compared to OpenSSL 4.0. This also affects ruby/openssl: https://github.com/openssl/openssl/issues/33890
- Partial wildcards such as
abc*.example.comare no longer allowed. Browsers removed support in 2015:- Firefox 37 (2015): https://bugzilla.mozilla.org/show_bug.cgi?id=1107791
- Google Chrome 41 (2015): https://issues.chromium.org/issues/41143943
I think it's safe to remove support for partial wildcards.
Should we drop CN fallback, too?
Interface
The interface should allow users to specify whether the input is matched as a DNS host name or an IP address, since a plain string is ambiguous.
OpenSSL::SSL::SSLContext#verify_hostname is tied to SSLSocket#hostname=, which primarily is for SNI. This makes it unusable when connecting to an IP address, because IP addresses cannot be sent in SNI. This forces users to resort to an ugly workaround, as seen in net-http:
Implementation
We currently implement the identity check in Ruby because OpenSSL did not provide such a feature prior to OpenSSL 1.0.2.
ruby/openssl now requires OpenSSL 1.1.1 or later. Can we delegate this to X509_VERIFY_PARAM or X509_check_{host,ip}()?
- 主要語言
- C
- 星號
- 276
- 分支
- 208
- 平均合併
- 1 天 1 小時
- 30 天內合併 PR
- 20
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
ruby/openssl 的其他 Issue
-
SSLSocket#syswrite no longer raises IOError after IO#close可能已有人在做 @sourya2704 於 4 天前認領。 未關閉
難度 4/5 3-5 天 新手友好度 55/100
維護者通常 1 天內回覆
-
Add OpenSSL::SSL::SSLContext#client_hello_cb= (binding for SSL_CTX_set_client_hello_cb())可能已有人在做 @kou 於 45 天前認領。 未關閉
難度 4/5 3-5 天 新手友好度 53/100
維護者通常 1 天內回覆
-
Documenting how to use OpenSSL::SSL::SSLContext in PQC use cases可能已有人在做 @junaruga 於 32 天前認領。 未關閉
難度 3/5 1-2 天 新手友好度 55/100
維護者通常 1 天內回覆
-
Expose XOFs like SHAKE128 and SHAKE256可能已有人在做 @rhenium 於 142 天前認領。 未關閉
難度 4/5 3-5 天 新手友好度 48/100
維護者通常 1 天內回覆
-
難度 5/5 一週以上 新手友好度 35/100
維護者通常 1 天內回覆
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 82/100
Polprzewodnikowy/N64FlashcartMenu#486 · 3 則留言 ·
-
category:port-update
難度 2/5 1-3 小時 新手友好度 64/100
維護者通常 2 天內回覆
-
crash
難度 2/5 1-3 小時 新手友好度 64/100
-
bug
難度 2/5 1-3 小時 新手友好度 83/100
tree-sitter/tree-sitter-c#338 ·
-
難度 2/5 1-3 小時 新手友好度 76/100