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",
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ SSL

Returns a new instance of SSL.



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

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.



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

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



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

def port
  @port
end

#retriesObject (readonly)

Returns the value of attribute retries.



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

def retries
  @retries
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



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

def timeout
  @timeout
end

Instance Method Details

#to_sObject



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

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