lib/r7_insight/host/connection.rb in r7insight-3.0.2 vs lib/r7_insight/host/connection.rb in r7insight-3.0.3
- old
+ new
@@ -186,12 +186,20 @@
cert_store.set_default_paths
ssl_context = OpenSSL::SSL::SSLContext.new
ssl_context.cert_store = cert_store
- ssl_context.min_version = OpenSSL::SSL::TLS1_1_VERSION
- # For older versions of openssl (prior to 1.1.1) missing support for TLSv1.3
- ssl_context.max_version = defined?(OpenSSL::SSL::TLS1_3_VERSION) ? OpenSSL::SSL::TLS1_3_VERSION : OpenSSL::SSL::TLS1_2_VERSION
+ if OpenSSL::SSL::SSLContext.method_defined? :min_version=
+ ssl_context.min_version = OpenSSL::SSL::TLS1_1_VERSION
+ end
+ if OpenSSL::SSL::SSLContext.method_defined? :max_version=
+ # For older versions of openssl (prior to 1.1.1) missing support for TLSv1.3
+ ssl_context.max_version = if defined?(OpenSSL::SSL::TLS1_3_VERSION)
+ OpenSSL::SSL::TLS1_3_VERSION
+ else
+ OpenSSL::SSL::TLS1_2_VERSION
+ end
+ end
ssl_context.verify_mode = OpenSSL::SSL::VERIFY_PEER
ssl_socket = OpenSSL::SSL::SSLSocket.new(socket, ssl_context)
ssl_socket.hostname = host if ssl_socket.respond_to?(:hostname=)
ssl_socket.sync_close = true
Timeout.timeout(10) do