amarillo 0.2.0 → 0.3.0
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.
- checksums.yaml +4 -4
- data/bin/amarillo +16 -4
- data/lib/amarillo.rb +34 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59800d9ffd3f4932ac01c88ada59e3c2cc14f9cb990fa2edbc83c07b205d3c6d
|
4
|
+
data.tar.gz: 9fef9a94f42977457c51adaacf75297fc41e646c8197d4096d7a9266b4cbd1d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41156e19f4561525a2697b300c2bc74a47d1f26d188e5f847cef157a5c2fc3176fee166a3a136ddb33cf84560800c513667217c749c15b0bdeff296eb977bc86
|
7
|
+
data.tar.gz: 7bffaa733755539e2197db335ded7b1dd2dcc1549e85b09aab218b5552e22f68c3633db3e2943f81df229d6a69a71ab277281d41dfa2023ce7c45304bf08978f
|
data/bin/amarillo
CHANGED
@@ -29,7 +29,15 @@ options = {}
|
|
29
29
|
OptionParser.new do |opts|
|
30
30
|
opts.on("-i", "--initialize", "Initialize amarillo defaults") do |i|
|
31
31
|
options[:initialize] = i
|
32
|
-
end
|
32
|
+
end
|
33
|
+
|
34
|
+
opts.on("-l", "--list", "List certificates") do |l|
|
35
|
+
options[:list] = l
|
36
|
+
end
|
37
|
+
|
38
|
+
opts.on("-d", "--delete", "Delete certificate") do |d|
|
39
|
+
options[:delete] = d
|
40
|
+
end
|
33
41
|
|
34
42
|
opts.on("-r", "--renew", "Renew certificates") do |r|
|
35
43
|
options[:renew] = r
|
@@ -95,9 +103,9 @@ else
|
|
95
103
|
email = options[:email]
|
96
104
|
end
|
97
105
|
|
98
|
-
if options[:name].nil? and options[:renew].nil? then
|
99
|
-
|
100
|
-
|
106
|
+
if options[:name].nil? and options[:renew].nil? and options[:list].nil? then
|
107
|
+
puts "Usage: amarillo --name COMMONNAME [--zone ZONE] [--email EMAIL] [--amarillo-home AMARILLO_HOME]"
|
108
|
+
exit -1
|
101
109
|
else
|
102
110
|
name = options[:name]
|
103
111
|
end
|
@@ -112,6 +120,10 @@ y = Amarillo.new amarillo_home
|
|
112
120
|
|
113
121
|
if options[:renew] then
|
114
122
|
y.renewCertificates
|
123
|
+
elsif options[:list] then
|
124
|
+
y.listCertificates
|
125
|
+
elsif options[:delete] then
|
126
|
+
y.deleteCertificate name
|
115
127
|
else
|
116
128
|
y.requestCertificate zone, name, email, nil
|
117
129
|
end
|
data/lib/amarillo.rb
CHANGED
@@ -30,6 +30,7 @@ require 'aws-sdk-core' # Credentials
|
|
30
30
|
require 'aws-sdk-route53' # Route 53
|
31
31
|
require 'resolv' # DNS Resolvers
|
32
32
|
require 'yaml' # YAML
|
33
|
+
require 'terminal-table' # Tablular output
|
33
34
|
|
34
35
|
class Amarillo
|
35
36
|
|
@@ -245,6 +246,39 @@ class Amarillo
|
|
245
246
|
|
246
247
|
end
|
247
248
|
|
249
|
+
def listCertificates
|
250
|
+
|
251
|
+
rows = []
|
252
|
+
|
253
|
+
Dir["#{@configsPath}/*.yml"].each do |c|
|
254
|
+
config = YAML.load(File.read(c))
|
255
|
+
|
256
|
+
cn = config["commonName"]
|
257
|
+
|
258
|
+
certificatePath = "#{@certificatePath}/#{cn}.crt"
|
259
|
+
raw = File.read certificatePath
|
260
|
+
certificate = OpenSSL::X509::Certificate.new raw
|
261
|
+
|
262
|
+
rows << [config["commonName"], config["email"],
|
263
|
+
config["zone"], config["key_type"], certificate.not_after]
|
264
|
+
|
265
|
+
end
|
266
|
+
|
267
|
+
t = Terminal::Table.new :headings => ['commonName','email','zone','keytype','expiration'], :rows => rows
|
268
|
+
puts t
|
269
|
+
end
|
270
|
+
|
271
|
+
def deleteCertificate(commonName)
|
272
|
+
@logger.info "Deleting certificate #{commonName}"
|
273
|
+
|
274
|
+
certConfigFile = @configsPath + "/#{commonName}.yml"
|
275
|
+
certificatePath = @certificatePath + "/#{commonName}.crt"
|
276
|
+
keyPath = @keyPath + "/#{commonName}.key"
|
277
|
+
|
278
|
+
`rm -f #{certConfigFile} #{certificatePath} #{keyPath}`
|
279
|
+
|
280
|
+
end
|
281
|
+
|
248
282
|
def renewCertificates
|
249
283
|
t = Time.now
|
250
284
|
@logger.info "Renewing certificates"
|
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.
|
4
|
+
version: 0.3.0
|
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-
|
11
|
+
date: 2021-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: acme-client
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.48'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: terminal-table
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
69
83
|
description: A tool for managing Let's Encrypt dns-01 certificates
|
70
84
|
email: joe@iachieved.it
|
71
85
|
executables:
|