Fixes for letsencrypt - please no more acme changes :(

This commit is contained in:
Kyle Drake 2020-04-14 01:31:13 +00:00
parent 4dfacac83a
commit 10018c5124

View file

@ -112,7 +112,7 @@ class LetsEncryptWorker
finalized_domains = [] finalized_domains = []
order = client.new_order identifiers: verified_domains order = letsencrypt.new_order identifiers: verified_domains
order.authorizations.each do |authorization| order.authorizations.each do |authorization|
challenge = authorization.http challenge = authorization.http
@ -129,17 +129,17 @@ class LetsEncryptWorker
# A verification needs to be attempted anyways, otherwise 300 of them will jam up the system for a week # A verification needs to be attempted anyways, otherwise 300 of them will jam up the system for a week
end end
challenge.request_verification challenge.request_validation
sleep 1 sleep 1
attempts = 0 attempts = 0
while true while true
result = challenge.status result = challenge.status
puts "#{domain} : #{result}" puts "#{authorization.domain} : #{result}"
if result == 'valid' if result == 'valid'
puts "VALIDATED: #{domain}" puts "VALIDATED: #{authorization.domain}"
clean_wellknown_turds site clean_wellknown_turds site
finalized_domains.push authorization.domain finalized_domains.push authorization.domain
break break
@ -148,12 +148,13 @@ class LetsEncryptWorker
raise VerificationTimeoutError if attempts == 60 raise VerificationTimeoutError if attempts == 60
if result == 'invalid' if result == 'invalid'
puts "returned invalid, walking away" puts "returned invalid (#{authorization.domain}, walking away"
clean_wellknown_turds site clean_wellknown_turds site
break break
end end
attempts += 1 attempts += 1
challenge.reload
sleep 2 sleep 2
end end
end end
@ -171,7 +172,7 @@ class LetsEncryptWorker
end end
site.ssl_key = csr.private_key.to_pem site.ssl_key = csr.private_key.to_pem
site.ssl_cert = order.certificate.fullchain_to_pem site.ssl_cert = order.certificate
site.cert_updated_at = Time.now site.cert_updated_at = Time.now
site.domain_fail_count = 0 site.domain_fail_count = 0
site.save_changes validate: false site.save_changes validate: false