ruby / ruby/net-imap

🔒 Support `SCRAM-*-PLUS` with channel binding

Open
#487 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

SASL :lock:
Dominant language
Ruby
Stars
118
Forks
43
Avg merge
1d 23h
Merged PRs (30d)
26

Description

To use channel binding and SCRAM-SHA-256-PLUS, I just made the following subclass. Sharing in case helpful for a broader implementation of -PLUS authenticators.

class ScramSHA256PlusAuthenticator < Net::IMAP::SASL::ScramSHA256Authenticator
  def initialize(*args, **options)
    super(*args, **options)
    @ssl_cert = options[:ssl_cert]
  end

  def gs2_cb_flag
    "p=tls-server-end-point"
  end

  def cbind_input
    cert_algo_raw = @ssl_cert.signature_algorithm
    cert_algo = OpenSSL::Digest.new(cert_algo_raw).name # standardize e.g. sha256WithRSAEncryption to SHA256
    sasl_algo = cert_algo == "MD5" || cert_algo == "SHA1" ? "SHA256" : cert_algo
    hash = OpenSSL::Digest.digest(sasl_algo, @ssl_cert.to_der)
    "#{gs2_header}#{hash}"
  end
end

The ssl_cert option to ScramSHA256PlusAuthenticator.new should be passed ssl_server_socket.peer_cert.

Originally posted by @jawj in #54

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Net::IMAP::SASL::ScramSHA256Authenticator and compare it with the proposed ScramSHA256PlusAuthenticator subclass. Trace how ssl_server_socket.peer_cert could provide the certificate, then identify the existing SASL authentication tests or entry points to extend. Done means SCRAM-SHA-*-PLUS authenticators support channel binding using the peer certificate.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
authentication, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.