Class: Acmesmith::ChallengeResponders::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/acmesmith/challenge_responders/base.rb

Direct Known Subclasses

ManualDns, PebbleChalltestsrvDns, Route53

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



21
22
# File 'lib/acmesmith/challenge_responders/base.rb', line 21

def initialize()
end

Instance Method Details

#applicable?(domain) ⇒ true, false

Returns true when a responder is able to challenge against given domain name.

Parameters:

  • domain (String)

    target FQDN for a ACME authorization challenge

Returns:

  • (true, false)

    true when a responder is able to challenge against given domain name



12
13
14
# File 'lib/acmesmith/challenge_responders/base.rb', line 12

def applicable?(domain)
  true
end

#cap_respond_all?true, false

Returns true when implements #respond_all, #cleanup_all.

Returns:

  • (true, false)

    true when implements #respond_all, #cleanup_all



17
18
19
# File 'lib/acmesmith/challenge_responders/base.rb', line 17

def cap_respond_all?
  false
end

#cleanup(domain, challenge) ⇒ Object

If cap_respond_all? is true, you don’t need to implement this method.



58
59
60
61
62
63
64
# File 'lib/acmesmith/challenge_responders/base.rb', line 58

def cleanup(domain, challenge)
  if cap_respond_all?
    cleanup_all([domain, challenge])
  else
    raise NotImplementedError
  end
end

#cleanup_all(*domain_and_challenges) ⇒ Object

Clean up responses for the given challenges (1 or more).

Parameters:

  • domain_and_challenges (Array<(String, Acme::Client::Resources::Challenges::Base)>)

    array of tuple of domain name and ACME challenge



38
39
40
41
42
43
44
45
46
# File 'lib/acmesmith/challenge_responders/base.rb', line 38

def cleanup_all(*domain_and_challenges)
  if cap_respond_all?
    raise NotImplementedError
  else
    domain_and_challenges.each do |dc|
      cleanup(*dc)
    end
  end
end

#respond(domain, challenge) ⇒ Object

If cap_respond_all? is true, you don’t need to implement this method.



49
50
51
52
53
54
55
# File 'lib/acmesmith/challenge_responders/base.rb', line 49

def respond(domain, challenge)
  if cap_respond_all?
    respond_all([domain, challenge])
  else
    raise NotImplementedError
  end
end

#respond_all(*domain_and_challenges) ⇒ Object

Respond to the given challenges (1 or more).

Parameters:

  • domain_and_challenges (Array<(String, Acme::Client::Resources::Challenges::Base)>)

    array of tuple of domain name and ACME challenge



26
27
28
29
30
31
32
33
34
# File 'lib/acmesmith/challenge_responders/base.rb', line 26

def respond_all(*domain_and_challenges)
  if cap_respond_all?
    raise NotImplementedError
  else
    domain_and_challenges.each do |dc|
      respond(*dc)
    end
  end
end

#support?(type) ⇒ true, false

Returns true when given challenge type is supported.

Parameters:

  • type (String)

    ACME challenge type (dns-01, http-01, …)

Returns:

  • (true, false)

    true when given challenge type is supported

Raises:

  • (NotImplementedError)


6
7
8
# File 'lib/acmesmith/challenge_responders/base.rb', line 6

def support?(type)
  raise NotImplementedError
end