awskeyring 1.6.0 → 1.8.3

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
  SHA256:
3
- metadata.gz: c8bf8ca4f1b8acb13b25ac0c3a362afcf390e5e8e8d5f1e42b1c4c68748f0149
4
- data.tar.gz: 3693e3e8d7a9fa30ab1430cea360cd32c85c98a22a9ae68a725f236c335afe2b
3
+ metadata.gz: 3ea94b3d72f37d363e05a9d5cbcb7833a4039368b4ebe8f32a0d24b29bdb0e7b
4
+ data.tar.gz: 358d4bab4128a8e0defa2a1736c4e05820f2ec11e58e4c0c4d29489da94d892e
5
5
  SHA512:
6
- metadata.gz: 7c786f1bf73ccbe18f3c259824dfbc60bcbcf70e611916b70b8349fd9a40350f045b7e5b8e676e71bbf7bb0feadba76f54da28816cf18c32dd7a2d7acdc1d3e0
7
- data.tar.gz: 5a03251d5b09208802a0790b2d52dcfa3a581394e3cd041e79cf69fa39fbd298ec8e76ae47b237342f360402d85ea5b6512f7eea89163157dcff5fd7bbd946a5
6
+ metadata.gz: 402911d7d34d2f496c245dab3629ed55da0c21d4bd821829258db7221b54aac69fdaee8871984aae308cbe25576e2e6de493b362c8ef22bfc75987e8b0129ec0
7
+ data.tar.gz: 8dd73f4b26dfcf6173b1d8e8b3db16747110cc49a2bc120df425c789ff7025a93959becb526467393bd33eb832febb66c5fb86f00b1d61eebcd7091b126fbde0
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2017 Tristan Morgan
3
+ Copyright (c) 2017-2021 Tristan Morgan
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Awskeyring
2
2
 
3
- ![Awskeyring](https://raw.githubusercontent.com/servian/awskeyring/master/awskeyring-144.png)
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=master)](https://travis-ci.org/servian/awskeyring)
5
+ * [![Build Status](https://travis-ci.com/servian/awskeyring.svg?branch=main)](https://travis-ci.com/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.
@@ -57,7 +61,7 @@ more details on this config option.
57
61
 
58
62
  The CLI is using [Thor](http://whatisthor.com) with help provided interactively.
59
63
 
60
- Commands:
64
+ Awskeyring commands:
61
65
  awskeyring --version, -v # Prints the version
62
66
  awskeyring add ACCOUNT # Adds an ACCOUNT to the keyring
63
67
  awskeyring add-role ROLE # Adds a ROLE to the keyring
@@ -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/Rakefile CHANGED
@@ -59,4 +59,5 @@ YARD::Rake::YardocTask.new do |t|
59
59
  t.stats_options = ['--list-undoc']
60
60
  end
61
61
 
62
+ desc 'Run Linting, Tests and Documetation tasks'
62
63
  task default: %i[filemode rubocop spec ronn yard]
data/awskeyring.gemspec CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
15
15
  spec.homepage = Awskeyring::HOMEPAGE
16
16
  spec.licenses = ['MIT']
17
17
 
18
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/|^\..*|^.*\.png}) }
18
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/|^\..*|C.*\.md|.*\.ronn|.*\.png}) }
19
19
  spec.bindir = 'exe'
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ['lib']
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
 
