Skip to content

Commit 32707b2

Browse files
authored
Support :SSL{Min,Max}Version config options
These are necessary to get the tests passing with LibreSSL 3.8.1+, which dropped support for TLSv1.0 and TLSv1.1 for security reasons. This updates the tests to use TLSv1.2 on OpenBSD. This is only strictly necessary on OpenBSD 7.4+, but it will work fine in previous versions as well.
1 parent 1afe6a9 commit 32707b2

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

lib/drb/ssl.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ class SSLConfig
7373
# :SSLTmpDhCallback ::
7474
# A DH callback. See OpenSSL::SSL::SSLContext.tmp_dh_callback
7575
#
76+
# :SSLMinVersion ::
77+
# This is the minimum SSL version to allow. See
78+
# OpenSSL::SSL::SSLContext#min_version=.
79+
#
80+
# :SSLMaxVersion ::
81+
# This is the maximum SSL version to allow. See
82+
# OpenSSL::SSL::SSLContext#max_version=.
83+
#
7684
# :SSLVerifyMode ::
7785
# This is the SSL verification mode. See OpenSSL::SSL::VERIFY_* for
7886
# available modes. The default is OpenSSL::SSL::VERIFY_NONE
@@ -208,6 +216,8 @@ def setup_ssl_context
208216
ctx = ::OpenSSL::SSL::SSLContext.new
209217
ctx.cert = @cert
210218
ctx.key = @pkey
219+
ctx.min_version = self[:SSLMinVersion]
220+
ctx.max_version = self[:SSLMaxVersion]
211221
ctx.client_ca = self[:SSLClientCA]
212222
ctx.ca_path = self[:SSLCACertificatePath]
213223
ctx.ca_file = self[:SSLCACertificateFile]

test/drb/test_drbssl.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ def start
2323
config[:SSLVerifyCallback] = lambda{ |ok,x509_store|
2424
true
2525
}
26+
if RUBY_PLATFORM.match?(/openbsd/)
27+
config[:SSLMinVersion] = OpenSSL::SSL::TLS1_2_VERSION
28+
config[:SSLMaxVersion] = OpenSSL::SSL::TLS1_2_VERSION
29+
end
2630
begin
2731
data = open("sample.key"){|io| io.read }
2832
config[:SSLPrivateKey] = OpenSSL::PKey::RSA.new(data)

test/drb/ut_array_drbssl.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ module DRbTests
2424

2525
config = Hash.new
2626
config[:SSLTmpDhCallback] = proc { DRbTests::TEST_KEY_DH1024 }
27+
if RUBY_PLATFORM.match?(/openbsd/)
28+
config[:SSLMinVersion] = OpenSSL::SSL::TLS1_2_VERSION
29+
config[:SSLMaxVersion] = OpenSSL::SSL::TLS1_2_VERSION
30+
end
2731
config[:SSLVerifyMode] = OpenSSL::SSL::VERIFY_PEER
2832
config[:SSLVerifyCallback] = lambda{|ok,x509_store|
2933
true

0 commit comments

Comments
 (0)