Revisit certificate identity verification in OpenSSL::SSL

Đang mở
#1,163 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
8/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Sôi nổi
Công nghệ
c, ruby

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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, when OpenSSL::SSL::SSLContext#verify_hostname is enabled and OpenSSL::SSL::SSLSocket#hostname= (the SNI hostname) has been set
  • OpenSSL::SSL::SSLSocket#post_connection_check(string), which can be called after #connect finishes
  • OpenSSL::SSL.verify_certificate_identity(cert, string) (undocumented, though gem-codesearch shows 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:

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.

https://github.com/ruby/openssl/blob/b5774711c1f0737cb96ca3698facb2d8b6d0ee91/lib/openssl/ssl.rb#L293-L375

ruby/openssl now requires OpenSSL 1.1.1 or later. Can we delegate this to X509_VERIFY_PARAM or X509_check_{host,ip}()?

Ngôn ngữ chính
C
Star
276
Fork
208
Merge trung bình
1 ngày 1 giờ
Pull request đã merge (30 ngày)
20

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ruby/openssl

Tất cả issue của ruby/openssl

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.