25
25
  spec.metadata = {
26
26
  'bug_tracker_uri' => "#{Awskeyring::HOMEPAGE}/issues",
27
- 'changelog_uri' => "#{Awskeyring::HOMEPAGE}/blob/master/CHANGELOG.md",
27
+ 'changelog_uri' => "#{Awskeyring::HOMEPAGE}/blob/main/CHANGELOG.md",
28
28
  'documentation_uri' => "https://rubydoc.info/gems/#{spec.name}/#{Awskeyring::VERSION}",
29
29
  'source_code_uri' => "#{Awskeyring::HOMEPAGE}/tree/v#{Awskeyring::VERSION}",
30
30
  'wiki_uri' => "#{Awskeyring::HOMEPAGE}/wiki"
data/i18n/en.yml CHANGED
@@ -1,41 +1,24 @@
1
1
  ---
2
2
  en:
3
- __version:
4
- desc: Prints the version
5
- add:
6
- desc: Adds an ACCOUNT to the keyring
7
- add_role:
8
- desc: Adds a ROLE to the keyring
9
- awskeyring:
10
- desc: Autocompletion for bourne shells
11
- console:
12
- desc: Open the AWS Console for the ACCOUNT
13
- env:
14
- desc: Outputs bourne shell environment exports for an ACCOUNT
15
- exec:
16
- desc: Execute a COMMAND with the environment set for an ACCOUNT
17
- import:
18
- desc: Import an ACCOUNT to the keyring from ~/.aws/credentials
19
- initialise:
20
- desc: Initialises a new KEYCHAIN
21
- json:
22
- desc: Outputs AWS CLI compatible JSON for an ACCOUNT
23
- list:
24
- desc: Prints a list of accounts in the keyring
25
- list_role:
26
- desc: Prints a list of roles in the keyring
27
- remove:
28
- desc: Removes an ACCOUNT from the keyring
29
- remove_role:
30
- desc: Removes a ROLE from the keyring
31
- remove_token:
32
- desc: Removes a token for ACCOUNT from the keyring
33
- rotate:
34
- desc: Rotate access keys for an ACCOUNT
35
- token:
36
- desc: Create an STS Token from a ROLE or an MFA code
37
- update:
38
- desc: Updates an ACCOUNT in the keyring
3
+ __version_desc: Prints the version
4
+ add_desc: Adds an ACCOUNT to the keyring
5
+ add_role_desc: Adds a ROLE to the keyring
6
+ awskeyring_desc: Autocompletion for bourne shells
7
+ console_desc: Open the AWS Console for the ACCOUNT
8
+ default_desc: Run default help or initialise if needed.
9
+ env_desc: Outputs bourne shell environment exports for an ACCOUNT
10
+ exec_desc: Execute a COMMAND with the environment set for an ACCOUNT
11
+ import_desc: Import an ACCOUNT to the keyring from ~/.aws/credentials
12
+ initialise_desc: Initialises a new KEYCHAIN
13
+ json_desc: Outputs AWS CLI compatible JSON for an ACCOUNT
14
+ list_desc: Prints a list of accounts in the keyring
15
+ list_role_desc: Prints a list of roles in the keyring
16
+ remove_desc: Removes an ACCOUNT from the keyring
17
+ remove_role_desc: Removes a ROLE from the keyring
18
+ remove_token_desc: Removes a token for ACCOUNT from the keyring
19
+ rotate_desc: Rotate access keys for an ACCOUNT
20
+ token_desc: Create an STS Token from a ROLE or an MFA code
21
+ update_desc: Updates an ACCOUNT in the keyring
39
22
  method_option:
40
23
  arn: 'AWS role arn.'
41
24
  code: 'Virtual mfa CODE.'
@@ -49,6 +32,7 @@ en:
49
32
  notoken: 'Do not use saved token.'
50
33
  noremote: 'Do not validate with remote api.'
51
34
  path: 'The service PATH to open.'
35
+ browser: 'Specify an alternative browser.'
52
36
  role: 'The ROLE to assume.'
53
37
  secret: 'AWS account secret.'
54
38
  unset: 'Unset environment variables.'
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
  #
@@ -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
@@ -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)
@@ -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
- if ["\n", "\r"].include? character
22
+ case character
23
+ when "\n", "\r"
24
24
  puts ''
25
25
  break
26
- elsif ["\b", "\u007f"].include? character
26
+ when "\b", "\u007f"
27
27
  password.chop!
28
28
  print "\b\e[P"
29
- elsif character == "\u0003"
29
+ when "\u0003"
30
30
  exit 1
31
31
  else
32
32
  print '*'
@@ -6,7 +6,7 @@ require 'json'
6
6
  # Version const and query of latest.
7
7
  module Awskeyring
8
8
  # The Gem's version number
9
- VERSION = '1.6.0'
9
+ VERSION = '1.8.3'
10
10
  # The Gem's homepage
11
11
  HOMEPAGE = 'https://github.com/servian/awskeyring'
12
12
 
@@ -11,29 +11,41 @@ require 'awskeyring/version'
11
11
 
12
12
  # AWSkeyring command line interface.
13
13
  class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
14
+ package_name 'Awskeyring'
14
15
  I18n.load_path = Dir.glob(File.join(File.realpath(__dir__), '..', 'i18n', '*.{yml,yaml}'))
15
16
  I18n.backend.load_translations
16
17
 
17
18
  map %w[--version -v] => :__version
18
19
  map %w[--help -h] => :help
19
- map ['init'] => :initialise
20
- map ['adr'] => :add_role
21
- map ['con'] => :console
22
- map ['ls'] => :list
23
- map ['lsr'] => :list_role
24
- map ['rm'] => :remove
25
- map ['rmr'] => :remove_role
26
- map ['rmt'] => :remove_token
27
- map ['rot'] => :rotate
28
- map ['tok'] => :token
29
- map ['up'] => :update
20
+ map 'init' => :initialise
21
+ map 'adr' => :add_role
22
+ map 'con' => :console
23
+ map 'ls' => :list
24
+ map 'lsr' => :list_role
25
+ map 'rm' => :remove
26
+ map 'rmr' => :remove_role
27
+ map 'rmt' => :remove_token
28
+ map 'rot' => :rotate
29
+ map 'tok' => :token
30
+ map 'up' => :update
31
+ default_command :default
30
32
 
31
33
  # default to returning an error on failure.
32
34
  def self.exit_on_failure?
33
35
  true
34
36
  end
35
37
 
36
- desc '--version, -v', I18n.t('__version.desc')
38
+ desc 'default', I18n.t('default_desc'), hide: true
39
+ # default command to run
40
+ def default
41
+ if Awskeyring.prefs.empty?
42
+ invoke :initialise
43
+ else
44
+ invoke :help
45
+ end
46
+ end
47
+
48
+ desc '--version, -v', I18n.t('__version_desc')
37
49
  method_option 'no-remote', type: :boolean, aliases: '-r', desc: I18n.t('method_option.noremote'), default: false
38
50
  # print the version number
39
51
  def __version
