legion-crypt 0.2.1 → 0.2.2

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: 94f0199322913d4badab5e1cd29ad29613d8590d1112a9ceffcfbffdfcf2604d
4
- data.tar.gz: 0a901ac3efe8c894440a5888097311172c517a2f5519f08f8772976ce4b22dd5
3
+ metadata.gz: 2cee858be81735f0539ebb56696ad2e33e260f37ef0a7163e260838ca720771d
4
+ data.tar.gz: aace018115e35bff3ec332546063f88e32b82658916f43e3de356e4c1fc21cf6
5
5
  SHA512:
6
- metadata.gz: 4356dcc6172a9615b9f5eef18b7f92eb4f6ba8faf51e03fbe043a90b4dbf8286037343a45c4e7738ce6d84e6cd3ade84c704743ded75389873c06247200bac6d
7
- data.tar.gz: 81b04201cf2885f9558f3b349c5457b08fdb971041b7999cd5b139f456bbc24338f71561457d4267f92682c1b6ba31141ab09ffcd6ae755acd12a5f5117e8837
6
+ metadata.gz: ebab075482efdbd442b0b70f46a25427e6818226c4abf4a54a03abf334c56bf448c17f04b8562f9d5f2074baa3370c5ee83ae96978a63baf9fcf2bf0884fb37e
7
+ data.tar.gz: 5df29adbee2fb4108bf685affb47d1bfe63e4b1edfb695a7daf791c65e77ad807ab0a9129a827538875a6150014630c11d45b7413d7e7f8a1ccdf3b695d385ae
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- legion-crypt (0.2.1)
4
+ legion-crypt (0.2.2)
5
5
  vault
6
6
 
7
7
  GEM
@@ -12,20 +12,16 @@ GEM
12
12
  aws-eventstream (1.1.0)
13
13
  aws-sigv4 (1.2.2)
14
14
  aws-eventstream (~> 1, >= 1.0.2)
15
- bunny (2.16.1)
15
+ bunny (2.17.0)
16
16
  amq-protocol (~> 2.3, >= 2.3.1)
17
17
  concurrent-ruby (1.1.7)
18
18
  concurrent-ruby-ext (1.1.7)
19
19
  concurrent-ruby (= 1.1.7)
20
20
  connection_pool (2.2.3)
21
21
  daemons (1.3.1)
22
- dalli (2.7.10)
22
+ dalli (2.7.11)
23
23
  diff-lcs (1.4.4)
24
24
  docile (1.3.2)
25
- faraday (1.0.1)
26
- multipart-post (>= 1.2, < 3)
27
- faraday_middleware (1.0.0)
28
- faraday (~> 1.0)
29
25
  hashdiff (1.0.1)
30
26
  json (2.3.1)
31
27
  json (2.3.1-java)
@@ -34,25 +30,26 @@ GEM
34
30
  connection_pool
35
31
  dalli
36
32
  redis
37
- legion-data (1.1.2)
33
+ legion-data (1.1.4)
38
34
  legion-logging
39
35
  legion-settings
40
36
  mysql2
41
37
  sequel
42
- legion-exceptions (1.1.0)
38
+ legion-exceptions (1.1.2)
43
39
  legion-json (1.1.2)
44
40
  json_pure
45
41
  multi_json
46
- legion-logging (1.1.1)
42
+ legion-logging (1.1.3)
47
43
  rainbow (~> 3)
48
- legion-settings (1.1.1)
44
+ legion-settings (1.1.2)
49
45
  legion-json
50
46
  legion-logging
51
- legion-transport (1.1.3)
47
+ legion-transport (1.1.5)
52
48
  bunny
53
49
  concurrent-ruby
54
50
  legion-json
55
- legionio (0.2.0)
51
+ legionio (0.3.4)
52
+ bunny
56
53
  concurrent-ruby
57
54
  concurrent-ruby-ext
58
55
  daemons
@@ -65,58 +62,53 @@ GEM
65
62
  legion-logging
66
63
  legion-settings
67
64
  legion-transport
68
- sleepiq
69
- vault
65
+ lex-node
66
+ oj
67
+ lex-node (0.1.3)
70
68
  multi_json (1.15.0)
71
- multipart-post (2.1.1)
72
69
  mysql2 (0.5.3)
70
+ oj (3.10.15)
73
71
  parallel (1.19.2)
74
- parser (2.7.1.4)
72
+ parser (2.7.2.0)
75
73
  ast (~> 2.4.1)
76
74
  rainbow (3.0.0)
77
75
  rake (13.0.1)
78
- redis (4.2.1)
79
- regexp_parser (1.7.1)
76
+ redis (4.2.2)
77
+ regexp_parser (1.8.2)
80
78
  rexml (3.2.4)
81
79
  rspec (3.9.0)
82
80
  rspec-core (~> 3.9.0)
83
81
  rspec-expectations (~> 3.9.0)
84
82
  rspec-mocks (~> 3.9.0)
