ssssh 1.0.1 → 1.0.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
  SHA1:
3
- metadata.gz: d67cbed98ca5abfddc7ec818b486df7c1d8ad262
4
- data.tar.gz: fb79d035bda7503889e376e2816f0422fbe15da7
3
+ metadata.gz: eef52cc397abec11348e1c17be44d31adf552a56
4
+ data.tar.gz: a1673a612e4cac2b428e55d04a5dcef21ea58335
5
5
  SHA512:
6
- metadata.gz: 6f6ba99c2a19db54020cfd4bfab66c3f609cc897ba6f483b3e47116fccb486d6409e371c42262652188095e3c7b77fb215743de2d24ff38b64b247f91a78b0cf
7
- data.tar.gz: ca9d385e84a56e12866f2e1437deb09eb84568449f09420a3209261f1321210dbf777958760b326c89edac1bb3f9360caec01ed7b0e0813279852fb207dfa552
6
+ metadata.gz: ccfab41aa8f45b245b2c87d1011736efcb87f628b18a23fa793c42df933dbf350c9c1c6d433d83f906bee6a45fa9c96fa57deaabcb0175c630a55a36e1b94dd8
7
+ data.tar.gz: e44a896cc694db6b11f768c827e30350d4bca6fb4b7a33931765b4f7ad1eece187e3a8e6e0321bd8f87243767c6dd74a59560e9ffda16047b94c85666ee1aac4
data/README.md CHANGED
@@ -12,7 +12,9 @@ Later, you can decrypt them:
12
12
 
13
13
  ssssh decrypt < secrets.encrypted > secrets.txt
14
14
 
15
- This assumes that the necessary AWS_xxx environment variables are set, and that KEY-ID is the name or alias of an existing KMS key.
15
+ KEY-ID must be the name or alias of an existing KMS key.
16
+
17
+ Naturally, suitable AWS credentials must be provided (via environment variables, command-line options, or EC2 instance profile).
16
18
 
17
19
  ## Limitations
18
20
 
data/bin/ssssh CHANGED
@@ -82,16 +82,22 @@ Clamp do
82
82
  }.reject { |k,v| v.nil? || v == "" }
83
83
  end
84
84
 
85
- def kms
86
- @kms ||= Aws::KMS::Client.new(aws_config)
85
+ def with_kms
86
+ yield Aws::KMS::Client.new(aws_config)
87
+ rescue Aws::KMS::Errors::ServiceError => e
88
+ signal_error(e.message, :status => 9)
87
89
  end
88
90
 
89
91
  def encrypt(plaintext, key_id)
90
- kms.encrypt(:key_id => key_id, :plaintext => plaintext).ciphertext_blob
92
+ with_kms do |kms|
93
+ kms.encrypt(:key_id => key_id, :plaintext => plaintext).ciphertext_blob
94
+ end
91
95
  end
92
96
 
93
97
  def decrypt(ciphertext)
94
- kms.decrypt(:ciphertext_blob => ciphertext).plaintext
98
+ with_kms do |kms|
99
+ kms.decrypt(:ciphertext_blob => ciphertext).plaintext
100
+ end
95
101
  end
96
102
 
97
103
  end
data/lib/ssssh/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ssssh
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
data/ssssh.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.require_paths = ["lib"]
23
23
 
24
24
  spec.add_runtime_dependency "aws-sdk-core", "~> 2.0"
25
- spec.add_runtime_dependency "clamp", ">= 0.6"
25
+ spec.add_runtime_dependency "clamp", ">= 0.6.4"
26
26
 
27
27
  spec.add_development_dependency "bundler", "~> 1.7"
28
28
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ssssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-25 00:00:00.000000000 Z
11
+ date: 2015-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-core
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0.6'
33
+ version: 0.6.4
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0.6'
40
+ version: 0.6.4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement