Class: SSL

Inherits:
Object
  • Object
show all
Defined in:
lib/inspec/resources/ssl.rb

Overview

Custom resource based on the InSpec resource DSL

Constant Summary collapse

VERSIONS =
[
  "ssl2",
  "ssl3",
  "tls1.0",
  "tls1.1",
  "tls1.2",
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ SSL

Returns a new instance of SSL.



44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/inspec/resources/ssl.rb', line 44

def initialize(opts = {})
  @host = opts[:host]
  if @host.nil?
    # Transports like SSH and WinRM will provide a hostname
    if inspec.backend.respond_to?("hostname")
      @host = inspec.backend.hostname
    elsif inspec.backend.class.to_s == "Train::Transports::Local::Connection"
      @host = "localhost"
    end
  end
  @port = opts[:port] || 443
  @timeout = opts[:timeout]
  @retries = opts[:retries]
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



42
43
44
# File 'lib/inspec/resources/ssl.rb', line 42

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



42
43
44
# File 'lib/inspec/resources/ssl.rb', line 42

def port
  @port
end

#retriesObject (readonly)

Returns the value of attribute retries.



42
43
44
# File 'lib/inspec/resources/ssl.rb', line 42

def retries
  @retries
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



42
43
44
# File 'lib/inspec/resources/ssl.rb', line 42

def timeout
  @timeout
end

Instance Method Details

#to_sObject



78
79
80
# File 'lib/inspec/resources/ssl.rb', line 78

def to_s
  "SSL/TLS on #{@host}:#{@port}"
end