Skip to content

Commit

Permalink
Ability to use ssl_min_version and/or ssl_max_version instead of ssl_…
Browse files Browse the repository at this point in the history
…method
  • Loading branch information
emiran-orange committed Feb 2, 2024
1 parent b53d005 commit 9476f23
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/remote_syslog_sender/tcp_sender.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ def initialize(remote_hostname, remote_port, options = {})
@remote_hostname = remote_hostname
@remote_port = remote_port
@ssl_method = options[:ssl_method] || 'TLSv1_2'
@ssl_min_version = options[:ssl_min_version]
@ssl_max_version = options[:ssl_max_version]
@ca_file = options[:ca_file]
@verify_mode = options[:verify_mode]
@timeout = options[:timeout] || 600
Expand Down Expand Up @@ -63,7 +65,13 @@ def connect
end
if @tls
require 'openssl'
context = OpenSSL::SSL::SSLContext.new(@ssl_method)
context = OpenSSL::SSL::SSLContext.new()
if not (@ssl_min_version || @ssl_max_version)
context.min_version = @ssl_min_version
context.max_version = @ssl_max_version
else
context.ssl_version = @ssl_method
end
context.ca_file = @ca_file if @ca_file
context.verify_mode = @verify_mode if @verify_mode

Expand Down

0 comments on commit 9476f23

Please sign in to comment.