apartment_acme_client 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 66eaebf9ae761526e149a5bedd237deee499a95107edb9ce3c1e3916e29c058b
4
- data.tar.gz: 4ab90728f136c38b453a24f54b760c84539c4333ae0cb24ba4122dcb54c124b6
3
+ metadata.gz: 115dac06d080c93def98277b1b04e446db7cd66ee17b0cf40b2fba938232d9b7
4
+ data.tar.gz: d774f8b6bb8cc99af3efaa00848fadd9ea9614d42448aa84cba992fae2941fb6
5
5
  SHA512:
6
- metadata.gz: ff22698eadfef2b8b2e6d0c25793ad5bb1228ff66262c039ef01b969aabb42458caf4d3e6f0f8485a4eca5273b878328661437fe4591f6d809317a44811f1ae1
7
- data.tar.gz: 870ed58bb9befb87b788fa1976f4fd73b052982cc1b57be889c2783a1ec55372ce24d155b286fd5937c24bb910bbb69ece5cf101b3e7e298d8117adc51d7f100
6
+ metadata.gz: ce6bb72b308c1ca1087096de06de131e98b95c31ea0129f9890ee5687715262b3e60ce41cd5151f92ad32ebf48f1043b6156bd16da5e8156dbcccaa80ab52b5c
7
+ data.tar.gz: 65d76565e6fa300c866f7de531d6017af79cccb1c81210128fa7f0bbc6b79724ffbcf4f2dd100b76484fa7cbf05196e891ff3bdb5b6908efc1bc9e9ba81ad79d
@@ -51,7 +51,7 @@ module ApartmentAcmeClient
51
51
  @nameservers
52
52
  end
53
53
 
54
- def wait_for_present(value, timeout_seconds: 60)
54
+ def wait_for_present(value, timeout_seconds: 120)
55
55
  time = 1
56
56
  until check_dns(value)
57
57
  puts "Waiting for DNS to update"
@@ -67,7 +67,7 @@ module ApartmentAcmeClient
67
67
  values << value
68
68
  end
69
69
 
70
- return unless values.any?
70
+ return true unless values.any?
71
71
 
72
72
  route53 = ApartmentAcmeClient::DnsApi::Route53.new(
73
73
  requested_domain: wildcard_domain,
@@ -76,18 +76,21 @@ module ApartmentAcmeClient
76
76
  values: values
77
77
  )
78
78
 
79
+ puts "writing #{label} to Route53"
79
80
  route53.write_record
80
81
 
81
82
  check_dns = ApartmentAcmeClient::DnsApi::CheckDns.new(wildcard_domain, label)
82
83
 
83
84
  check_dns.wait_for_present(values.first)
85
+ puts "waiting 60 seconds before requesting DNS check from LetsEncrypt"
86
+ sleep(60)
84
87
 
85
88
  if check_dns.check_dns(values.first)
86
89
  # DNS is updated, proceed with cert request
87
90
  dns_authorizations.each do |domain_authorization|
88
91
  domain_authorization.request_validation
89
92
 
90
- 30.times do
93
+ 60.times do
91
94
  # may be 'pending' initially
92
95
  break if domain_authorization.status == 'valid'
93
96
 
@@ -111,6 +114,7 @@ module ApartmentAcmeClient
111
114
  def authorize_domain_with_http(domain_authorization)
112
115
  challenge = domain_authorization.http
113
116
 
117
+ puts "authorizing Domain: #{domain_authorization.domain}"
114
118
  # The http method will require you to respond to a HTTP request.
115
119
 
116
120
  # You can retrieve the challenge token
@@ -148,7 +152,10 @@ module ApartmentAcmeClient
148
152
 
149
153
  30.times do
150
154
  # may be 'pending' initially
151
- break if challenge.status == 'valid'
155
+ if challenge.status == 'valid'
156
+ puts "authorized!"
157
+ break
158
+ end
152
159
 
153
160
  puts "Waiting for letsencrypt to authorize the single domain. Status: #{challenge.status}"
154
161
 
@@ -179,10 +186,14 @@ module ApartmentAcmeClient
179
186
 
180
187
  authorize_domain_with_http(authorization)
181
188
  end
182
- # Do the DNS (wildcard) authorizations
183
- authorize_domains_with_dns(order.authorizations, wildcard_domain: wildcard_domain)
184
189
 
185
- client.request_certificate(common_name: common_name, names: domain_names_requested, order: order)
190
+ # Do the DNS (wildcard) authorizations
191
+ if authorize_domains_with_dns(order.authorizations, wildcard_domain: wildcard_domain)
192
+ client.request_certificate(common_name: common_name, names: domain_names_requested, order: order)
193
+ else
194
+ # error, not authorized
195
+ nil
196
+ end
186
197
  end
187
198
 
188
199
  # for use in order to store this on the machine for NGINX use
@@ -14,6 +14,10 @@ module ApartmentAcmeClient
14
14
  domains: good_domains,
15
15
  wildcard_domain: ApartmentAcmeClient.wildcard_domain
16
16
  )
17
+ if certificate.nil?
18
+ puts "ERROR, no certificate returned aborting"
19
+ return
20
+ end
17
21
 
18
22
  ApartmentAcmeClient::CertificateStorage::Proxy.singleton.store_certificate_string(certificate)
19
23
  ApartmentAcmeClient::CertificateStorage::Proxy.singleton.store_csr_private_key_string(encryptor.csr_private_key_string)
@@ -1,3 +1,3 @@
1
1
  module ApartmentAcmeClient
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apartment_acme_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robin Dunlop
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-20 00:00:00.000000000 Z
11
+ date: 2020-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails