Skip to content
Open
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
6 changes: 6 additions & 0 deletions lib/lumberjack/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def initialize(opts={})
:port => 0,
:addresses => [],
:ssl_certificate => nil,
:ssl_ca_file => nil,
:ssl => true,
:json => false,
}.merge(opts)
Expand Down Expand Up @@ -59,6 +60,7 @@ class Socket
# * :ssl_certificate - the path to the ssl cert to use.
# If ssl_certificate is not set, a plain tcp connection
# will be used.
#* :ssl_ca_file - The path to a file containing a PEM-format CA certificate
attr_reader :sequence
attr_reader :host
def initialize(opts={})
Expand All @@ -68,6 +70,7 @@ def initialize(opts={})
:port => 0,
:address => "127.0.0.1",
:ssl_certificate => nil,
:ssl_ca_file => nil,
:ssl => true,
:json => false,
}.merge(opts)
Expand All @@ -89,6 +92,9 @@ def connection_start(opts)

ssl_context = OpenSSL::SSL::SSLContext.new
ssl_context.verify_mode = OpenSSL::SSL::VERIFY_PEER
if opts[:ssl_ca_file]
ssl_context.ca_file = opts[:ssl_ca_file]
end
ssl_context.cert_store = certificate_store

@socket = OpenSSL::SSL::SSLSocket.new(tcp_socket, ssl_context)
Expand Down