@@ -44,7 +56,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
44
56
  puts "Homepage #{Awskeyring::HOMEPAGE}"
45
57
  end
46
58
 
47
- desc 'initialise', I18n.t('initialise.desc')
59
+ desc 'initialise', I18n.t('initialise_desc')
48
60
  method_option :keychain, type: :string, aliases: '-n', desc: I18n.t('method_option.keychain')
49
61
  # initialise the keychain
50
62
  def initialise
@@ -69,7 +81,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
69
81
  puts I18n.t('message.addkeychain', keychain: keychain, exec_name: exec_name)
70
82
  end
71
83
 
72
- desc 'list', I18n.t('list.desc')
84
+ desc 'list', I18n.t('list_desc')
73
85
  # list the accounts
74
86
  def list
75
87
  if Awskeyring.list_account_names.empty?
@@ -80,7 +92,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
80
92
  end
81
93
 
82
94
  map 'list-role' => :list_role
83
- desc 'list-role', I18n.t('list_role.desc')
95
+ desc 'list-role', I18n.t('list_role_desc')
84
96
  method_option 'detail', type: :boolean, aliases: '-d', desc: I18n.t('method_option.detail'), default: false
85
97
  # List roles
86
98
  def list_role
@@ -88,19 +100,19 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
88
100
  warn I18n.t('message.missing_role', bin: File.basename($PROGRAM_NAME))
89
101
  exit 1
90
102
  end
91
- if options['detail']
103
+ if options[:detail]
92
104
  puts Awskeyring.list_role_names_plus.join("\n")
93
105
  else
94
106
  puts Awskeyring.list_role_names.join("\n")
95
107
  end
96
108
  end
97
109
 
98
- desc 'env ACCOUNT', I18n.t('env.desc')
110
+ desc 'env ACCOUNT', I18n.t('env_desc')
99
111
  method_option 'no-token', type: :boolean, aliases: '-n', desc: I18n.t('method_option.notoken'), default: false
100
112
  method_option 'unset', type: :boolean, aliases: '-u', desc: I18n.t('method_option.unset'), default: false
101
113
  # Print Env vars
102
114
  def env(account = nil)
103
- if options['unset']
115
+ if options[:unset]
104
116
  put_env_string(account: nil, key: nil, secret: nil, token: nil)
105
117
  else
106
118
  account = ask_check(
@@ -113,7 +125,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
113
125
  end
114
126
  end
115
127
 
116
- desc 'json ACCOUNT', I18n.t('json.desc')
128
+ desc 'json ACCOUNT', I18n.t('json_desc')
117
129
  method_option 'no-token', type: :boolean, aliases: '-n', desc: I18n.t('method_option.notoken'), default: false
118
130
  # Print JSON for use with credential_process
119
131
  def json(account)
@@ -130,7 +142,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
130
142
  )
131
143
  end
132
144
 
133
- desc 'import ACCOUNT', I18n.t('import.desc')
145
+ desc 'import ACCOUNT', I18n.t('import_desc')
134
146
  method_option 'no-remote', type: :boolean, aliases: '-r', desc: I18n.t('method_option.noremote'), default: false
135
147
  # Import an Account
136
148
  def import(account = nil) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
@@ -166,7 +178,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
166
178
  end
167
179
  end
168
180
 
169
- desc 'exec ACCOUNT command...', I18n.t('exec.desc')
181
+ desc 'exec ACCOUNT command...', I18n.t('exec_desc')
170
182
  method_option 'no-token', type: :boolean, aliases: '-n', desc: I18n.t('method_option.notoken'), default: false
171
183
  method_option 'no-bundle', type: :boolean, aliases: '-b', desc: I18n.t('method_option.nobundle'), default: false
172
184
  # execute an external command with env set
@@ -188,7 +200,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
188
200
  end
189
201
  end
190
202
 
191
- desc 'add ACCOUNT', I18n.t('add.desc')
203
+ desc 'add ACCOUNT', I18n.t('add_desc')
192
204
  method_option :key, type: :string, aliases: '-k', desc: I18n.t('method_option.key')
193
205
  method_option :secret, type: :string, aliases: '-s', desc: I18n.t('method_option.secret')
194
206
  method_option :mfa, type: :string, aliases: '-m', desc: I18n.t('method_option.mfa')
@@ -209,7 +221,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
209
221
  existing: options[:mfa], message: I18n.t('message.mfa'),
210
222
  flags: 'optional', validator: Awskeyring::Validate.method(:mfa_arn)
211
223
  )
