Class: Inspec::Resources::SSL

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

Constant Summary collapse

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ SSL

Returns a new instance of SSL.



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

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.



44
45
46
# File 'lib/inspec/resources/ssl.rb', line 44

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



44
45
46
# File 'lib/inspec/resources/ssl.rb', line 44

def port
  @port
end

#retriesObject (readonly)

Returns the value of attribute retries.



44
45
46
# File 'lib/inspec/resources/ssl.rb', line 44

def retries
  @retries
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



44
45
46
# File 'lib/inspec/resources/ssl.rb', line 44

def timeout
  @timeout
end

Instance Method Details

#to_sObject



85
86
87
# File 'lib/inspec/resources/ssl.rb', line 85

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