cipherpipe 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/cipherpipe.gemspec +1 -1
- data/lib/cipherpipe/vault/ec2_token.rb +13 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b05909d357bbba3e06922c9aeb4f383b12b50aafe8fad70b925d32bfd84a011
|
4
|
+
data.tar.gz: 30c5fe0a31b6c4e30f9b52fe9b5602c3ef9e39b1fe28c11312cab94f2b6123ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 488f65a290e37ce2608ffb5690de2e6223467356edb455f36d587c42e18d84000d746bc0d80033d8934c5088317d0ddd1bdc965c5f22f56bfe8e487ae4994027
|
7
|
+
data.tar.gz: d3123e9d6ddb7547d0bae90ac2f68ba267292f651433b8557c538f5f5a5b2a32d0544df4d7507802b51b803666dcca549b4c286050251bbe2f71f61b1056abf2
|
data/Gemfile.lock
CHANGED
data/cipherpipe.gemspec
CHANGED
@@ -8,6 +8,8 @@ class Cipherpipe::Vault::EC2Token
|
|
8
8
|
"http://169.254.169.254/latest/dynamic/instance-identity/pkcs7"
|
9
9
|
)
|
10
10
|
|
11
|
+
NONCE_FILE = File.expand_path "~/.cipherpipe-nonce"
|
12
|
+
|
11
13
|
def self.call(external_source)
|
12
14
|
new(external_source).call
|
13
15
|
end
|
@@ -17,15 +19,23 @@ class Cipherpipe::Vault::EC2Token
|
|
17
19
|
end
|
18
20
|
|
19
21
|
def call
|
20
|
-
::Vault.auth.aws_ec2
|
21
|
-
|
22
|
-
|
22
|
+
response = ::Vault.auth.aws_ec2 external_source.ec2_role, signature, nonce
|
23
|
+
|
24
|
+
File.write NONCE_FILE, response.auth.metadata[:nonce]
|
25
|
+
|
26
|
+
response.auth.client_token
|
23
27
|
end
|
24
28
|
|
25
29
|
private
|
26
30
|
|
27
31
|
attr_reader :external_source
|
28
32
|
|
33
|
+
def nonce
|
34
|
+
return nil unless File.exist?(NONCE_FILE)
|
35
|
+
|
36
|
+
File.read NONCE_FILE
|
37
|
+
end
|
38
|
+
|
29
39
|
def signature
|
30
40
|
http = Net::HTTP.new URL.host, URL.port
|
31
41
|
http.open_timeout = 1 # second
|