85
- rspec-core (3.9.2)
83
+ rspec-core (3.9.3)
86
84
  rspec-support (~> 3.9.3)
87
- rspec-expectations (3.9.2)
85
+ rspec-expectations (3.9.3)
88
86
  diff-lcs (>= 1.2.0, < 2.0)
89
87
  rspec-support (~> 3.9.0)
90
88
  rspec-mocks (3.9.1)
91
89
  diff-lcs (>= 1.2.0, < 2.0)
92
90
  rspec-support (~> 3.9.0)
93
- rspec-support (3.9.3)
91
+ rspec-support (3.9.4)
94
92
  rspec_junit_formatter (0.4.1)
95
93
  rspec-core (>= 2, < 4, != 2.12.0)
96
- rubocop (0.89.1)
94
+ rubocop (1.0.0)
97
95
  parallel (~> 1.10)
98
- parser (>= 2.7.1.1)
96
+ parser (>= 2.7.1.5)
99
97
  rainbow (>= 2.2.2, < 4.0)
100
- regexp_parser (>= 1.7)
98
+ regexp_parser (>= 1.8)
101
99
  rexml
102
- rubocop-ast (>= 0.3.0, < 1.0)
100
+ rubocop-ast (>= 0.6.0)
103
101
  ruby-progressbar (~> 1.7)
104
102
  unicode-display_width (>= 1.4.0, < 2.0)
105
- rubocop-ast (0.3.0)
106
- parser (>= 2.7.1.4)
103
+ rubocop-ast (1.1.0)
104
+ parser (>= 2.7.1.5)
107
105
  ruby-progressbar (1.10.1)
108
- sequel (5.35.0)
106
+ sequel (5.37.0)
109
107
  simplecov (0.17.1)
110
108
  docile (~> 1.1)
111
109
  json (>= 1.8, < 3)
112
110
  simplecov-html (~> 0.10.0)
113
111
  simplecov-html (0.10.2)
114
- sleepiq (0.2.2)
115
- dalli
116
- faraday
117
- faraday_middleware
118
- thor
119
- thor (1.0.1)
120
112
  unicode-display_width (1.7.0)
121
113
  vault (0.15.0)
122
114
  aws-sigv4
@@ -14,16 +14,24 @@ module Legion
14
14
 
15
15
  include Legion::Crypt::Cipher
16
16
 
17
- if Legion::Settings[:crypt][:vault][:enabled]
17
+ unless Gem::Specification.find_by_name('vault').nil?
18
18
  require 'legion/crypt/vault'
19
19
  include Legion::Crypt::Vault
20
20
  end
21
21
 
22
22
  def start
23
23
  Legion::Logging.debug 'Legion::Crypt is running start'
24
- # load_keys if Dir.exist?('./settings') && File.exist?('./settings/private.key') && File.exist?('./settings/public.key')
24
+ ::File.write('./legionio.key', private_key) if settings[:save_private_key]
25
25
 
26
- # connect_vault unless Legion::Settings[:crypt][:vault][:token].nil?
26
+ connect_vault unless settings[:vault][:token].nil?
27
+ end
28
+
29
+ def settings
30
+ if Legion.const_defined?('Settings')
31
+ Legion::Settings[:crypt]
32
+ else
33
+ Legion::Crypt::Settings.default
34
+ end
27
35
  end
28
36
 
29
37
  def shutdown
@@ -40,7 +40,11 @@ module Legion
40
40
  end
41
41
 
42
42
  def private_key
43
- @private_key ||= OpenSSL::PKey::RSA.new 2048
43
+ @private_key ||= if Legion::Settings[:crypt][:read_private_key] && File.exist?('./legionio.key')
44
+ OpenSSL::PKey::RSA.new File.read './legionio.key'
45
+ else
46
+ OpenSSL::PKey::RSA.new 2048
47
+ end
44
48
  end
45
49
 
46
50
  def cs
@@ -6,7 +6,9 @@ module Legion
6
6
  vault: vault,
7
7
  cs_encrypt_ready: false,
8
8
  dynamic_keys: true,
9
- cluster_secret: nil
9
+ cluster_secret: nil,
10
+ save_private_key: true,
11
+ read_private_key: true
10
12
  }
11
13
  end
12
14
 
@@ -22,6 +22,10 @@ module Legion
22
22
 
23
23
  require_relative 'vault_renewer'
24
24
  @renewer = Legion::Crypt::Vault::Renewer.new
25
+ rescue StandardError => e
26
+ Legion::Logging.error e.message
27
+ Legion::Settings[:crypt][:vault][:connected] = false
28
+ false
25
29
  end
26
30
 
27
31
  def read(path, type = 'legion')
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Legion
4
4
  module Crypt
5
- VERSION = '0.2.1'
5
+ VERSION = '0.2.2'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legion-crypt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-25 00:00:00.000000000 Z
11
+ date: 2020-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vault