Last active
March 16, 2019 22:27
-
-
Save mcr/96000bdfd516306dbedfadf16953733a to your computer and use it in GitHub Desktop.
Revisions
-
mcr revised this gist
Mar 16, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,7 +29,7 @@ m.type = :txt m.zone = "dasblinkenled.org" m.hostname = target m.data = challenge.record_content } sleep(30) puts "NIC" -
mcr created this gist
Mar 16, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,49 @@ # something wrong with authenticating the SSL key for staging server. OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE # AcmeKeys is a local class that collects stuff including the key pair for authenticating and options, # and which server to talk to, and DNS update options for my dasblinkenled.org zone. puts "Server at: #{AcmeKeys.acme.server}" client = Acme::Client.new(private_key: AcmeKeys.acme.acmeprivkey, directory: AcmeKeys.acme.server) account = client.new_account(contact: 'mailto:minerva@sandelman.ca', terms_of_service_agreed: true) zone = "ne34db3.r.dasblinkenled.org" order = client.new_order(identifiers: [zone]) authorization = order.authorizations.first challenge = authorization.dns expect(challenge.record_name).to eq("_acme-challenge") # good check for sanity, but could change dns = DnsUpdate::load AcmeKeys.acme.update_options target = challenge.record_name + "." + zone puts "Removing old challenge from #{target}" dns.remove { |m| m.type = :txt m.zone = "dasblinkenled.org" m.hostname = target } sleep(1) puts "Adding #{challenge.token} challenge to #{target}" dns.update { |m| m.type = :txt m.zone = "dasblinkenled.org" m.hostname = target m.data = challenge.token } sleep(30) puts "NIC" system("dig +short @nic.sandelman.ca #{target} txt") puts "SNS" system("dig +short @sns.cooperix.net #{target} txt") sleep(30) challenge.request_validation while challenge.status == 'pending' puts "Challenge waiting" sleep(2) challenge.reload end puts "Status: #{challenge.status}" byebug expect(challenge.status).to eq('valid')