ssssh 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/ssssh +31 -10
  3. data/lib/ssssh/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1fe0419d821e061f0e6193d250b521f3cf38f2bc
4
- data.tar.gz: d725bbcded6a0e3a64c4e94d252cdff92bb7fbb7
3
+ metadata.gz: d67cbed98ca5abfddc7ec818b486df7c1d8ad262
4
+ data.tar.gz: fb79d035bda7503889e376e2816f0422fbe15da7
5
5
  SHA512:
6
- metadata.gz: 9f42e0c71cb003cea6e77cbe9f2689e5d192f48b5ad853bede18cbea86a1c75dcda7c55d67fbb637ff84b0a44d9de47172c38c845427141f325ae0fe782ad7b5
7
- data.tar.gz: 67395c2bd2284370cd8ab9f7927c55a164ce208b94302e94f60b4a5379d2e0997908721dbfecbe87da79bb7383c361d8508bdbe8caf27ab47d76ddf2174fead6
6
+ metadata.gz: 6f6ba99c2a19db54020cfd4bfab66c3f609cc897ba6f483b3e47116fccb486d6409e371c42262652188095e3c7b77fb215743de2d24ff38b64b247f91a78b0cf
7
+ data.tar.gz: ca9d385e84a56e12866f2e1437deb09eb84568449f09420a3209261f1321210dbf777958760b326c89edac1bb3f9360caec01ed7b0e0813279852fb207dfa552
data/bin/ssssh CHANGED
@@ -4,47 +4,68 @@ require "aws-sdk-core"
4
4
  require "base64"
5
5
  require "clamp"
6
6
  require "logger"
7
+ require "ssssh/version"
7
8
 
8
9
  Clamp do
9
10
 
10
- option ["--region"], "REGION", "AWS region\n",
11
- :environment_variable => "AWS_REGION",
12
- :default => "ap-southeast-2"
13
- option "--access-key", "KEY", "AWS access key\n",
11
+ option ["--region"], "REGION", "AWS region",
12
+ :environment_variable => "AWS_REGION"
13
+ option "--access-key", "KEY", "AWS access key",
14
14
  :environment_variable => "AWS_ACCESS_KEY_ID",
15
15
  :attribute_name => :access_key_id
16
- option "--secret-key", "KEY", "AWS secret key\n",
16
+ option "--secret-key", "KEY", "AWS secret key",
17
17
  :environment_variable => "AWS_SECRET_ACCESS_KEY",
18
18
  :attribute_name => :secret_access_key
19
- option "--session-token", "KEY", "AWS security token\n",
19
+ option "--session-token", "KEY", "AWS security token",
20
20
  :environment_variable => "AWS_SECURITY_TOKEN",
21
21
  :attribute_name => :session_token
22
22
 
23
23
  option "--debug", :flag, "enable debugging"
24
24
 
25
+ option "--version", :flag, "display version" do
26
+ puts "ssssh-#{Ssssh::VERSION}"
27
+ exit 0
28
+ end
29
+
25
30
  subcommand "encrypt", "Encrypt STDIN" do
26
31
 
27
32
  parameter "KEY_ID", "KMS key-id"
28
- parameter "[DATA]", "plaintext data"
33
+ parameter "[PLAINTEXT]", "plaintext", :default => "STDIN"
29
34
 
30
35
  def execute
31
- plaintext = data || $stdin.read
32
36
  puts Base64.encode64(encrypt(plaintext, key_id))
33
37
  end
34
38
 
39
+ private
40
+
41
+ def default_plaintext
42
+ $stdin.read
43
+ end
44
+
35
45
  end
36
46
 
37
47
  subcommand "decrypt", "Decrypt STDIN" do
38
48
 
49
+ parameter "[CIPHERTEXT]", "encoded ciphertext", :default => "STDIN"
50
+
39
51
  def execute
40
- encoded_ciphertext = $stdin.read
41
- puts decrypt(Base64.decode64(encoded_ciphertext))
52
+ puts decrypt(Base64.decode64(ciphertext))
53
+ end
54
+
55
+ private
56
+
57
+ def default_ciphertext
58
+ $stdin.read
42
59
  end
43
60
 
44
61
  end
45
62
 
46
63
  protected
47
64
 
65
+ def default_region
66
+ ENV["AWS_REGION"] || ENV["AWS_DEFAULT_REGION"]
67
+ end
68
+
48
69
  def logger
49
70
  @logger ||= ::Logger.new($stderr).tap do |logger|
50
71
  logger.level = (debug? ? ::Logger::DEBUG : ::Logger::INFO)
@@ -1,3 +1,3 @@
1
1
  module Ssssh
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
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.0
4
+ version: 1.0.1
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-24 00:00:00.000000000 Z
11
+ date: 2015-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-core