Sha256: 484e9842d9a322bc31df6bc9c471583bc59b3b75d43008f23dc660857070a5c6

Contents?: true

Size: 808 Bytes

Versions: 3

Compression:

Stored size: 808 Bytes

Contents

require 'openssl'

class Eye::Checker::SslSocket < Eye::Checker::Socket
  param :ctx,          Hash, nil, {ssl_version: :SSLv23, verify_mode: OpenSSL::SSL::VERIFY_NONE}

  # other params inherits from socket check
  #
  # examples:
  #
  #   check :ssl_socket, :addr => "tcp://127.0.0.1:443", :every => 5.seconds, :times => 1, :timeout => 1.second,
  #     :ctx => {ssl_version: :SSLv23, verify_mode: OpenSSL::SSL::VERIFY_NONE}
  #
  #
  #  ctx_params from http://ruby-doc.org/stdlib-1.9.3/libdoc/openssl/rdoc/OpenSSL/SSL/SSLContext.html

private

  def open_socket
    OpenSSL::SSL::SSLSocket.new(super, ctx_params).tap do |socket|
      socket.sync_close = true
      socket.connect
    end
  end

  def ctx_params
    @ctx_params ||= OpenSSL::SSL::SSLContext.new().tap { |c| c.set_params(ctx) }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
eye-0.8.pre2 lib/eye/checker/ssl_socket.rb
eye-0.8.pre lib/eye/checker/ssl_socket.rb
eye-0.7 lib/eye/checker/ssl_socket.rb