Module: SSLkeylog::Trace

Defined in:
lib/sslkeylog/trace.rb

Overview

This module provides methods for tracing SSL connections

Currently, tracing is only implemented for client connections. Tracing of connections accepted by servers is not implemented. Tracing is implemented using the Ruby 2.x TracePoint API.

Constant Summary collapse

CLIENT_TRACER =

A TracePoint that watches SSL client connections

This tracepoint watches for returns from OpenSSL::SSL::SSLSocket#connect and logs the pre master secret to the logger returned by Logging.logger. Messages are logged at info level.

Returns:

  • (TracePoint)
TracePoint.new(:c_return) do |tp|
  if tp.method_id == :connect && tp.defined_class == ::OpenSSL::SSL::SSLSocket
    ssl_info = ::SSLkeylog::OpenSSL.to_keylog(tp.self)
    ::SSLkeylog::Logging.logger.info(ssl_info) unless ssl_info.nil?
  end
end

Class Method Summary collapse

Class Method Details

.disablevoid

This method returns an undefined value.

Disable tracing of SSL connections



35
36
37
# File 'lib/sslkeylog/trace.rb', line 35

def self.disable
  CLIENT_TRACER.disable
end

.enablevoid

This method returns an undefined value.

Enable tracing of SSL connections



28
29
30
# File 'lib/sslkeylog/trace.rb', line 28

def self.enable
  CLIENT_TRACER.enable
end