class Acmesmith::ChallengeResponders::PebbleChalltestsrvDns

Attributes

url[R]

Public Class Methods

new(url: 'http://localhost:8055') click to toggle source
# File lib/acmesmith/challenge_responders/pebble_challtestsrv_dns.rb, line 14
def initialize(url: 'http://localhost:8055')
  warn_test
  @url = URI.parse(url)
end

Public Instance Methods

cleanup(domain, challenge) click to toggle source
# File lib/acmesmith/challenge_responders/pebble_challtestsrv_dns.rb, line 33
def cleanup(domain, challenge)
  warn_test

  Net::HTTP.post(
    URI.join(url,"/clear-txt"),
    {
      host: "#{challenge.record_name}.#{domain}.",
    }.to_json,
  ).value
end
respond(domain, challenge) click to toggle source
# File lib/acmesmith/challenge_responders/pebble_challtestsrv_dns.rb, line 21
def respond(domain, challenge)
  warn_test

  Net::HTTP.post(
    URI.join(url,"/set-txt"),
    {
      host: "#{challenge.record_name}.#{domain}.",
      value: challenge.record_content,
    }.to_json,
  ).value
end
support?(type) click to toggle source
# File lib/acmesmith/challenge_responders/pebble_challtestsrv_dns.rb, line 9
def support?(type)
  # Acme::Client::Resources::Challenges::DNS01
  type == 'dns-01'
end
warn_test() click to toggle source
# File lib/acmesmith/challenge_responders/pebble_challtestsrv_dns.rb, line 44
def warn_test
  unless ENV['CI']
    $stderr.puts '!!!!!!!!! WARNING WARNING WARNING !!!!!!!!!'
    $stderr.puts '!!!! pebble-challtestsrv command is for TEST USAGE ONLY. It is trivially insecure, offering no authentication. Only use pebble-challtestsrv in a controlled test environment.'
    $stderr.puts '!!!! https://github.com/letsencrypt/pebble/blob/master/cmd/pebble-challtestsrv/README.md'
  end
end