STARTTLS fails with custom certificate (mTLS)

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

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

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
ruby
Lĩnh vực
networking

Hướng nghiên cứu

Bắt đầu tại net/imap.rb:3789, nơi Net::IMAP#start_tls_session được gọi, và xem xét luồng starttls quanh net/imap.rb:1402. So sánh thiết lập TLS của nó với script TCPSocket/OpenSSL đang hoạt động và ví dụ Python imaplib trong gist được liên kết. Hoàn thành khi tái hiện được lỗi mTLS với chứng chỉ tùy chỉnh và làm cho STARTTLS hoạt động mà không phá vỡ luồng kết nối hiện có.

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

Mô tả

Hello 👋

I am running into a strange issue with Net::IMAP. I post here after trying to find a solution on the Ruby Discord server.

I'm trying to connect to an IMAP server using STARTTLS with a custom certificate.
When I call the starttls method, I get the following:

S: * OK [CAPABILITY IMAP4rev1 SASL-IR ID ENABLE IDLE LITERAL+ AUTH=EXTERNAL AUTH=PLAIN STARTTLS LOGINDISABLED] MSSPRO LPS-AUTH_CLI IMAP server ready.
C: RUBY0001 STARTTLS
S: RUBY0001 OK Begin TLS negotiation now
SSL_connect returned=1 errno=0 peeraddr=195.35.24.212:143 state=error: ssl/tls alert unexpected message (SSL alert number 10)
/Users/nathan/.local/share/mise/installs/ruby/3.4.6/lib/ruby/gems/3.4.0/gems/net-protocol-0.2.2/lib/net/protocol.rb:46:in 'OpenSSL::SSL::SSLSocket#connect_nonblock'
/Users/nathan/.local/share/mise/installs/ruby/3.4.6/lib/ruby/gems/3.4.0/gems/net-protocol-0.2.2/lib/net/protocol.rb:46:in 'Net::Protocol#ssl_socket_connect'
/Users/nathan/.local/share/mise/installs/ruby/3.4.6/lib/ruby/gems/3.4.0/gems/net-imap-0.5.10/lib/net/imap.rb:3789:in 'Net::IMAP#start_tls_session'
/Users/nathan/.local/share/mise/installs/ruby/3.4.6/lib/ruby/gems/3.4.0/gems/net-imap-0.5.10/lib/net/imap.rb:1402:in 'block in Net::IMAP#starttls'
/Users/nathan/.local/share/mise/installs/ruby/3.4.6/lib/ruby/gems/3.4.0/gems/net-imap-0.5.10/lib/net/imap.rb:3427:in 'block (2 levels) in Net::IMAP#receive_responses'
/Users/nathan/.local/share/mise/installs/ruby/3.4.6/lib/ruby/gems/3.4.0/gems/net-imap-0.5.10/lib/net/imap.rb:3426:in 'Array#each'
/Users/nathan/.local/share/mise/installs/ruby/3.4.6/lib/ruby/gems/3.4.0/gems/net-imap-0.5.10/lib/net/imap.rb:3426:in 'block in Net::IMAP#receive_responses'

I wrote a script that uses TCPSocket and OpenSSL::SSL::SSLSocket to connect to the server manually and it works fine.
I've also tried in Python with the imaplib and it works fine as well.

The three scripts are available in this gist: https://gist.github.com/4e4c52/543ea036030acc6b3d9e876a44777234

As I am trying to connect to a development server, I can provide the PKCS12 file and its password if it helps reproducing.

Ngôn ngữ chính
Ruby
Star
121
Fork
47
Merge trung bình
19 giờ 25 phút
Pull request đã merge (30 ngày)
3

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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/net-imap

Tất cả issue của ruby/net-imap

Issue tương tự

Thêm issue về Ruby

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.