amarillo 0.3.0 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/amarillo +6 -2
  3. data/lib/amarillo.rb +22 -8
  4. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 59800d9ffd3f4932ac01c88ada59e3c2cc14f9cb990fa2edbc83c07b205d3c6d
4
- data.tar.gz: 9fef9a94f42977457c51adaacf75297fc41e646c8197d4096d7a9266b4cbd1d4
3
+ metadata.gz: c4e3236346294475f1a163d18a26c6802d203f7fb9d9feb47c24f90ef117e2fb
4
+ data.tar.gz: c02964b63238765fd4eacc43d61fb7c6aae1aa256374c447efa429d99d4816dd
5
5
  SHA512:
6
- metadata.gz: 41156e19f4561525a2697b300c2bc74a47d1f26d188e5f847cef157a5c2fc3176fee166a3a136ddb33cf84560800c513667217c749c15b0bdeff296eb977bc86
7
- data.tar.gz: 7bffaa733755539e2197db335ded7b1dd2dcc1549e85b09aab218b5552e22f68c3633db3e2943f81df229d6a69a71ab277281d41dfa2023ce7c45304bf08978f
6
+ metadata.gz: e8f1b4dbb46b7c28c3ba1f800e6b625351887e46212bd5dc34ea345ab993b9b4ddb58d664fd4a6504104f101a94cdf3a5e782d5100429e0c124efeaa277c7da7
7
+ data.tar.gz: 3905e62aae46c7238416fbd60ce58afca677b05b146a3391170dcd99610cc2d086eedfc1972c6355035db49a7193b16a87d8dbd87023ab659329c4b3fdd00012
data/bin/amarillo CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
- # Copyright 2021 iAchieved.it LLC
3
+ # Copyright 2022 iAchieved.it LLC
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the "Software"), to deal
@@ -55,6 +55,10 @@ OptionParser.new do |opts|
55
55
  options[:name] = n
56
56
  end
57
57
 
58
+ opts.on("-k", "--keytype KEYTYPE", "Valid key types: ") do |k|
59
+ options[:keytype] = k
60
+ end
61
+
58
62
  opts.on("-a", "--amarillo-home AMARILLO_HOME", "Home directory for configuration, keys, and certificates") do |o|
59
63
  options[:amarillo_home] = a
60
64
  end
@@ -125,7 +129,7 @@ elsif options[:list] then
125
129
  elsif options[:delete] then
126
130
  y.deleteCertificate name
127
131
  else
128
- y.requestCertificate zone, name, email, nil
132
+ y.requestCertificate zone, name, email, options[:keytype]
129
133
  end
130
134
 
131
135
 
data/lib/amarillo.rb CHANGED
@@ -139,6 +139,11 @@ class Amarillo
139
139
 
140
140
  @route53.change_resource_record_sets(options)
141
141
 
142
+ at_exit do
143
+ self.cleanup label, record_type, challengeValue
144
+ end
145
+
146
+
142
147
  nameservers = @environment.get_zone_nameservers
143
148
 
144
149
  @logger.info "Waiting for DNS record to propagate"
@@ -178,22 +183,33 @@ class Amarillo
178
183
  if type == 'ec' then
179
184
  certPrivateKey = OpenSSL::PKey::EC.new(args).generate_key
180
185
  elsif type == 'rsa' then
181
- certPrivateKey = OpenSSL::PKey::RSA.new(args)
186
+ if args.to_i > 0
187
+ certPrivateKey = OpenSSL::PKey::RSA.new(args.to_i)
188
+ else
189
+ @logger.error("Invalid RSA key size: #{args}")
190
+ end
182
191
  end
183
192
 
184
193
  @logger.info "Requesting certificate..."
185
194
  csr = Acme::Client::CertificateRequest.new private_key: certPrivateKey,
186
195
  names: [commonName]
187
196
 
197
+ while order.status != 'ready'
198
+ sleep(1)
199
+ @logger.info "Order status: #{order.status}"
200
+ order.reload
201
+ raise if order.status == 'invalid'
202
+ end
203
+
204
+ @logger.info "Order status: #{order.status}"
205
+
188
206
  begin
189
207
  order.finalize(csr: csr)
190
208
  rescue
191
- @logger.error("ERROR")
192
- self.cleanup label, record_type, challengeValue
209
+ @logger.error("Error finalizing certificate order")
210
+ raise
193
211
  end
194
212
 
195
- sleep(1) while order.status == 'processing'
196
-
197
213
  keyOutputPath = "#{@keyPath}/#{commonName}.key"
198
214
  certOutputPath = "#{@certificatePath}/#{commonName}.crt"
199
215
 
@@ -213,8 +229,6 @@ class Amarillo
213
229
  certConfigFile = "#{@configsPath}/#{commonName}.yml"
214
230
  File.write(certConfigFile, certConfig.to_yaml)
215
231
 
216
- self.cleanup label, record_type, challengeValue
217
-
218
232
  end
219
233
 
220
234
  def cleanup(label, record_type, challengeValue)
@@ -307,4 +321,4 @@ class Amarillo
307
321
  end
308
322
 
309
323
 
310
- require 'amarillo/environment'
324
+ require 'amarillo/environment'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amarillo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - iAchieved.it LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-23 00:00:00.000000000 Z
11
+ date: 2022-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acme-client
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.2'
33
+ version: '3.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.2'
40
+ version: '3.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: aws-sdk-core
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  requirements: []
112
- rubygems_version: 3.2.3
112
+ rubygems_version: 3.3.3
113
113
  signing_key:
114
114
  specification_version: 4
115
115
  summary: Amarillo