ec2ctl 0.9.10 → 0.10.0
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/ec2ctl/cli.rb +1 -0
- data/lib/ec2ctl/client.rb +11 -1
- data/lib/ec2ctl/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8190dd5c5a7d325b0882de02a868fcc98b9c15be
|
4
|
+
data.tar.gz: 2a8bcdb4cd54ba1d9302b48f6296901fbbc1b6f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be12a5a68bea03650fd3b48ef9986404707365f708e5db7709f332d9ffe7077531e429c7ea060241094792a84ccbf925b397b139555abb0e95792db14f7512ef
|
7
|
+
data.tar.gz: 0a5d2ceb8917311f5610ee7c7d83c8716bc78c8f22ef69d1daff1d3613085fad557cff408b2a2be41a718219a7b8a68e4cefa23547c28f37cdba3aa123cc6413
|
data/lib/ec2ctl/cli.rb
CHANGED
@@ -40,6 +40,7 @@ module EC2Ctl
|
|
40
40
|
c.option "-C", "--count", "(Optional) Display instance attribute stats."
|
41
41
|
c.option "--platform-type Linux|Windows", String, "(Optional) Platform type: `Linux` or `Windows`. Default is `Linux`."
|
42
42
|
c.option "-S", "--sort KEY", String, "(Optional) Sort instances by this attribute."
|
43
|
+
c.option "--private-key-file PATH", String, "(Optional) Path to private key file."
|
43
44
|
|
44
45
|
c.action do |args, options|
|
45
46
|
invoke c, options do
|
data/lib/ec2ctl/client.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require "aws-sdk"
|
2
2
|
require "timeout"
|
3
|
+
require "base64"
|
4
|
+
require "openssl"
|
3
5
|
|
4
6
|
module EC2Ctl
|
5
7
|
class Client
|
@@ -7,6 +9,7 @@ module EC2Ctl
|
|
7
9
|
CommandNotSucceeded = Class.new RuntimeError
|
8
10
|
NoInstanceForExecCommand = Class.new RuntimeError
|
9
11
|
InvalidFilter = Class.new RuntimeError
|
12
|
+
PrivateKeyRequired = Class.new RuntimeError
|
10
13
|
|
11
14
|
INSTANCE_IDS_LIMIT = 50
|
12
15
|
COMMAND_STATUS_FINISHED = %w(Success TimedOut Cancelled Failed).freeze
|
@@ -44,7 +47,8 @@ module EC2Ctl
|
|
44
47
|
attributes: [],
|
45
48
|
search: [],
|
46
49
|
count: false,
|
47
|
-
sort: nil
|
50
|
+
sort: nil,
|
51
|
+
private_key_file: nil
|
48
52
|
)
|
49
53
|
@logger = logger
|
50
54
|
|
@@ -77,6 +81,7 @@ module EC2Ctl
|
|
77
81
|
@search = search
|
78
82
|
@count = count
|
79
83
|
@sort = sort
|
84
|
+
@private_key_file = private_key_file
|
80
85
|
|
81
86
|
if @load_balancer_name
|
82
87
|
@elb_instance_ids = elb_instance_states.map(&:instance_id).select do |instance_id|
|
@@ -590,6 +595,11 @@ module EC2Ctl
|
|
590
595
|
if ssm_instance_state
|
591
596
|
query_struct(ssm_instance_state, attribute.split(":")[1..-1].join(":"))
|
592
597
|
end
|
598
|
+
when /\Apassword\z/i
|
599
|
+
fail PrivateKeyRequired, "Private key required to decrypt password" unless @private_key_file
|
600
|
+
@private_key = OpenSSL::PKey::RSA.new(File.read(File.expand_path(@private_key_file))) unless @private_key
|
601
|
+
|
602
|
+
@private_key.private_decrypt Base64.decode64(instance.password_data.password_data)
|
593
603
|
else
|
594
604
|
query_struct(instance.data, attribute)
|
595
605
|
end
|
data/lib/ec2ctl/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ec2ctl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yoriki Yamaguchi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|