awskeyring 1.4.0 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +51 -0
- data/Gemfile +1 -0
- data/LICENSE.txt +1 -1
- data/README.md +7 -2
- data/SECURITY.md +4 -0
- data/awskeyring.gemspec +3 -1
- data/i18n/en.yml +4 -0
- data/lib/awskeyring.rb +12 -5
- data/lib/awskeyring/awsapi.rb +7 -4
- data/lib/awskeyring/input.rb +5 -5
- data/lib/awskeyring/version.rb +1 -1
- data/lib/awskeyring_command.rb +42 -13
- data/man/awskeyring.5 +101 -2
- data/man/awskeyring.5.ronn +50 -13
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f414457dbb053f2bbe8fde789ee2238ed11d3554576bfbd67ff52c84697eb5b
|
4
|
+
data.tar.gz: 70766a2e47f57dccd562a604d278bfa248b6133b7aa5f6f6a0c697bd2fd09cdc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a14c818ec8f52ad3b0520d779c047eb2523252d9ebc032005571ed347fe3a66f3015e7cc5f7f64a0ff36845ea4c7232e5c70f64da171b5e489bc01b1be6b525
|
7
|
+
data.tar.gz: bbd9103d268378c1901097854df9880d6b5dc32843feb24e654faff26d8dfd8952862cfb48c492c290cd88b87ee6897c4ad8a8f1407dc0c22a8207b32f1c34d3
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,56 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v1.8.1](https://github.com/servian/awskeyring/tree/v1.8.1) (2021-01-20)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/servian/awskeyring/compare/v1.8.0...v1.8.1)
|
6
|
+
|
7
|
+
**Fixed bugs:**
|
8
|
+
|
9
|
+
- Update command failed. [\#75](https://github.com/servian/awskeyring/issues/75)
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- Default nil token \(fix \#75\) [\#76](https://github.com/servian/awskeyring/pull/76) ([tristanmorgan](https://github.com/tristanmorgan))
|
14
|
+
|
15
|
+
## [v1.8.0](https://github.com/servian/awskeyring/tree/v1.8.0) (2020-12-07)
|
16
|
+
|
17
|
+
[Full Changelog](https://github.com/servian/awskeyring/compare/v1.7.0...v1.8.0)
|
18
|
+
|
19
|
+
**Implemented enhancements:**
|
20
|
+
|
21
|
+
- Include expiry time export, AWS\_CREDENTIAL\_EXPIRATION [\#74](https://github.com/servian/awskeyring/pull/74) ([tristanmorgan](https://github.com/tristanmorgan))
|
22
|
+
|
23
|
+
## [v1.7.0](https://github.com/servian/awskeyring/tree/v1.7.0) (2020-11-18)
|
24
|
+
|
25
|
+
[Full Changelog](https://github.com/servian/awskeyring/compare/v1.6.0...v1.7.0)
|
26
|
+
|
27
|
+
**Implemented enhancements:**
|
28
|
+
|
29
|
+
- Allow specifying a browser other than the default [\#71](https://github.com/servian/awskeyring/issues/71)
|
30
|
+
- Autocomplete for Browsers [\#73](https://github.com/servian/awskeyring/pull/73) ([tristanmorgan](https://github.com/tristanmorgan))
|
31
|
+
|
32
|
+
**Merged pull requests:**
|
33
|
+
|
34
|
+
- Updates for added RuboCop checks. [\#70](https://github.com/servian/awskeyring/pull/70) ([tristanmorgan](https://github.com/tristanmorgan))
|
35
|
+
|
36
|
+
## [v1.6.0](https://github.com/servian/awskeyring/tree/v1.6.0) (2020-08-11)
|
37
|
+
|
38
|
+
[Full Changelog](https://github.com/servian/awskeyring/compare/v1.5.0...v1.6.0)
|
39
|
+
|
40
|
+
**Implemented enhancements:**
|
41
|
+
|
42
|
+
- Warn about missing accounts/roles [\#69](https://github.com/servian/awskeyring/pull/69) ([tristanmorgan](https://github.com/tristanmorgan))
|
43
|
+
- RuboCop and Spec update [\#68](https://github.com/servian/awskeyring/pull/68) ([tristanmorgan](https://github.com/tristanmorgan))
|
44
|
+
- Add SimpleCov reports. [\#67](https://github.com/servian/awskeyring/pull/67) ([tristanmorgan](https://github.com/tristanmorgan))
|
45
|
+
|
46
|
+
## [v1.5.0](https://github.com/servian/awskeyring/tree/v1.5.0) (2020-07-08)
|
47
|
+
|
48
|
+
[Full Changelog](https://github.com/servian/awskeyring/compare/v1.4.0...v1.5.0)
|
49
|
+
|
50
|
+
**Implemented enhancements:**
|
51
|
+
|
52
|
+
- No-Bundle env changes for exec. [\#66](https://github.com/servian/awskeyring/pull/66) ([tristanmorgan](https://github.com/tristanmorgan))
|
53
|
+
|
3
54
|
## [v1.4.0](https://github.com/servian/awskeyring/tree/v1.4.0) (2020-06-19)
|
4
55
|
|
5
56
|
[Full Changelog](https://github.com/servian/awskeyring/compare/v1.3.3...v1.4.0)
|
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Awskeyring
|
2
2
|
|
3
|
-
![Awskeyring](https://raw.githubusercontent.com/servian/awskeyring/
|
3
|
+
![Awskeyring](https://raw.githubusercontent.com/servian/awskeyring/main/awskeyring-144.png)
|
4
4
|
|
5
|
-
* [![Build Status](https://travis-ci.org/servian/awskeyring.svg?branch=
|
5
|
+
* [![Build Status](https://travis-ci.org/servian/awskeyring.svg?branch=main)](https://travis-ci.org/servian/awskeyring)
|
6
6
|
* [![Gem Version](https://badge.fury.io/rb/awskeyring.svg)](https://badge.fury.io/rb/awskeyring)
|
7
7
|
* [![license MIT](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)
|
8
8
|
* [![All Downloads](https://ruby-gem-downloads-badge.herokuapp.com/awskeyring?type=total)](https://rubygems.org/gems/awskeyring)
|
@@ -27,6 +27,10 @@ Install it with:
|
|
27
27
|
|
28
28
|
$ gem install awskeyring --user-install
|
29
29
|
|
30
|
+
or via [homebrew gem](https://github.com/sportngin/brew-gem):
|
31
|
+
|
32
|
+
$ brew gem install awskeyring
|
33
|
+
|
30
34
|
## Wiki
|
31
35
|
|
32
36
|
Please see the [Wiki](https://github.com/servian/awskeyring/wiki) for full usage instructions and tips.
|
@@ -113,6 +117,7 @@ the [Contributor Covenant](https://contributor-covenant.org) code of conduct.
|
|
113
117
|
|
114
118
|
* Tristan [tristanmorgan](https://github.com/tristanmorgan)
|
115
119
|
* Adam Sir [AzySir](https://github.com/AzySir)
|
120
|
+
* Vito Giarrusso [thtliife](https://github.com/thtliife)
|
116
121
|
|
117
122
|
## License
|
118
123
|
|
data/SECURITY.md
ADDED
data/awskeyring.gemspec
CHANGED
@@ -20,9 +20,11 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
|
+
spec.required_ruby_version = '>= 2.6.0'
|
24
|
+
|
23
25
|
spec.metadata = {
|
24
26
|
'bug_tracker_uri' => "#{Awskeyring::HOMEPAGE}/issues",
|
25
|
-
'changelog_uri' => "#{Awskeyring::HOMEPAGE}/blob/
|
27
|
+
'changelog_uri' => "#{Awskeyring::HOMEPAGE}/blob/main/CHANGELOG.md",
|
26
28
|
'documentation_uri' => "https://rubydoc.info/gems/#{spec.name}/#{Awskeyring::VERSION}",
|
27
29
|
'source_code_uri' => "#{Awskeyring::HOMEPAGE}/tree/v#{Awskeyring::VERSION}",
|
28
30
|
'wiki_uri' => "#{Awskeyring::HOMEPAGE}/wiki"
|
data/i18n/en.yml
CHANGED
@@ -44,10 +44,12 @@ en:
|
|
44
44
|
key: 'AWS account key id.'
|
45
45
|
keychain: 'Name of KEYCHAIN to initialise.'
|
46
46
|
mfa: 'AWS virtual mfa arn.'
|
47
|
+
nobundle: 'Unset Bundler environment variables.'
|
47
48
|
noopen: 'Do not open the url.'
|
48
49
|
notoken: 'Do not use saved token.'
|
49
50
|
noremote: 'Do not validate with remote api.'
|
50
51
|
path: 'The service PATH to open.'
|
52
|
+
browser: 'Specify an alternative browser.'
|
51
53
|
role: 'The ROLE to assume.'
|
52
54
|
secret: 'AWS account secret.'
|
53
55
|
unset: 'Unset environment variables.'
|
@@ -74,6 +76,8 @@ en:
|
|
74
76
|
delexpired: '# Removing expired session credentials'
|
75
77
|
exec: '# COMMAND not provided'
|
76
78
|
missing: '# Config missing, run `%{bin} initialise` to recreate.'
|
79
|
+
missing_account: '# No accounts added, run `%{bin} add` to add.'
|
80
|
+
missing_role: '# No roles added, run `%{bin} add-role` to add.'
|
77
81
|
rotate: '# You have two access keys for account %{account}'
|
78
82
|
temporary: '# Using temporary session credentials.'
|
79
83
|
timeout: '# It is STRONGLY recommended to set your keychain to lock in 5 minutes or less.'
|
data/lib/awskeyring.rb
CHANGED
@@ -27,6 +27,8 @@ module Awskeyring # rubocop:disable Metrics/ModuleLength
|
|
27
27
|
DEFAULT_KEY_AGE = 90
|
28
28
|
# Default Console Paths
|
29
29
|
DEFAULT_CONSOLE_LIST = %w[cloudformation ec2/v2 iam rds route53 s3 sns sqs vpc].freeze
|
30
|
+
# Default Browsers
|
31
|
+
DEFAULT_BROWSER_LIST = %w[Brave FireFox Opera Safari Vivaldi].freeze
|
30
32
|
|
31
33
|
# Retrieve the preferences
|
32
34
|
#
|
@@ -174,26 +176,26 @@ module Awskeyring # rubocop:disable Metrics/ModuleLength
|
|
174
176
|
|
175
177
|
# Return a list account item names
|
176
178
|
def self.list_account_names
|
177
|
-
items = list_items.map { |elem| elem.attributes[:label][(ACCOUNT_PREFIX.length)
|
179
|
+
items = list_items.map { |elem| elem.attributes[:label][(ACCOUNT_PREFIX.length)..] }
|
178
180
|
|
179
|
-
tokens = list_tokens.map { |elem| elem.attributes[:label][(SESSION_KEY_PREFIX.length)
|
181
|
+
tokens = list_tokens.map { |elem| elem.attributes[:label][(SESSION_KEY_PREFIX.length)..] }
|
180
182
|
|
181
183
|
(items + tokens).uniq.sort
|
182
184
|
end
|
183
185
|
|
184
186
|
# Return a list role item names
|
185
187
|
def self.list_role_names
|
186
|
-
list_roles.map { |elem| elem.attributes[:label][(ROLE_PREFIX.length)
|
188
|
+
list_roles.map { |elem| elem.attributes[:label][(ROLE_PREFIX.length)..] }.sort
|
187
189
|
end
|
188
190
|
|
189
191
|
# Return a list token item names
|
190
192
|
def self.list_token_names
|
191
|
-
list_tokens.map { |elem| elem.attributes[:label][(SESSION_KEY_PREFIX.length)
|
193
|
+
list_tokens.map { |elem| elem.attributes[:label][(SESSION_KEY_PREFIX.length)..] }.sort
|
192
194
|
end
|
193
195
|
|
194
196
|
# Return a list role item names and arns
|
195
197
|
def self.list_role_names_plus
|
196
|
-
list_roles.map { |elem| "#{elem.attributes[:label][(ROLE_PREFIX.length)
|
198
|
+
list_roles.map { |elem| "#{elem.attributes[:label][(ROLE_PREFIX.length)..]}\t#{elem.attributes[:account]}" }
|
197
199
|
end
|
198
200
|
|
199
201
|
# Return a list of console paths
|
@@ -201,6 +203,11 @@ module Awskeyring # rubocop:disable Metrics/ModuleLength
|
|
201
203
|
prefs.key?('console') ? prefs['console'] : DEFAULT_CONSOLE_LIST
|
202
204
|
end
|
203
205
|
|
206
|
+
# Return a list of browserss
|
207
|
+
def self.list_browsers
|
208
|
+
prefs.key?('browser') ? prefs['browser'] : DEFAULT_BROWSER_LIST
|
209
|
+
end
|
210
|
+
|
204
211
|
# Return Key age warning number
|
205
212
|
def self.key_age
|
206
213
|
prefs.key?('keyage') ? prefs['keyage'] : DEFAULT_KEY_AGE
|
data/lib/awskeyring/awsapi.rb
CHANGED
@@ -27,6 +27,7 @@ module Awskeyring
|
|
27
27
|
AWS_ACCOUNT_NAME
|
28
28
|
AWS_ACCESS_KEY_ID
|
29
29
|
AWS_ACCESS_KEY
|
30
|
+
AWS_CREDENTIAL_EXPIRATION
|
30
31
|
AWS_SECRET_ACCESS_KEY
|
31
32
|
AWS_SECRET_KEY
|
32
33
|
AWS_SECURITY_TOKEN
|
@@ -126,6 +127,8 @@ module Awskeyring
|
|
126
127
|
env_var = {}
|
127
128
|
env_var['AWS_DEFAULT_REGION'] = 'us-east-1' unless region
|
128
129
|
|
130
|
+
params[:expiration] = Time.at(params[:expiry]).iso8601 unless params[:expiry].nil?
|
131
|
+
|
129
132
|
params.each_key do |param_name|
|
130
133
|
AWS_ENV_VARS.each do |var_name|
|
131
134
|
if var_name.include?(param_name.to_s.upcase) && !params[param_name].nil?
|
@@ -142,7 +145,7 @@ module Awskeyring
|
|
142
145
|
# @param [String] key The aws_access_key_id
|
143
146
|
# @param [String] secret The aws_secret_access_key
|
144
147
|
# @param [String] token The aws_session_token
|
145
|
-
def self.verify_cred(key:, secret:, token:)
|
148
|
+
def self.verify_cred(key:, secret:, token: nil)
|
146
149
|
begin
|
147
150
|
ENV['AWS_DEFAULT_REGION'] = 'us-east-1' unless region
|
148
151
|
sts = Aws::STS::Client.new(access_key_id: key, secret_access_key: secret, session_token: token)
|
@@ -198,9 +201,9 @@ module Awskeyring
|
|
198
201
|
sessionToken: token
|
199
202
|
}.to_json
|
200
203
|
|
201
|
-
destination_param =
|
204
|
+
destination_param = "&Destination=#{CGI.escape(console_url)}"
|
202
205
|
|
203
|
-
AWS_SIGNIN_URL
|
206
|
+
"#{AWS_SIGNIN_URL}?Action=login#{token_param(session_json: session_json)}#{destination_param}"
|
204
207
|
end
|
205
208
|
|
206
209
|
# Get the signin token param
|
@@ -214,7 +217,7 @@ module Awskeyring
|
|
214
217
|
returned_content = request.get(uri).body
|
215
218
|
|
216
219
|
signin_token = JSON.parse(returned_content)['SigninToken']
|
217
|
-
|
220
|
+
"&SigninToken=#{CGI.escape(signin_token)}"
|
218
221
|
end
|
219
222
|
|
220
223
|
# Get the current region
|
data/lib/awskeyring/input.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'io/console'
|
4
|
-
|
5
3
|
# Awskeyring Module,
|
6
4
|
module Awskeyring
|
7
5
|
# Input methods for Awskeyring
|
@@ -15,18 +13,20 @@ module Awskeyring
|
|
15
13
|
end
|
16
14
|
|
17
15
|
private_class_method def self.hide_input # rubocop:disable Metrics/MethodLength
|
16
|
+
require 'io/console'
|
18
17
|
password = +''
|
19
18
|
loop do
|
20
19
|
character = $stdin.getch
|
21
20
|
break unless character
|
22
21
|
|
23
|
-
|
22
|
+
case character
|
23
|
+
when "\n", "\r"
|
24
24
|
puts ''
|
25
25
|
break
|
26
|
-
|
26
|
+
when "\b", "\u007f"
|
27
27
|
password.chop!
|
28
28
|
print "\b\e[P"
|
29
|
-
|
29
|
+
when "\u0003"
|
30
30
|
exit 1
|
31
31
|
else
|
32
32
|
print '*'
|
data/lib/awskeyring/version.rb
CHANGED
data/lib/awskeyring_command.rb
CHANGED
@@ -72,6 +72,10 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
72
72
|
desc 'list', I18n.t('list.desc')
|
73
73
|
# list the accounts
|
74
74
|
def list
|
75
|
+
if Awskeyring.list_account_names.empty?
|
76
|
+
warn I18n.t('message.missing_account', bin: File.basename($PROGRAM_NAME))
|
77
|
+
exit 1
|
78
|
+
end
|
75
79
|
puts Awskeyring.list_account_names.join("\n")
|
76
80
|
end
|
77
81
|
|
@@ -80,7 +84,11 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
80
84
|
method_option 'detail', type: :boolean, aliases: '-d', desc: I18n.t('method_option.detail'), default: false
|
81
85
|
# List roles
|
82
86
|
def list_role
|
83
|
-
if
|
87
|
+
if Awskeyring.list_role_names.empty?
|
88
|
+
warn I18n.t('message.missing_role', bin: File.basename($PROGRAM_NAME))
|
89
|
+
exit 1
|
90
|
+
end
|
91
|
+
if options[:detail]
|
84
92
|
puts Awskeyring.list_role_names_plus.join("\n")
|
85
93
|
else
|
86
94
|
puts Awskeyring.list_role_names.join("\n")
|
@@ -92,7 +100,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
92
100
|
method_option 'unset', type: :boolean, aliases: '-u', desc: I18n.t('method_option.unset'), default: false
|
93
101
|
# Print Env vars
|
94
102
|
def env(account = nil)
|
95
|
-
if options[
|
103
|
+
if options[:unset]
|
96
104
|
put_env_string(account: nil, key: nil, secret: nil, token: nil)
|
97
105
|
else
|
98
106
|
account = ask_check(
|
@@ -160,6 +168,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
160
168
|
|
161
169
|
desc 'exec ACCOUNT command...', I18n.t('exec.desc')
|
162
170
|
method_option 'no-token', type: :boolean, aliases: '-n', desc: I18n.t('method_option.notoken'), default: false
|
171
|
+
method_option 'no-bundle', type: :boolean, aliases: '-b', desc: I18n.t('method_option.nobundle'), default: false
|
163
172
|
# execute an external command with env set
|
164
173
|
def exec(account, *command)
|
165
174
|
if command.empty?
|
@@ -168,6 +177,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
168
177
|
end
|
169
178
|
cred = age_check_and_get(account: account, no_token: options['no-token'])
|
170
179
|
env_vars = Awskeyring::Awsapi.get_env_array(cred)
|
180
|
+
unbundle if options['no-bundle']
|
171
181
|
begin
|
172
182
|
pid = Process.spawn(env_vars, command.join(' '))
|
173
183
|
Process.wait pid
|
@@ -199,7 +209,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
199
209
|
existing: options[:mfa], message: I18n.t('message.mfa'),
|
200
210
|
flags: 'optional', validator: Awskeyring::Validate.method(:mfa_arn)
|
201
211
|
)
|
202
|
-
Awskeyring::Awsapi.verify_cred(key: key, secret: secret
|
212
|
+
Awskeyring::Awsapi.verify_cred(key: key, secret: secret) unless options['no-remote']
|
203
213
|
Awskeyring.add_account(
|
204
214
|
account: account,
|
205
215
|
key: key,
|
@@ -377,6 +387,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
377
387
|
|
378
388
|
desc 'console ACCOUNT', I18n.t('console.desc')
|
379
389
|
method_option :path, type: :string, aliases: '-p', desc: I18n.t('method_option.path')
|
390
|
+
method_option :browser, type: :string, aliases: '-b', desc: I18n.t('method_option.browser')
|
380
391
|
method_option 'no-token', type: :boolean, aliases: '-n', desc: I18n.t('method_option.notoken'), default: false
|
381
392
|
method_option 'no-open', type: :boolean, aliases: '-o', desc: I18n.t('method_option.noopen'), default: false
|
382
393
|
# Open the AWS Console
|
@@ -407,7 +418,8 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
407
418
|
if options['no-open']
|
408
419
|
puts login_url
|
409
420
|
else
|
410
|
-
|
421
|
+
spawn_cmd = options[:browser] ? "open -a \"#{options[:browser]}\" \"#{login_url}\"" : "open \"#{login_url}\""
|
422
|
+
pid = Process.spawn(spawn_cmd)
|
411
423
|
Process.wait pid
|
412
424
|
end
|
413
425
|
end
|
@@ -450,9 +462,11 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
450
462
|
when 'remove-role', '-r', 'rmr'
|
451
463
|
comp_len = 2
|
452
464
|
when '--path', '-p'
|
453
|
-
comp_len =
|
465
|
+
comp_len = 40
|
454
466
|
when 'remove-token', 'rmt'
|
455
|
-
comp_len =
|
467
|
+
comp_len = 50
|
468
|
+
when '--browser', '-b'
|
469
|
+
comp_len = 60
|
456
470
|
end
|
457
471
|
|
458
472
|
[curr, comp_len, sub_cmd]
|
@@ -477,12 +491,14 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
477
491
|
list = Awskeyring.list_account_names
|
478
492
|
when 2
|
479
493
|
list = Awskeyring.list_role_names
|
480
|
-
when 3
|
494
|
+
when 3..10
|
481
495
|
list = list_arguments(command: sub_cmd)
|
482
|
-
when
|
496
|
+
when 40
|
483
497
|
list = Awskeyring.list_console_path
|
484
|
-
when
|
498
|
+
when 50
|
485
499
|
list = Awskeyring.list_token_names
|
500
|
+
when 60
|
501
|
+
list = Awskeyring.list_browsers
|
486
502
|
else
|
487
503
|
exit 1
|
488
504
|
end
|
@@ -537,13 +553,26 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
537
553
|
|
538
554
|
def ask(message:, secure: false, optional: false, limited_to: nil)
|
539
555
|
if secure
|
540
|
-
Awskeyring::Input.read_secret(message.rjust(20)
|
556
|
+
Awskeyring::Input.read_secret("#{message.rjust(20)}: ")
|
541
557
|
elsif optional
|
542
|
-
Thor::LineEditor.readline(
|
558
|
+
Thor::LineEditor.readline("#{"#{message} (optional)".rjust(20)}: ")
|
543
559
|
elsif limited_to
|
544
|
-
Thor::LineEditor.readline(message.rjust(20)
|
560
|
+
Thor::LineEditor.readline("#{message.rjust(20)}: ", limited_to: limited_to)
|
545
561
|
else
|
546
|
-
Thor::LineEditor.readline(message.rjust(20)
|
562
|
+
Thor::LineEditor.readline("#{message.rjust(20)}: ")
|
563
|
+
end
|
564
|
+
end
|
565
|
+
|
566
|
+
def unbundle
|
567
|
+
to_delete = ENV.keys.select { |elem| elem.start_with?('BUNDLER_ORIG_') }
|
568
|
+
bundled_env = to_delete.map { |elem| elem[('BUNDLER_ORIG_'.length)..] }
|
569
|
+
to_delete << 'BUNDLE_GEMFILE'
|
570
|
+
bundled_env.each do |env_name|
|
571
|
+
ENV[env_name] = ENV["BUNDLER_ORIG_#{env_name}"]
|
572
|
+
to_delete << env_name if ENV["BUNDLER_ORIG_#{env_name}"].start_with? 'BUNDLER_'
|
573
|
+
end
|
574
|
+
to_delete.each do |env_name|
|
575
|
+
ENV.delete(env_name)
|
547
576
|
end
|
548
577
|
end
|
549
578
|
end
|
data/man/awskeyring.5
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "AWSKEYRING" "5" "
|
4
|
+
.TH "AWSKEYRING" "5" "November 2020" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBAwskeyring\fR \- is a small tool to manage AWS account keys in the macOS Keychain
|
@@ -24,36 +24,90 @@ The commands are as follows:
|
|
24
24
|
.IP
|
25
25
|
Prints the version
|
26
26
|
.
|
27
|
+
.br
|
28
|
+
.
|
29
|
+
.IP
|
30
|
+
\-r, \-\-no\-remote: Do not validate with remote api\.
|
31
|
+
.
|
27
32
|
.TP
|
28
33
|
add ACCOUNT:
|
29
34
|
.
|
30
35
|
.IP
|
31
36
|
Adds an ACCOUNT to the keyring
|
32
37
|
.
|
38
|
+
.br
|
39
|
+
.
|
40
|
+
.IP
|
41
|
+
\-k, \-\-key=KEY: AWS account key id\.
|
42
|
+
.
|
43
|
+
.br
|
44
|
+
\-s, \-\-secret=SECRET: AWS account secret\.
|
45
|
+
.
|
46
|
+
.br
|
47
|
+
\-m, \-\-mfa=MFA: AWS virtual mfa arn\.
|
48
|
+
.
|
49
|
+
.br
|
50
|
+
\-r, \-\-no\-remote: Do not validate with remote api\.
|
51
|
+
.
|
33
52
|
.TP
|
34
53
|
add\-role ROLE:
|
35
54
|
.
|
36
55
|
.IP
|
37
56
|
Adds a ROLE to the keyring
|
38
57
|
.
|
58
|
+
.br
|
59
|
+
.
|
60
|
+
.IP
|
61
|
+
\-a, \-\-arn=ARN: AWS role arn\.
|
62
|
+
.
|
39
63
|
.TP
|
40
|
-
console ACCOUNT:
|
64
|
+
awskeyring console ACCOUNT:
|
41
65
|
.
|
42
66
|
.IP
|
43
67
|
Open the AWS Console for the ACCOUNT
|
44
68
|
.
|
69
|
+
.br
|
70
|
+
.
|
71
|
+
.IP
|
72
|
+
\-p, \-\-path=PATH: The service PATH to open\.
|
73
|
+
.
|
74
|
+
.br
|
75
|
+
\-b, \-\-browser=BROWSER: Specify an alternative browser\.
|
76
|
+
.
|
77
|
+
.br
|
78
|
+
\-n, \-\-no\-token: Do not use saved token\.
|
79
|
+
.
|
80
|
+
.br
|
81
|
+
\-o, \-\-no\-open: Do not open the url\.
|
82
|
+
.
|
45
83
|
.TP
|
46
84
|
env ACCOUNT:
|
47
85
|
.
|
48
86
|
.IP
|
49
87
|
Outputs bourne shell environment exports for an ACCOUNT
|
50
88
|
.
|
89
|
+
.br
|
90
|
+
.
|
91
|
+
.IP
|
92
|
+
\-n, \-\-no\-token: Do not use saved token\.
|
93
|
+
.
|
94
|
+
.br
|
95
|
+
\-u, \-\-unset, \-\-no\-unset: Unset environment variables\.
|
96
|
+
.
|
51
97
|
.TP
|
52
98
|
exec ACCOUNT command\.\.\.:
|
53
99
|
.
|
54
100
|
.IP
|
55
101
|
Execute a COMMAND with the environment set for an ACCOUNT
|
56
102
|
.
|
103
|
+
.br
|
104
|
+
.
|
105
|
+
.IP
|
106
|
+
\-n, \-\-no\-token: Do not use saved token\.
|
107
|
+
.
|
108
|
+
.br
|
109
|
+
\-b, \-\-no\-bundle: Unset Bundler environment variables\.
|
110
|
+
.
|
57
111
|
.TP
|
58
112
|
help [COMMAND]:
|
59
113
|
.
|
@@ -66,18 +120,33 @@ import:
|
|
66
120
|
.IP
|
67
121
|
Import an ACCOUNT to the keyring from ~/\.aws/credentials
|
68
122
|
.
|
123
|
+
.br
|
124
|
+
.
|
125
|
+
.IP
|
126
|
+
\-r, \-\-no\-remote: Do not validate with remote api\.
|
127
|
+
.
|
69
128
|
.TP
|
70
129
|
initialise:
|
71
130
|
.
|
72
131
|
.IP
|
73
132
|
Initialises a new KEYCHAIN
|
74
133
|
.
|
134
|
+
.br
|
135
|
+
.
|
136
|
+
.IP
|
137
|
+
\-n, \-\-keychain=KEYCHAIN: Name of KEYCHAIN to initialise\.
|
138
|
+
.
|
75
139
|
.TP
|
76
140
|
json ACCOUNT:
|
77
141
|
.
|
78
142
|
.IP
|
79
143
|
Outputs AWS CLI compatible JSON for an ACCOUNT
|
80
144
|
.
|
145
|
+
.br
|
146
|
+
.
|
147
|
+
.IP
|
148
|
+
\-n, \-\-no\-token: Do not use saved token\.
|
149
|
+
.
|
81
150
|
.TP
|
82
151
|
list:
|
83
152
|
.
|
@@ -90,6 +159,11 @@ list\-role:
|
|
90
159
|
.IP
|
91
160
|
Prints a list of roles in the keyring
|
92
161
|
.
|
162
|
+
.br
|
163
|
+
.
|
164
|
+
.IP
|
165
|
+
\-d, \-\-detail, \-\-no\-detail: Show more detail\.
|
166
|
+
.
|
93
167
|
.TP
|
94
168
|
remove ACCOUNT:
|
95
169
|
.
|
@@ -120,12 +194,34 @@ token ACCOUNT [ROLE] [MFA]:
|
|
120
194
|
.IP
|
121
195
|
Create an STS Token from a ROLE or an MFA code
|
122
196
|
.
|
197
|
+
.br
|
198
|
+
.
|
199
|
+
.IP
|
200
|
+
\-r, \-\-role=ROLE: The ROLE to assume\.
|
201
|
+
.
|
202
|
+
.br
|
203
|
+
\-c, \-\-code=CODE: Virtual mfa CODE\.
|
204
|
+
.
|
205
|
+
.br
|
206
|
+
\-d, \-\-duration=DURATION: Session DURATION in seconds\.
|
207
|
+
.
|
123
208
|
.TP
|
124
209
|
update ACCOUNT:
|
125
210
|
.
|
126
211
|
.IP
|
127
212
|
Updates an ACCOUNT in the keyring
|
128
213
|
.
|
214
|
+
.br
|
215
|
+
.
|
216
|
+
.IP
|
217
|
+
\-k, \-\-key=KEY: AWS account key id\.
|
218
|
+
.
|
219
|
+
.br
|
220
|
+
\-s, \-\-secret=SECRET: AWS account secret\.
|
221
|
+
.
|
222
|
+
.br
|
223
|
+
\-r, \-\-no\-remote: Do not validate with remote api\.
|
224
|
+
.
|
129
225
|
.SH "ENVIRONMENT"
|
130
226
|
The AWS_DEFAULT_REGION environment variable will be used for AWS API calls where specified or fall back to us\-east\-1 when not\.
|
131
227
|
.
|
@@ -188,6 +284,9 @@ Tristan tristanmorgan \fIhttps://github\.com/tristanmorgan\fR
|
|
188
284
|
.IP "\(bu" 4
|
189
285
|
Adam Sir AzySir \fIhttps://github\.com/AzySir\fR
|
190
286
|
.
|
287
|
+
.IP "\(bu" 4
|
288
|
+
Vito Giarrusso thtliife \fIhttps://github\.com/thtliife\fR
|
289
|
+
.
|
191
290
|
.IP "" 0
|
192
291
|
.
|
193
292
|
.SH "LICENSE"
|
data/man/awskeyring.5.ronn
CHANGED
@@ -16,27 +16,47 @@ The commands are as follows:
|
|
16
16
|
|
17
17
|
* --version, -v:
|
18
18
|
|
19
|
-
Prints the version
|
19
|
+
Prints the version<br>
|
20
|
+
|
21
|
+
-r, --no-remote: Do not validate with remote api.
|
20
22
|
|
21
23
|
* add ACCOUNT:
|
22
24
|
|
23
|
-
Adds an ACCOUNT to the keyring
|
25
|
+
Adds an ACCOUNT to the keyring<br>
|
26
|
+
|
27
|
+
-k, --key=KEY: AWS account key id.<br>
|
28
|
+
-s, --secret=SECRET: AWS account secret.<br>
|
29
|
+
-m, --mfa=MFA: AWS virtual mfa arn.<br>
|
30
|
+
-r, --no-remote: Do not validate with remote api.
|
24
31
|
|
25
32
|
* add-role ROLE:
|
26
33
|
|
27
|
-
Adds a ROLE to the keyring
|
34
|
+
Adds a ROLE to the keyring<br>
|
35
|
+
|
36
|
+
-a, --arn=ARN: AWS role arn.
|
37
|
+
|
38
|
+
* awskeyring console ACCOUNT:
|
28
39
|
|
29
|
-
|
40
|
+
Open the AWS Console for the ACCOUNT<br>
|
30
41
|
|
31
|
-
|
42
|
+
-p, --path=PATH: The service PATH to open.<br>
|
43
|
+
-b, --browser=BROWSER: Specify an alternative browser.<br>
|
44
|
+
-n, --no-token: Do not use saved token.<br>
|
45
|
+
-o, --no-open: Do not open the url.
|
32
46
|
|
33
47
|
* env ACCOUNT:
|
34
48
|
|
35
|
-
Outputs bourne shell environment exports for an ACCOUNT
|
49
|
+
Outputs bourne shell environment exports for an ACCOUNT<br>
|
50
|
+
|
51
|
+
-n, --no-token: Do not use saved token.<br>
|
52
|
+
-u, --unset, --no-unset: Unset environment variables.
|
36
53
|
|
37
54
|
* exec ACCOUNT command...:
|
38
55
|
|
39
|
-
Execute a COMMAND with the environment set for an ACCOUNT
|
56
|
+
Execute a COMMAND with the environment set for an ACCOUNT<br>
|
57
|
+
|
58
|
+
-n, --no-token: Do not use saved token.<br>
|
59
|
+
-b, --no-bundle: Unset Bundler environment variables.
|
40
60
|
|
41
61
|
* help [COMMAND]:
|
42
62
|
|
@@ -44,15 +64,21 @@ The commands are as follows:
|
|
44
64
|
|
45
65
|
* import:
|
46
66
|
|
47
|
-
Import an ACCOUNT to the keyring from ~/.aws/credentials
|
67
|
+
Import an ACCOUNT to the keyring from ~/.aws/credentials<br>
|
68
|
+
|
69
|
+
-r, --no-remote: Do not validate with remote api.
|
48
70
|
|
49
71
|
* initialise:
|
50
72
|
|
51
|
-
Initialises a new KEYCHAIN
|
73
|
+
Initialises a new KEYCHAIN<br>
|
74
|
+
|
75
|
+
-n, --keychain=KEYCHAIN: Name of KEYCHAIN to initialise.
|
52
76
|
|
53
77
|
* json ACCOUNT:
|
54
78
|
|
55
|
-
Outputs AWS CLI compatible JSON for an ACCOUNT
|
79
|
+
Outputs AWS CLI compatible JSON for an ACCOUNT<br>
|
80
|
+
|
81
|
+
-n, --no-token: Do not use saved token.
|
56
82
|
|
57
83
|
* list:
|
58
84
|
|
@@ -60,7 +86,9 @@ The commands are as follows:
|
|
60
86
|
|
61
87
|
* list-role:
|
62
88
|
|
63
|
-
Prints a list of roles in the keyring
|
89
|
+
Prints a list of roles in the keyring<br>
|
90
|
+
|
91
|
+
-d, --detail, --no-detail: Show more detail.
|
64
92
|
|
65
93
|
* remove ACCOUNT:
|
66
94
|
|
@@ -80,11 +108,19 @@ The commands are as follows:
|
|
80
108
|
|
81
109
|
* token ACCOUNT [ROLE] [MFA]:
|
82
110
|
|
83
|
-
Create an STS Token from a ROLE or an MFA code
|
111
|
+
Create an STS Token from a ROLE or an MFA code<br>
|
112
|
+
|
113
|
+
-r, --role=ROLE: The ROLE to assume.<br>
|
114
|
+
-c, --code=CODE: Virtual mfa CODE.<br>
|
115
|
+
-d, --duration=DURATION: Session DURATION in seconds.
|
84
116
|
|
85
117
|
* update ACCOUNT:
|
86
118
|
|
87
|
-
Updates an ACCOUNT in the keyring
|
119
|
+
Updates an ACCOUNT in the keyring<br>
|
120
|
+
|
121
|
+
-k, --key=KEY: AWS account key id.<br>
|
122
|
+
-s, --secret=SECRET: AWS account secret.<br>
|
123
|
+
-r, --no-remote: Do not validate with remote api.
|
88
124
|
|
89
125
|
## ENVIRONMENT
|
90
126
|
|
@@ -132,6 +168,7 @@ Tristan Morgan <tristan.morgan@servian.com> is the maintainer of Awskeyring.
|
|
132
168
|
|
133
169
|
* Tristan [tristanmorgan](https://github.com/tristanmorgan)
|
134
170
|
* Adam Sir [AzySir](https://github.com/AzySir)
|
171
|
+
* Vito Giarrusso [thtliife](https://github.com/thtliife)
|
135
172
|
|
136
173
|
## LICENSE
|
137
174
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awskeyring
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tristan Morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-iam
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- LICENSE.txt
|
81
81
|
- README.md
|
82
82
|
- Rakefile
|
83
|
+
- SECURITY.md
|
83
84
|
- awskeyring.gemspec
|
84
85
|
- exe/awskeyring
|
85
86
|
- i18n/en.yml
|
@@ -96,9 +97,9 @@ licenses:
|
|
96
97
|
- MIT
|
97
98
|
metadata:
|
98
99
|
bug_tracker_uri: https://github.com/servian/awskeyring/issues
|
99
|
-
changelog_uri: https://github.com/servian/awskeyring/blob/
|
100
|
-
documentation_uri: https://rubydoc.info/gems/awskeyring/1.
|
101
|
-
source_code_uri: https://github.com/servian/awskeyring/tree/v1.
|
100
|
+
changelog_uri: https://github.com/servian/awskeyring/blob/main/CHANGELOG.md
|
101
|
+
documentation_uri: https://rubydoc.info/gems/awskeyring/1.8.1
|
102
|
+
source_code_uri: https://github.com/servian/awskeyring/tree/v1.8.1
|
102
103
|
wiki_uri: https://github.com/servian/awskeyring/wiki
|
103
104
|
post_install_message:
|
104
105
|
rdoc_options: []
|
@@ -108,7 +109,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
108
109
|
requirements:
|
109
110
|
- - ">="
|
110
111
|
- !ruby/object:Gem::Version
|
111
|
-
version:
|
112
|
+
version: 2.6.0
|
112
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
114
|
requirements:
|
114
115
|
- - ">="
|