212
- Awskeyring::Awsapi.verify_cred(key: key, secret: secret, token: nil) unless options['no-remote']
224
+ Awskeyring::Awsapi.verify_cred(key: key, secret: secret) unless options['no-remote']
213
225
  Awskeyring.add_account(
214
226
  account: account,
215
227
  key: key,
@@ -219,7 +231,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
219
231
  puts I18n.t('message.addaccount', account: account)
220
232
  end
221
233
 
222
- desc 'update ACCOUNT', I18n.t('update.desc')
234
+ desc 'update ACCOUNT', I18n.t('update_desc')
223
235
  method_option :key, type: :string, aliases: '-k', desc: I18n.t('method_option.key')
224
236
  method_option :secret, type: :string, aliases: '-s', desc: I18n.t('method_option.secret')
225
237
  method_option 'no-remote', type: :boolean, aliases: '-r', desc: I18n.t('method_option.noremote'), default: false
@@ -247,7 +259,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
247
259
  end
248
260
 
249
261
  map 'add-role' => :add_role
250
- desc 'add-role ROLE', I18n.t('add_role.desc')
262
+ desc 'add-role ROLE', I18n.t('add_role_desc')
251
263
  method_option :arn, type: :string, aliases: '-a', desc: I18n.t('method_option.arn')
252
264
  # Add a role
253
265
  def add_role(role = nil)
@@ -267,7 +279,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
267
279
  puts I18n.t('message.addrole', role: role)
268
280
  end
269
281
 
270
- desc 'remove ACCOUNT', I18n.t('remove.desc')
282
+ desc 'remove ACCOUNT', I18n.t('remove_desc')
271
283
  # Remove an account
272
284
  def remove(account = nil)
273
285
  account = ask_check(
@@ -277,7 +289,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
277
289
  Awskeyring.delete_account(account: account, message: I18n.t('message.delaccount', account: account))
278
290
  end
279
291
 
280
- desc 'remove-token ACCOUNT', I18n.t('remove_token.desc')
292
+ desc 'remove-token ACCOUNT', I18n.t('remove_token_desc')
281
293
  # remove a session token
282
294
  def remove_token(account = nil)
283
295
  account = ask_check(
@@ -288,7 +300,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
288
300
  end
289
301
 
290
302
  map 'remove-role' => :remove_role
291
- desc 'remove-role ROLE', I18n.t('remove_role.desc')
303
+ desc 'remove-role ROLE', I18n.t('remove_role_desc')
292
304
  # remove a role
293
305
  def remove_role(role = nil)
294
306
  role = ask_check(
@@ -298,7 +310,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
298
310
  Awskeyring.delete_role(role_name: role, message: I18n.t('message.delrole', role: role))
299
311
  end
300
312
 
301
- desc 'rotate ACCOUNT', I18n.t('rotate.desc')
313
+ desc 'rotate ACCOUNT', I18n.t('rotate_desc')
302
314
  # rotate Account keys
303
315
  def rotate(account = nil) # rubocop:disable Metrics/MethodLength
304
316
  account = ask_check(
@@ -330,7 +342,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
330
342
  puts I18n.t('message.upaccount', account: account)
331
343
  end
332
344
 
333
- desc 'token ACCOUNT [ROLE] [MFA]', I18n.t('token.desc')
345
+ desc 'token ACCOUNT [ROLE] [MFA]', I18n.t('token_desc')
334
346
  method_option :role, type: :string, aliases: '-r', desc: I18n.t('method_option.role')
335
347
  method_option :code, type: :string, aliases: '-c', desc: I18n.t('method_option.code')
336
348
  method_option :duration, type: :string, aliases: '-d', desc: I18n.t('method_option.duration')
@@ -385,8 +397,9 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
385
397
  puts I18n.t('message.addtoken', account: account, time: Time.at(new_creds[:expiry].to_i))
386
398
  end
387
399
 
388
- desc 'console ACCOUNT', I18n.t('console.desc')
400
+ desc 'console ACCOUNT', I18n.t('console_desc')
389
401
  method_option :path, type: :string, aliases: '-p', desc: I18n.t('method_option.path')
402
+ method_option :browser, type: :string, aliases: '-b', desc: I18n.t('method_option.browser')
390
403
  method_option 'no-token', type: :boolean, aliases: '-n', desc: I18n.t('method_option.notoken'), default: false
391
404
  method_option 'no-open', type: :boolean, aliases: '-o', desc: I18n.t('method_option.noopen'), default: false
392
405
  # Open the AWS Console
@@ -417,14 +430,16 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
417
430
  if options['no-open']
418
431
  puts login_url
419
432
  else
420
- pid = Process.spawn("open \"#{login_url}\"")
433
+ spawn_cmd = options[:browser] ? "open -a \"#{options[:browser]}\" \"#{login_url}\"" : "open \"#{login_url}\""
434
+ pid = Process.spawn(spawn_cmd)
421
435
  Process.wait pid
422
436
  end
423
437
  end
424
438
 
425
- desc 'awskeyring CURR PREV', I18n.t('awskeyring.desc'), hide: true
439
+ desc "#{File.basename($PROGRAM_NAME)} CURR PREV", I18n.t('awskeyring_desc'), hide: true
440
+ map File.basename($PROGRAM_NAME) => :autocomplete
426
441
  # autocomplete
427
- def awskeyring(curr, prev)
442
+ def autocomplete(curr, prev)
428
443
  comp_line = ENV['COMP_LINE']
429
444
  unless comp_line
430
445
  exec_name = File.basename($PROGRAM_NAME)
@@ -460,9 +475,11 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
460
475
  when 'remove-role', '-r', 'rmr'
461
476
  comp_len = 2
462
477
  when '--path', '-p'
463
- comp_len = 4
478
+ comp_len = 40
464
479
  when 'remove-token', 'rmt'
465
- comp_len = 5
480
+ comp_len = 50
481
+ when '--browser', '-b'
482
+ comp_len = 60
466
483
  end
467
484
 
468
485
  [curr, comp_len, sub_cmd]
@@ -487,12 +504,14 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
487
504
  list = Awskeyring.list_account_names
488
505
  when 2
489
506
  list = Awskeyring.list_role_names
490
- when 3
507
+ when 3..10
491
508
  list = list_arguments(command: sub_cmd)
492
- when 4
509
+ when 40
493
510
  list = Awskeyring.list_console_path
494
- when 5
511
+ when 50
495
512
  list = Awskeyring.list_token_names
513
+ when 60
514
+ list = Awskeyring.list_browsers
496
515
  else
497
516
  exit 1
498
517
  end
@@ -500,7 +519,8 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
500
519
  end
501
520
 
502
521
  def list_commands
503
- self.class.all_commands.keys.map { |elem| elem.tr('_', '-') }.reject! { |elem| elem == 'awskeyring' }
522
+ commands = self.class.all_commands.keys.map { |elem| elem.tr('_', '-') }
523
+ commands.reject! { |elem| %w[autocomplete default].include?(elem) }
504
524
  end
505
525
 
506
526
  def list_arguments(command:)
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" "June 2020" "" ""
4
+ .TH "AWSKEYRING" "5" "April 2021" "" ""
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
  .
@@ -171,8 +267,34 @@ awskeyring env personal\-aws
171
267
  .
172
268
  .IP "" 0
173
269
  .
270
+ .P
271
+ To open the AWS Console (web page) with your default browser simply run\.\.\.
272
+ .
273
+ .IP "" 4
274
+ .
275
+ .nf
276
+
277
+ awskeyring console personal\-aws
278
+ .
279
+ .fi
280
+ .
281
+ .IP "" 0
282
+ .
283
+ .P
284
+ Autocomplete is enabled in your current shell with the following command\.\.\.
285
+ .
286
+ .IP "" 4
287
+ .
288
+ .nf
289
+
290
+ complete \-C /usr/local/bin/awskeyring awskeyring
291
+ .
292
+ .fi
293
+ .
294
+ .IP "" 0
295
+ .
174
296
  .SH "HISTORY"
175
- The motivation of this application is to provide a local secure store of AWS credentials using specifically in the macOS Keychain, to have them easily accessed from the Terminal, and to provide useful functions like assuming roles and opening the AWS Console from the cli\. For Enterprise environments there are better suited tools to use like HashiCorp Vault \fIhttps://vaultproject\.io/\fR\.
297
+ The motivation of this application is to provide a local secure store of AWS credentials using specifically in the macOS Keychain, to have them easily accessed from the Terminal, and to provide useful functions like assuming roles and opening the AWS Console from the cli\. It then expanded to include autocomplete and a desire to have an almost complete test coverage to prevent regressions in its functionality\. For Enterprise environments there are better suited tools to use like HashiCorp Vault \fIhttps://vaultproject\.io/\fR\.
176
298
  .
177
299
  .SH "SECURITY"
178
300
  If you believe you have found a security issue in Awskeyring, please responsibly disclose by contacting me at \fItristan\.morgan@servian\.com\fR\. Awskeyring is a Ruby script and as such Ruby is whitelisted to access your "awskeyring" keychain\. Use a strong password and keep the unlock time short\.
@@ -188,6 +310,9 @@ Tristan tristanmorgan \fIhttps://github\.com/tristanmorgan\fR
188
310
  .IP "\(bu" 4
189
311
  Adam Sir AzySir \fIhttps://github\.com/AzySir\fR
190
312
  .
313
+ .IP "\(bu" 4
314
+ Vito Giarrusso thtliife \fIhttps://github\.com/thtliife\fR
315
+ .
191
316
  .IP "" 0
192
317
  .
193
318
  .SH "LICENSE"
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.6.0
4
+ version: 1.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tristan Morgan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-11 00:00:00.000000000 Z
11
+ date: 2021-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-iam
@@ -73,14 +73,10 @@ executables:
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - CHANGELOG.md
77
- - CODE_OF_CONDUCT.md
78
- - CONTRIBUTING.md
79
76
  - Gemfile
80
77
  - LICENSE.txt
81
78
  - README.md
82
79
  - Rakefile
83
- - SECURITY.md
84
80
  - awskeyring.gemspec
85
81
  - exe/awskeyring
86
82
  - i18n/en.yml
@@ -91,15 +87,14 @@ files:
91
87
  - lib/awskeyring/version.rb
92
88
  - lib/awskeyring_command.rb
93
89
  - man/awskeyring.5
94
- - man/awskeyring.5.ronn
95
90
  homepage: https://github.com/servian/awskeyring
96
91
  licenses:
97
92
  - MIT
98
93
  metadata:
99
94
  bug_tracker_uri: https://github.com/servian/awskeyring/issues
100
- changelog_uri: https://github.com/servian/awskeyring/blob/master/CHANGELOG.md
101
- documentation_uri: https://rubydoc.info/gems/awskeyring/1.6.0
102
- source_code_uri: https://github.com/servian/awskeyring/tree/v1.6.0
95
+ changelog_uri: https://github.com/servian/awskeyring/blob/main/CHANGELOG.md
96
+ documentation_uri: https://rubydoc.info/gems/awskeyring/1.8.3
97
+ source_code_uri: https://github.com/servian/awskeyring/tree/v1.8.3
103
98
  wiki_uri: https://github.com/servian/awskeyring/wiki
104
99
  post_install_message:
105
100
  rdoc_options: []
data/CHANGELOG.md DELETED
@@ -1,131 +0,0 @@
1
- # Changelog
2
-
3
- ## [v1.6.0](https://github.com/servian/awskeyring/tree/v1.6.0) (2020-08-11)
4
-
5
- [Full Changelog](https://github.com/servian/awskeyring/compare/v1.5.0...v1.6.0)
6
-
7
- **Implemented enhancements:**
8
-
9
- - Warn about missing accounts/roles [\#69](https://github.com/servian/awskeyring/pull/69) ([tristanmorgan](https://github.com/tristanmorgan))
10
- - RuboCop and Spec update [\#68](https://github.com/servian/awskeyring/pull/68) ([tristanmorgan](https://github.com/tristanmorgan))
11
- - Add SimpleCov reports. [\#67](https://github.com/servian/awskeyring/pull/67) ([tristanmorgan](https://github.com/tristanmorgan))
12
-
13
- ## [v1.5.0](https://github.com/servian/awskeyring/tree/v1.5.0) (2020-07-08)
14
-
15
- [Full Changelog](https://github.com/servian/awskeyring/compare/v1.4.0...v1.5.0)
16
-
17
- **Implemented enhancements:**
18
-
19
- - No-Bundle env changes for exec. [\#66](https://github.com/servian/awskeyring/pull/66) ([tristanmorgan](https://github.com/tristanmorgan))
20
-
21
- ## [v1.4.0](https://github.com/servian/awskeyring/tree/v1.4.0) (2020-06-19)
22
-
23
- [Full Changelog](https://github.com/servian/awskeyring/compare/v1.3.3...v1.4.0)
24
-
25
- **Implemented enhancements:**
26
-
27
- - Import Keys and Tokens from shared credentials files. [\#65](https://github.com/servian/awskeyring/pull/65) ([tristanmorgan](https://github.com/tristanmorgan))
28
-
29
- ## [v1.3.3](https://github.com/servian/awskeyring/tree/v1.3.3) (2020-06-04)
30
-
31
- [Full Changelog](https://github.com/servian/awskeyring/compare/v1.3.2...v1.3.3)
32
-
33
- **Implemented enhancements:**
34
-
35
- - Change email references from Vibrato to Servian [\#64](https://github.com/servian/awskeyring/pull/64) ([tristanmorgan](https://github.com/tristanmorgan))
36
-
37
- ## [v1.3.2](https://github.com/servian/awskeyring/tree/v1.3.2) (2020-04-27)
38
-
39
- [Full Changelog](https://github.com/servian/awskeyring/compare/v1.3.1...v1.3.2)
40
-
41
- **Fixed bugs:**
42
-
43
- - Fix I18n message load when used as a library. [\#63](https://github.com/servian/awskeyring/pull/63) ([tristanmorgan](https://github.com/tristanmorgan))
44
-
45
- ## [v1.3.1](https://github.com/servian/awskeyring/tree/v1.3.1) (2020-03-19)
46
-
47
- [Full Changelog](https://github.com/servian/awskeyring/compare/v1.3.0...v1.3.1)
48
-
49
- **Implemented enhancements:**
50
-
51
- - Markdown linting changes and removed Rubocop-MD. [\#61](https://github.com/servian/awskeyring/pull/61) ([tristanmorgan](https://github.com/tristanmorgan))
52
- - Removed some redundant code. [\#60](https://github.com/servian/awskeyring/pull/60) ([tristanmorgan](https://github.com/tristanmorgan))
53
-
54
- **Merged pull requests:**
55
-
56
- - Update Ronn code and PR template. [\#59](https://github.com/servian/awskeyring/pull/59) ([tristanmorgan](https://github.com/tristanmorgan))
57
-
58
- ## [v1.3.0](https://github.com/servian/awskeyring/tree/v1.3.0) (2020-02-19)
59
-
60
- [Full Changelog](https://github.com/servian/awskeyring/compare/v1.2.0...v1.3.0)
61
-
62
- **Implemented enhancements:**
63
-
64
- - Add a man-page and tweak README. [\#58](https://github.com/servian/awskeyring/pull/58) ([tristanmorgan](https://github.com/tristanmorgan))
65
- - Enhanced version [\#57](https://github.com/servian/awskeyring/pull/57) ([AzySir](https://github.com/AzySir))
66
-
67
- ## [v1.2.0](https://github.com/servian/awskeyring/tree/v1.2.0) (2020-01-20)
68
-
69
- [Full Changelog](https://github.com/servian/awskeyring/compare/v1.1.2...v1.2.0)
70
-
71
- **Implemented enhancements:**
72
-
73
- - Check for existing account keys and role arns [\#56](https://github.com/servian/awskeyring/pull/56) ([tristanmorgan](https://github.com/tristanmorgan))
74
-
75
- ## [v1.1.2](https://github.com/servian/awskeyring/tree/v1.1.2) (2020-01-06)
76
-
77
- [Full Changelog](https://github.com/servian/awskeyring/compare/v1.1.1...v1.1.2)
78
-
79
- **Fixed bugs:**
80
-
81
- - Deprecation warning for exit\_on\_failure [\#55](https://github.com/servian/awskeyring/pull/55) ([tristanmorgan](https://github.com/tristanmorgan))
82
-
83
- ## [v1.1.1](https://github.com/servian/awskeyring/tree/v1.1.1) (2019-11-27)
84
-
85
- [Full Changelog](https://github.com/servian/awskeyring/compare/v1.1.0...v1.1.1)
86
-
87
- **Implemented enhancements:**
88
-
89
- - Add --detail flag for roles. [\#54](https://github.com/servian/awskeyring/pull/54) ([tristanmorgan](https://github.com/tristanmorgan))
90
-
91
- ## [v1.1.0](https://github.com/servian/awskeyring/tree/v1.1.0) (2019-11-06)
92
-
93
- [Full Changelog](https://github.com/servian/awskeyring/compare/v1.0.2...v1.1.0)
94
-
95
- **Implemented enhancements:**
96
-
97
- - Add completion to input prompts [\#53](https://github.com/servian/awskeyring/pull/53) ([tristanmorgan](https://github.com/tristanmorgan))
98
- - Check for existing \(or not\) role names [\#52](https://github.com/servian/awskeyring/pull/52) ([tristanmorgan](https://github.com/tristanmorgan))
99
-
100
- ## [v1.0.2](https://github.com/servian/awskeyring/tree/v1.0.2) (2019-10-18)
101
-
102
- [Full Changelog](https://github.com/servian/awskeyring/compare/v1.0.1...v1.0.2)
103
-
104
- **Implemented enhancements:**
105
-
106
- - Move to a new home, Servian. [\#51](https://github.com/servian/awskeyring/pull/51) ([tristanmorgan](https://github.com/tristanmorgan))
107
- - Use RuboCop-RSpec too and expect\(\) more. [\#48](https://github.com/servian/awskeyring/pull/48) ([tristanmorgan](https://github.com/tristanmorgan))
108
-
109
- ## [v1.0.1](https://github.com/servian/awskeyring/tree/v1.0.1) (2019-05-23)
110
-
111
- [Full Changelog](https://github.com/servian/awskeyring/compare/v1.0.0...v1.0.1)
112
-
113
- **Implemented enhancements:**
114
-
115
- - auto-complete the --version [\#47](https://github.com/servian/awskeyring/pull/47) ([tristanmorgan](https://github.com/tristanmorgan))
116
-
117
- **Fixed bugs:**
118
-
119
- - Unfreeze secret strings. [\#46](https://github.com/servian/awskeyring/pull/46) ([tristanmorgan](https://github.com/tristanmorgan))
120
-
121
- ## [v1.0.0](https://github.com/servian/awskeyring/tree/v1.0.0) (2019-05-19)
122
-
123
- [Full Changelog](https://github.com/servian/awskeyring/compare/v0.10.0...v1.0.0)
124
-
125
- **Implemented enhancements:**
126
-
127
- - More RuboCop changes and tweaked version string. [\#45](https://github.com/servian/awskeyring/pull/45) ([tristanmorgan](https://github.com/tristanmorgan))
128
-
129
-
130
-
131
- \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
data/CODE_OF_CONDUCT.md DELETED
@@ -1,73 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- education, socio-economic status, nationality, personal appearance, race,
10
- religion, or sexual identity and orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at [tristan.morgan@servian.com](mailto:tristan.morgan@servian.com). All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available [here](https://www.contributor-covenant.org/version/1/4/code-of-conduct.html)
72
-
73
- [homepage]: https://www.contributor-covenant.org
data/CONTRIBUTING.md DELETED
@@ -1,48 +0,0 @@
1
- # How to contribute
2
-
3
- Bug reports and pull requests from users are what keep this project working.
4
-
5
- ## Basics
6
-
7
- 1. Create an issue and describe your idea
8
- 2. [Fork it](https://github.com/servian/awskeyring/fork)
9
- 3. Create your feature branch (`git checkout -b my-new-feature`)
10
- 4. Commit your changes (`git commit -am 'Add some feature'`)
11
- 5. Publish the branch (`git push origin my-new-feature`)
12
- 6. Create a new Pull Request
13
-
14
- ## Checking your work
15
-
16
- You can run the test suite.
17
-
18
- You can run [RuboCop] to check code style.
19
-
20
- You can run [RSpec] to see if anything broke.
21
-
22
- You can run [YARD] to see of your code is documented.
23
-
24
- The default Rake task, runnable using `rake`.
25
-
26
- ## Write documentation
27
-
28
- This project has documentation in a few places:
29
-
30
- ### Introduction and usage
31
-
32
- A friendly `README.md` written for many audiences.
33
-
34
- ### Examples and advanced usage
35
-
36
- The [wiki].
37
-
38
- ### API documentation
39
-
40
- API documentation is written as [YARD] docblocks in the Ruby code.
41
-
42
- This is rendered as Web pages on [Rubydoc.info][awskeyring on Rubydoc.info].
43
-
44
- [wiki]: https://github.com/servian/awskeyring/wiki
45
- [YARD]: https://yardoc.org/
46
- [awskeyring on Rubydoc.info]: https://www.rubydoc.info/gems/awskeyring
47
- [RuboCop]: https://rubocop.readthedocs.io/en/latest/
48
- [Rspec]: https://rspec.info
data/SECURITY.md DELETED
@@ -1,4 +0,0 @@
1
- # Security Policy
2
-
3
- If you believe you have found a security issue in Awskeyring, please responsibly disclose by contacting me at
4
- [tristan.morgan@servian.com](mailto:tristan.morgan@servian.com).
@@ -1,138 +0,0 @@
1
- # Awskeyring -- is a small tool to manage AWS account keys in the macOS Keychain
2
-
3
- ## SYNOPSIS
4
-
5
- awskeyring COMMAND [ACCOUNT|ROLE] [OPTIONS]
6
-
7
- awskeyring help COMMAND
8
-
9
- ## DESCRIPTION
10
-
11
- The Awskeyring utility stores and manages AWS access keys and provides the facility to generate access tokens with
12
- combinations of assumed roles and multi-factor-authentication codes. It includes autocompletion features and multiple
13
- validation checks for input parsing. It also includes the ability for the AWS CLI to call it directly to provide authentication.
14
-
15
- The commands are as follows:
16
-
17
- * --version, -v:
18
-
19
- Prints the version
20
-
21
- * add ACCOUNT:
22
-
23
- Adds an ACCOUNT to the keyring
24
-
25
- * add-role ROLE:
26
-
27
- Adds a ROLE to the keyring
28
-
29
- * console ACCOUNT:
30
-
31
- Open the AWS Console for the ACCOUNT
32
-
33
- * env ACCOUNT:
34
-
35
- Outputs bourne shell environment exports for an ACCOUNT
36
-
37
- * exec ACCOUNT command...:
38
-
39
- Execute a COMMAND with the environment set for an ACCOUNT
40
-
41
- * help [COMMAND]:
42
-
43
- Describe available commands or one specific command
44
-
45
- * import:
46
-
47
- Import an ACCOUNT to the keyring from ~/.aws/credentials
48
-
49
- * initialise:
50
-
51
- Initialises a new KEYCHAIN
52
-
53
- * json ACCOUNT:
54
-
55
- Outputs AWS CLI compatible JSON for an ACCOUNT
56
-
57
- * list:
58
-
59
- Prints a list of accounts in the keyring
60
-
61
- * list-role:
62
-
63
- Prints a list of roles in the keyring
64
-
65
- * remove ACCOUNT:
66
-
67
- Removes an ACCOUNT from the keyring
68
-
69
- * remove-role ROLE:
70
-
71
- Removes a ROLE from the keyring
72
-
73
- * remove-token ACCOUNT:
74
-
75
- Removes a token for ACCOUNT from the keyring
76
-
77
- * rotate ACCOUNT:
78
-
79
- Rotate access keys for an ACCOUNT
80
-
81
- * token ACCOUNT [ROLE] [MFA]:
82
-
83
- Create an STS Token from a ROLE or an MFA code
84
-
85
- * update ACCOUNT:
86
-
87
- Updates an ACCOUNT in the keyring
88
-
89
- ## ENVIRONMENT
90
-
91
- The AWS_DEFAULT_REGION environment variable will be used for AWS API calls where specified or fall back to us-east-1
92
- when not.
93
-
94
- ## EXIT STATUS
95
-
96
- The Awskeyring utility exits 0 on success, and >0 if an error occurs.
97
-
98
- ## EXAMPLES
99
-
100
- First you need to initialise your keychain to hold your AWS credentials.
101
-
102
- awskeyring initialise
103
-
104
- Then add your keys to it.
105
-
106
- awskeyring add personal-aws
107
-
108
- Now your keys are stored safely in the macOS keychain. To print environment variables run...
109
-
110
- awskeyring env personal-aws
111
-
112
- ## HISTORY
113
-
114
- The motivation of this application is to provide a local secure store of AWS
115
- credentials using specifically in the macOS Keychain, to have them easily accessed
116
- from the Terminal, and to provide useful functions like assuming roles and opening
117
- the AWS Console from the cli.
118
- For Enterprise environments there are better suited tools to use
119
- like [HashiCorp Vault](https://vaultproject.io/).
120
-
121
- ## SECURITY
122
-
123
- If you believe you have found a security issue in Awskeyring, please responsibly disclose by contacting me at
124
- [tristan.morgan@servian.com](mailto:tristan.morgan@servian.com). Awskeyring is a Ruby script and as such Ruby is whitelisted to
125
- access your "awskeyring" keychain. Use a strong password and keep the unlock time short.
126
-
127
- ## AUTHOR
128
-
129
- Tristan Morgan <tristan.morgan@servian.com> is the maintainer of Awskeyring.
130
-
131
- ## CONTRIBUTORS
132
-
133
- * Tristan [tristanmorgan](https://github.com/tristanmorgan)
134
- * Adam Sir [AzySir](https://github.com/AzySir)
135
-
136
- ## LICENSE
137
-
138
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).