canzea 0.1.61 → 0.1.62
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/canzea/version.rb +1 -1
- data/lib/canzea.rb +8 -3
- data/lib/ssh-base-cmd-class.rb +4 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb44f9067f408cf0b656946739909340a8c088b4
|
4
|
+
data.tar.gz: 1f90505fe1e573789d803605dabb6f2b693b071d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ca31ef179903515d3eb58bfd5403031fa45bbba1e21b33e18ba5cb567fed97b582cfdb9defcf9d59c6c4f58c25765a04bb1afad784a4b688f534b4047e8170d
|
7
|
+
data.tar.gz: 1287ff526ac8cb0cbad7f8a6f34fc2956b94a827c0847ae29edf88d868b30efe675abce094289da78e9fba1ca64bd34a13302b393a4b12afec8a8d37ee3f178a
|
data/lib/canzea/version.rb
CHANGED
data/lib/canzea.rb
CHANGED
@@ -38,6 +38,8 @@ module Canzea
|
|
38
38
|
|
39
39
|
flag nil, :pwd, 'PWD'
|
40
40
|
|
41
|
+
flag nil, :verbose, 'Verbose'
|
42
|
+
|
41
43
|
# flag nil, :run, 'Run a step'
|
42
44
|
# flag nil, :helper, 'Execute a helper'
|
43
45
|
flag nil, :remote, 'Remote execution'
|
@@ -68,6 +70,7 @@ module Canzea
|
|
68
70
|
option nil, :serverBase, 'Server Base', argument: :required
|
69
71
|
option nil, :serverNumber, 'Server Number', argument: :required
|
70
72
|
option nil, :privateKey, 'Task', argument: :required
|
73
|
+
option nil, :publicKey, 'Task', argument: :required
|
71
74
|
option nil, :template, 'Template', argument: :required
|
72
75
|
|
73
76
|
option nil, :action, 'Helper Action', argument: :required
|
@@ -84,7 +87,9 @@ module Canzea
|
|
84
87
|
|
85
88
|
extraConfig = Canzea::config[:catalog_location] + "/config.json"
|
86
89
|
if File.exists?(extraConfig)
|
87
|
-
|
90
|
+
if (opts[:verbose])
|
91
|
+
puts "-- Reading #{extraConfig}"
|
92
|
+
end
|
88
93
|
file = File.read(extraConfig)
|
89
94
|
Canzea::configure JSON.parse(file)
|
90
95
|
end
|
@@ -142,12 +147,12 @@ module Canzea
|
|
142
147
|
|
143
148
|
if (opts[:encrypt])
|
144
149
|
remote = RemoteCall.new
|
145
|
-
remote.encrypt args[0]
|
150
|
+
remote.encrypt args[0], opts[:publicKey]
|
146
151
|
end
|
147
152
|
|
148
153
|
if (opts[:decrypt])
|
149
154
|
remote = RemoteCall.new
|
150
|
-
remote.decrypt args[0] opts[:privateKey]
|
155
|
+
remote.decrypt args[0], opts[:privateKey]
|
151
156
|
end
|
152
157
|
|
153
158
|
if (opts[:lifecycle])
|
data/lib/ssh-base-cmd-class.rb
CHANGED
@@ -42,19 +42,17 @@ class RemoteCall
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
def encrypt (contents)
|
46
|
-
|
47
|
-
pubkey_pem = File.read 'root_id_rsa.pem.pub'
|
45
|
+
def encrypt (contents, publicKey)
|
46
|
+
pubkey_pem = File.read publicKey
|
48
47
|
key = OpenSSL::PKey::RSA.new pubkey_pem
|
49
|
-
output = Base64.
|
48
|
+
output = Base64.urlsafe_encode64 key.public_encrypt contents
|
50
49
|
puts output
|
51
50
|
end
|
52
51
|
|
53
52
|
def decrypt (contents, privateKey)
|
54
|
-
puts "Decrypting #{contents}"
|
55
53
|
privkey_pem = File.read privateKey
|
56
54
|
key = OpenSSL::PKey::RSA.new privkey_pem
|
57
|
-
output = key.private_decrypt Base64.
|
55
|
+
output = key.private_decrypt Base64.urlsafe_decode64 contents
|
58
56
|
puts output
|
59
57
|
end
|
60
58
|
|