dokku-installer-cli 0.0.9.3 → 0.1.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/lib/dokku_installer/ssl.rb +55 -13
- data/lib/dokku_installer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb69b1d5b49e5ec10f762a35e86f9c96dd0d3265
|
4
|
+
data.tar.gz: 1a00ea3628b1602afee769f3ad7732dcf37ff8f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0278f0567b864c9df21593471c987f459c9d243b9b3e26a43eed04a8fa5570764670eaa9506a49e7edfa901c7b33790a73c70c684d8c24bf62ca47bbc5c3c27
|
7
|
+
data.tar.gz: fefdcc7ca36f849629a4cf176b8f67e035d7e9829efbd5e10cb0aa928891a2b352b18a1e2eb593ff000b10c48054a9cd032ef3a1db8ff77a0504550700c946fc
|
data/lib/dokku_installer/ssl.rb
CHANGED
@@ -1,24 +1,66 @@
|
|
1
1
|
module DokkuInstaller
|
2
2
|
class Cli < Thor
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
# certs:add CRT KEY # Add an ssl endpoint to an app.
|
5
|
+
# certs:chain CRT [CRT ...] # Print the ordered and complete chain for the given certificate.
|
6
|
+
# certs:info # Show certificate information for an ssl endpoint.
|
7
|
+
# certs:key CRT KEY [KEY ...] # Print the correct key for the given certificate.
|
8
|
+
# certs:remove # Remove an SSL Endpoint from an app.
|
9
|
+
# certs:rollback # Rollback an SSL Endpoint for an app.
|
10
|
+
# certs:update CRT KEY # Update an SSL Endpoint on an app.
|
9
11
|
|
10
|
-
|
12
|
+
desc "ssl:add CRT KEY", "Add an SSL endpoint."
|
13
|
+
def ssl_add(*args)
|
14
|
+
key = nil
|
15
|
+
certificate = nil
|
16
|
+
intermediate_certificates = []
|
17
|
+
|
18
|
+
args.each do |arg|
|
19
|
+
file_contents = File.read(arg)
|
20
|
+
if file_contents.include?("KEY")
|
21
|
+
key = file_contents
|
22
|
+
elsif file_contents.include?("BEGIN CERTIFICATE")
|
23
|
+
certificate = file_contents
|
24
|
+
elsif file_contents.include?("NEW CERTIFICATE REQUEST")
|
25
|
+
intermediate_certificates << file_contents
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
if key.nil?
|
30
|
+
puts "Missing SSL private key.\nSpecify the key, certificate, and any intermediate certificates."
|
31
|
+
exit
|
32
|
+
elsif certificate.nil?
|
33
|
+
puts "Missing SSL certificate.\nSpecify the key, certificate, and any intermediate certificates."
|
34
|
+
exit
|
35
|
+
end
|
36
|
+
|
37
|
+
puts "Adding SSL private key..."
|
38
|
+
command = "echo \"#{key}\" | ssh dokku@#{domain} ssl:key #{app_name}"
|
39
|
+
result = `#{command}`
|
40
|
+
|
41
|
+
puts "Adding SSL certificate..."
|
42
|
+
combined_certificate = certificate
|
43
|
+
if intermediate_certificates.length > 0
|
44
|
+
combined_certificate += "#{intermediate_certificates.join("\n")}\n"
|
45
|
+
end
|
46
|
+
command = "echo \"#{combined_certificate}\" | ssh dokku@#{domain} ssl:certificate #{app_name}"
|
11
47
|
exec(command)
|
12
48
|
end
|
13
49
|
|
14
|
-
desc "ssl:
|
15
|
-
def
|
16
|
-
|
17
|
-
|
18
|
-
|
50
|
+
desc "ssl:force DOMAIN", "Force SSL on the given domain."
|
51
|
+
def ssl_force(*args)
|
52
|
+
domain = args.first
|
53
|
+
if domain.nil?
|
54
|
+
puts "Specify a domain to force SSL."
|
55
|
+
exit
|
56
|
+
end
|
19
57
|
|
20
|
-
|
21
|
-
|
58
|
+
run_command "ssl:force #{app_name} #{domain}"
|
59
|
+
end
|
60
|
+
|
61
|
+
desc "ssl:remove", "Remove an SSL endpoint."
|
62
|
+
def ssl_remove
|
63
|
+
run_command "ssl:delete #{domain} #{app_name}"
|
22
64
|
end
|
23
65
|
|
24
66
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dokku-installer-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Pattison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|