Class: TLSChecker::TLSACheckerFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/tls_checker/tlsa_checker_factory.rb

Instance Method Summary collapse

Constructor Details

#initializeTLSACheckerFactory

Returns a new instance of TLSACheckerFactory.



5
6
7
# File 'lib/tls_checker/tlsa_checker_factory.rb', line 5

def initialize
  @resolver = Resolv::DNS.new
end

Instance Method Details

#tlsa_checkers_for(certificate_checker) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/tls_checker/tlsa_checker_factory.rb', line 9

def tlsa_checkers_for(certificate_checker)
  res = []
  return res unless certificate_checker.certificate

  each_tlsa_end_entity_record(certificate_checker) do |record|
    checker = TLSAChecker.new(record, certificate_checker)
    # Since a single domain may have different certificates on different
    # addresses, we are not interested in reporting failures here: a server
    # with 3 certificates on 3 IP addresses is expected to have 3 TLSA
    # records in the DNS, each one being valid for a different certificate.
    #
    # By adding only valid certificates, we can still detect problems when
    # events expire.
    next unless checker.certificate_match_tlsa_record?

    res << checker
  end

  res
end