Class: SSL
- Inherits:
-
Object
- Object
- SSL
- Defined in:
- lib/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
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ SSL
constructor
A new instance of SSL.
- #to_s ⇒ Object
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 60 61 62 63 |
# File 'lib/resources/ssl.rb', line 46 def initialize(opts = {}) @host = opts[:host] || inspec.backend.instance_variable_get(:@hostname) # FIXME: This can be removed when/if @hostname is available as a property for 'Train::Transports::WinRM::Connection' # Train enhancement request for this here: https://github.com/chef/train/issues/128 if @host.nil? && inspec.backend.class.to_s == 'Train::Transports::WinRM::Connection' @host = URI.parse(inspec.backend.instance_variable_get(:@options)[:endpoint]).hostname end if @host.nil? && inspec.backend.class.to_s == 'Train::Transports::Local::Connection' @host = 'localhost' end if @host.nil? fail 'Cannot determine host for SSL test. Please specify it or use a different target.' end @port = opts[:port] || 443 @timeout = opts[:timeout] @retries = opts[:retries] end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
44 45 46 |
# File 'lib/resources/ssl.rb', line 44 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
44 45 46 |
# File 'lib/resources/ssl.rb', line 44 def port @port end |
Instance Method Details
#to_s ⇒ Object
82 83 84 |
# File 'lib/resources/ssl.rb', line 82 def to_s "SSL/TLS on #{@host}:#{@port}" end |