Class: RemoteSyslog::TlsEndpoint::Handler

Inherits:
EventMachine::Connection
  • Object
show all
Defined in:
lib/remote_syslog/tls_endpoint.rb

Instance Method Summary collapse

Constructor Details

#initialize(endpoint) ⇒ Handler

Returns a new instance of Handler.



6
7
8
9
# File 'lib/remote_syslog/tls_endpoint.rb', line 6

def initialize(endpoint)
  @endpoint = endpoint
  super()
end

Instance Method Details

#connection_completedObject



11
12
13
14
15
# File 'lib/remote_syslog/tls_endpoint.rb', line 11

def connection_completed
  start_tls(:verify_peer => @endpoint.server_cert != nil,
    :cert_chain_file => @endpoint.client_cert_chain,
    :private_key_file => @endpoint.client_private_key)
end

#ssl_handshake_completedObject



22
23
24
# File 'lib/remote_syslog/tls_endpoint.rb', line 22

def ssl_handshake_completed
  @endpoint.connection = self
end

#ssl_verify_peer(peer_cert) ⇒ Object



17
18
19
20
# File 'lib/remote_syslog/tls_endpoint.rb', line 17

def ssl_verify_peer(peer_cert)
  peer_cert = OpenSSL::X509::Certificate.new(peer_cert)
  peer_cert.verify(@endpoint.server_cert.public_key)
end

#unbindObject



26
27
28
# File 'lib/remote_syslog/tls_endpoint.rb', line 26

def unbind
  @endpoint.unbind
end