Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditionally add aliases for TLS 1.3 constants #653

Merged
merged 2 commits into from
Jan 25, 2023
Merged

Conversation

michaelklishin
Copy link
Member

so that the module does not fail to load on/with older OpenSSL versions that do not support TLS 1.3.

References #629, #646.

Closes #652.

so that the module does not fail to load on/with older OpenSSL
versions that do not support TLS 1.3.

References #629, #646.

Closes #652.
@michaelklishin michaelklishin added this to the 2.20.3 milestone Jan 25, 2023
@michaelklishin
Copy link
Member Author

I could not get hold of an environment that would have

  • Ruby 2.6 or 2.7, and
  • An OpenSSL version that does not support TLS 1.3 (so, OpenSSL 1.0.x?)

but if I extend the same idea to a hypothetical future version by adding one more snippet:

if defined?(OpenSSL::SSL::TLS1_4_VERSION)
  TLS_VERSION_ALIASES["1.4"]                        = OpenSSL::SSL::TLS1_4_VERSION
  TLS_VERSION_ALIASES[:TLSv1_4]                     = OpenSSL::SSL::TLS1_4_VERSION
  TLS_VERSION_ALIASES[OpenSSL::SSL::TLS1_4_VERSION] = OpenSSL::SSL::TLS1_4_VERSION
end

the module still loads successfully.

@michaelklishin
Copy link
Member Author

@dup2 @arashm @tindron @doconnor-clintel can you please try this PR in your environments where OpenSSL does not provide TLS 1.3 support?

@tindron
Copy link

tindron commented Jan 25, 2023

@dup2 @arashm @tindron @doconnor-clintel can you please try this PR in your environments where OpenSSL does not provide TLS 1.3 support?

The earlier lines referencing OpenSSL::SSL::TLS1_3_VERSION are still present:

randy@randy-VirtualBox:~/git/bunny$ rspec spec/unit/bunny_spec.rb 

An error occurred while loading ./spec/unit/bunny_spec.rb.
Failure/Error: TLSv1_3: OpenSSL::SSL::TLS1_3_VERSION,

NameError:
  uninitialized constant OpenSSL::SSL::TLS1_3_VERSION
  Did you mean?  OpenSSL::SSL::TLS1_1_VERSION
                 OpenSSL::SSL::TLS1_2_VERSION
                 OpenSSL::SSL::TLS1_VERSION
                 OpenSSL::SSL::SSL3_VERSION
# ./lib/bunny/transport.rb:34:in `<class:Transport>'

@michaelklishin
Copy link
Member Author

@tindron good catch. I've removed them. Please try again?

@tindron
Copy link

tindron commented Jan 25, 2023

@tindron good catch. I've removed them. Please try again?

Looks good! 👍

@michaelklishin michaelklishin merged commit 3406ebb into main Jan 25, 2023
@michaelklishin michaelklishin deleted the bunny-652 branch January 25, 2023 19:43
@dup2
Copy link

dup2 commented Jan 25, 2023

Thanks for this 👍

@michaelklishin michaelklishin modified the milestone: 2.20.3 Jan 26, 2023
@michaelklishin
Copy link
Member Author

Out in 2.20.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Conditionally alias constants for TLSv1.3 to support older OpenSSL releases
3 participants