Skip to content

Adding support for configurable TLS version #164

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/webrick/ssl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ module Config
:SSLVerifyClient => ::OpenSSL::SSL::VERIFY_NONE,
:SSLVerifyDepth => nil,
:SSLVerifyCallback => nil, # custom verification
:SSLMinVersion => OpenSSL::SSL::TLS1_VERSION,
:SSLMaxVersion => OpenSSL::SSL::TLS1_2_VERSION,
:SSLTimeout => nil,
:SSLOptions => nil,
:SSLCiphers => nil,
Expand Down Expand Up @@ -201,6 +203,8 @@ def setup_ssl_context(config) # :nodoc:
ctx.verify_mode = config[:SSLVerifyClient]
ctx.verify_depth = config[:SSLVerifyDepth]
ctx.verify_callback = config[:SSLVerifyCallback]
ctx.min_version = config[:SSLMinVersion]
ctx.max_version = config[:SSLMaxVersion]
ctx.servername_cb = config[:SSLServerNameCallback] || proc { |args| ssl_servername_callback(*args) }
ctx.timeout = config[:SSLTimeout]
ctx.options = config[:SSLOptions]
Expand Down
9 changes: 9 additions & 0 deletions test/webrick/test_ssl_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ def test_self_signed_cert_server
)
end

def test_tls1_3
assert_self_signed_cert(
:SSLEnable => true,
:SSLCertName => [["C", "JP"], ["O", "www.ruby-lang.org"], ["CN", "Ruby"]],
:SSLMinVersion => OpenSSL::SSL::TLS1_3_VERSION,
:SSLMaxVersion => OpenSSL::SSL::TLS1_3_VERSION
)
end

def test_self_signed_cert_server_with_string
assert_self_signed_cert(
:SSLEnable => true,
Expand Down