Class: Uninterruptible::TLSServerFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/uninterruptible/tls_server_factory.rb

Overview

Wraps a bound TCP server with an OpenSSL::SSL::SSLServer according to the Uninterruptible::Configuration for this server.

Defined Under Namespace

Classes: CertificateChain

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ TLSServerFactory

Returns a new instance of TLSServerFactory.

Parameters:

Raises:



24
25
26
27
# File 'lib/uninterruptible/tls_server_factory.rb', line 24

def initialize(configuration)
  @configuration = configuration
  check_configuration!
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



5
6
7
# File 'lib/uninterruptible/tls_server_factory.rb', line 5

def configuration
  @configuration
end

Instance Method Details

#wrap_with_tls(tcp_server) ⇒ OpenSSL::SSL::SSLServer

Accepts a TCP server, gives it a nice friendly SSLServer wrapper and returns the SSLServer

Parameters:

  • tcp_server (TCPServer)

    Server to be wrapped

Returns:

  • (OpenSSL::SSL::SSLServer)

    tcp_server with a TLS layer



34
35
36
37
38
# File 'lib/uninterruptible/tls_server_factory.rb', line 34

def wrap_with_tls(tcp_server)
  server = OpenSSL::SSL::SSLServer.new(tcp_server, ssl_context)
  server.start_immediately = false
  server
end