awskeyring 0.10.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +20 -171
- data/CONTRIBUTING.md +48 -0
- data/Gemfile +4 -1
- data/README.md +15 -11
- data/Rakefile +5 -0
- data/awskeyring.gemspec +4 -2
- data/exe/awskeyring +1 -0
- data/i18n/en.yml +1 -0
- data/lib/awskeyring.rb +31 -4
- data/lib/awskeyring/awsapi.rb +7 -5
- data/lib/awskeyring/input.rb +3 -1
- data/lib/awskeyring/validate.rb +2 -0
- data/lib/awskeyring/version.rb +6 -2
- data/lib/awskeyring_command.rb +72 -33
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1822cae610c0f8ad7951c6f29dd005386f13829983266aa821052f84295da537
|
4
|
+
data.tar.gz: 72a878156cf89aa372bdf910037327cbd57f8f57f4b659b95905a3c2fb49a2d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad6723daac2ebb3b437daa75e32cb872eede77f57e53a347677a60c2e7f76340f79ea621c2dd8d0049039439e675ae10088ad441009a6e64709e4318dc783740
|
7
|
+
data.tar.gz: 3c450523332c4cc4298efa9786bfdc4138c4a519ce0d5ffad53190cae548ad14a2c0ccf9d1f9adbbcedf909b9730de554f6788fcd08b6ead356707512f460ea7
|
data/CHANGELOG.md
CHANGED
@@ -1,202 +1,51 @@
|
|
1
|
-
#
|
1
|
+
# Changelog
|
2
2
|
|
3
|
-
## [
|
4
|
-
[Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.9.0...v0.10.0)
|
3
|
+
## [v1.1.1](https://github.com/servian/awskeyring/tree/v1.1.1) (2019-11-28)
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
- Add --unset flag to env command [\#44](https://github.com/vibrato/awskeyring/pull/44) ([tristanmorgan](https://github.com/tristanmorgan))
|
9
|
-
|
10
|
-
## [v0.9.0](https://github.com/vibrato/awskeyring/tree/v0.9.0) (2019-04-09)
|
11
|
-
[Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.8.1...v0.9.0)
|
5
|
+
[Full Changelog](https://github.com/servian/awskeyring/compare/v1.1.0...v1.1.1)
|
12
6
|
|
13
7
|
**Implemented enhancements:**
|
14
8
|
|
15
|
-
-
|
16
|
-
|
17
|
-
## [v0.8.1](https://github.com/vibrato/awskeyring/tree/v0.8.1) (2019-02-06)
|
18
|
-
[Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.8.0...v0.8.1)
|
19
|
-
|
20
|
-
**Fixed bugs:**
|
9
|
+
- Add --detail flag for roles. [\#54](https://github.com/servian/awskeyring/pull/54) ([tristanmorgan](https://github.com/tristanmorgan))
|
21
10
|
|
22
|
-
|
11
|
+
## [v1.1.0](https://github.com/servian/awskeyring/tree/v1.1.0) (2019-11-06)
|
23
12
|
|
24
|
-
|
25
|
-
[Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.7.2...v0.8.0)
|
13
|
+
[Full Changelog](https://github.com/servian/awskeyring/compare/v1.0.2...v1.1.0)
|
26
14
|
|
27
15
|
**Implemented enhancements:**
|
28
16
|
|
29
|
-
-
|
30
|
-
|
31
|
-
**Fixed bugs:**
|
17
|
+
- Add completion to input prompts [\#53](https://github.com/servian/awskeyring/pull/53) ([tristanmorgan](https://github.com/tristanmorgan))
|
18
|
+
- Check for existing \(or not\) role names [\#52](https://github.com/servian/awskeyring/pull/52) ([tristanmorgan](https://github.com/tristanmorgan))
|
32
19
|
|
33
|
-
|
20
|
+
## [v1.0.2](https://github.com/servian/awskeyring/tree/v1.0.2) (2019-10-18)
|
34
21
|
|
35
|
-
|
36
|
-
[Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.7.1...v0.7.2)
|
37
|
-
|
38
|
-
**Fixed bugs:**
|
39
|
-
|
40
|
-
- Validate that account doesn't already exists. [\#40](https://github.com/vibrato/awskeyring/pull/40) ([tristanmorgan](https://github.com/tristanmorgan))
|
41
|
-
- Check for COMMAND param to exec. [\#38](https://github.com/vibrato/awskeyring/pull/38) ([tristanmorgan](https://github.com/tristanmorgan))
|
42
|
-
|
43
|
-
## [v0.7.1](https://github.com/vibrato/awskeyring/tree/v0.7.1) (2018-12-03)
|
44
|
-
[Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.7.0...v0.7.1)
|
45
|
-
|
46
|
-
**Fixed bugs:**
|
47
|
-
|
48
|
-
- Trailing LF was being passed to validator [\#37](https://github.com/vibrato/awskeyring/pull/37) ([tristanmorgan](https://github.com/tristanmorgan))
|
49
|
-
|
50
|
-
## [v0.7.0](https://github.com/vibrato/awskeyring/tree/v0.7.0) (2018-11-26)
|
51
|
-
[Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.6.0...v0.7.0)
|
22
|
+
[Full Changelog](https://github.com/servian/awskeyring/compare/v1.0.1...v1.0.2)
|
52
23
|
|
53
24
|
**Implemented enhancements:**
|
54
25
|
|
55
|
-
-
|
56
|
-
-
|
57
|
-
|
58
|
-
## [v0.6.0](https://github.com/vibrato/awskeyring/tree/v0.6.0) (2018-10-18)
|
59
|
-
[Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.5.3...v0.6.0)
|
60
|
-
|
61
|
-
**Fixed bugs:**
|
62
|
-
|
63
|
-
- Use a default Region for Rotate. [\#33](https://github.com/vibrato/awskeyring/pull/33) ([tristanmorgan](https://github.com/tristanmorgan))
|
64
|
-
- Fix JSON time format to use ISO8601. [\#32](https://github.com/vibrato/awskeyring/pull/32) ([tristanmorgan](https://github.com/tristanmorgan))
|
65
|
-
|
66
|
-
## [v0.5.3](https://github.com/vibrato/awskeyring/tree/v0.5.3) (2018-10-03)
|
67
|
-
[Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.5.2...v0.5.3)
|
68
|
-
|
69
|
-
**Implemented enhancements:**
|
70
|
-
|
71
|
-
- Console favourites [\#31](https://github.com/vibrato/awskeyring/pull/31) ([tristanmorgan](https://github.com/tristanmorgan))
|
72
|
-
|
73
|
-
## [v0.5.2](https://github.com/vibrato/awskeyring/tree/v0.5.2) (2018-09-18)
|
74
|
-
[Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.5.1...v0.5.2)
|
75
|
-
|
76
|
-
**Implemented enhancements:**
|
77
|
-
|
78
|
-
- More robust autocomplete. [\#30](https://github.com/vibrato/awskeyring/pull/30) ([tristanmorgan](https://github.com/tristanmorgan))
|
79
|
-
|
80
|
-
## [v0.5.1](https://github.com/vibrato/awskeyring/tree/v0.5.1) (2018-09-12)
|
81
|
-
[Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.5.0...v0.5.1)
|
82
|
-
|
83
|
-
**Implemented enhancements:**
|
84
|
-
|
85
|
-
- Autocomplete flags too. [\#29](https://github.com/vibrato/awskeyring/pull/29) ([tristanmorgan](https://github.com/tristanmorgan))
|
86
|
-
|
87
|
-
## [v0.5.0](https://github.com/vibrato/awskeyring/tree/v0.5.0) (2018-09-10)
|
88
|
-
[Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.4.0...v0.5.0)
|
89
|
-
|
90
|
-
**Implemented enhancements:**
|
91
|
-
|
92
|
-
- Separate update account from add account. [\#28](https://github.com/vibrato/awskeyring/pull/28) ([tristanmorgan](https://github.com/tristanmorgan))
|
93
|
-
|
94
|
-
**Merged pull requests:**
|
26
|
+
- Move to a new home, Servian. [\#51](https://github.com/servian/awskeyring/pull/51) ([tristanmorgan](https://github.com/tristanmorgan))
|
27
|
+
- Use RuboCop-RSpec too and expect\(\) more. [\#48](https://github.com/servian/awskeyring/pull/48) ([tristanmorgan](https://github.com/tristanmorgan))
|
95
28
|
|
96
|
-
|
29
|
+
## [v1.0.1](https://github.com/servian/awskeyring/tree/v1.0.1) (2019-05-23)
|
97
30
|
|
98
|
-
|
99
|
-
[Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.3.1...v0.4.0)
|
31
|
+
[Full Changelog](https://github.com/servian/awskeyring/compare/v1.0.0...v1.0.1)
|
100
32
|
|
101
33
|
**Implemented enhancements:**
|
102
34
|
|
103
|
-
-
|
104
|
-
- Adds no token flag to skip saved token [\#25](https://github.com/vibrato/awskeyring/pull/25) ([tristanmorgan](https://github.com/tristanmorgan))
|
105
|
-
|
106
|
-
## [v0.3.1](https://github.com/vibrato/awskeyring/tree/v0.3.1) (2018-07-25)
|
107
|
-
[Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.3.0...v0.3.1)
|
108
|
-
|
109
|
-
**Implemented enhancements:**
|
110
|
-
|
111
|
-
- Warn about key-age [\#24](https://github.com/vibrato/awskeyring/pull/24) ([tristanmorgan](https://github.com/tristanmorgan))
|
112
|
-
|
113
|
-
**Fixed bugs:**
|
114
|
-
|
115
|
-
- Error adding account when region is not specified [\#21](https://github.com/vibrato/awskeyring/issues/21)
|
116
|
-
- Check more locations for current region. [\#23](https://github.com/vibrato/awskeyring/pull/23) ([tristanmorgan](https://github.com/tristanmorgan))
|
117
|
-
|
118
|
-
**Merged pull requests:**
|
119
|
-
|
120
|
-
- Set a default region on cred verify. [\#22](https://github.com/vibrato/awskeyring/pull/22) ([tristanmorgan](https://github.com/tristanmorgan))
|
121
|
-
|
122
|
-
## [v0.3.0](https://github.com/vibrato/awskeyring/tree/v0.3.0) (2018-04-12)
|
123
|
-
[Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.2.0...v0.3.0)
|
124
|
-
|
125
|
-
**Implemented enhancements:**
|
126
|
-
|
127
|
-
- Validate tokens upon adding them to the keychain [\#18](https://github.com/vibrato/awskeyring/issues/18)
|
128
|
-
- Generate a token from IAM User credentials using the GetFederationToken API [\#17](https://github.com/vibrato/awskeyring/issues/17)
|
129
|
-
- Test creds against AWS API \(optionally\). [\#20](https://github.com/vibrato/awskeyring/pull/20) ([tristanmorgan](https://github.com/tristanmorgan))
|
130
|
-
- Allow STS get\_session\_token without role [\#19](https://github.com/vibrato/awskeyring/pull/19) ([tristanmorgan](https://github.com/tristanmorgan))
|
131
|
-
|
132
|
-
## [v0.2.0](https://github.com/vibrato/awskeyring/tree/v0.2.0) (2018-04-05)
|
133
|
-
[Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.1.1...v0.2.0)
|
134
|
-
|
135
|
-
**Implemented enhancements:**
|
136
|
-
|
137
|
-
- Add AWS CLI credential\_process compatible JSON output [\#16](https://github.com/vibrato/awskeyring/pull/16) ([tristanmorgan](https://github.com/tristanmorgan))
|
138
|
-
|
139
|
-
## [v0.1.1](https://github.com/vibrato/awskeyring/tree/v0.1.1) (2018-03-25)
|
140
|
-
[Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.1.0...v0.1.1)
|
141
|
-
|
142
|
-
**Merged pull requests:**
|
143
|
-
|
144
|
-
- More coverage with tests. [\#15](https://github.com/vibrato/awskeyring/pull/15) ([tristanmorgan](https://github.com/tristanmorgan))
|
145
|
-
- Validate MFA code and tweak Autocomplete [\#14](https://github.com/vibrato/awskeyring/pull/14) ([tristanmorgan](https://github.com/tristanmorgan))
|
146
|
-
|
147
|
-
## [v0.1.0](https://github.com/vibrato/awskeyring/tree/v0.1.0) (2018-03-14)
|
148
|
-
[Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.0.6...v0.1.0)
|
149
|
-
|
150
|
-
**Implemented enhancements:**
|
151
|
-
|
152
|
-
- Item refactor [\#13](https://github.com/vibrato/awskeyring/pull/13) ([tristanmorgan](https://github.com/tristanmorgan))
|
153
|
-
- Aws refactor [\#12](https://github.com/vibrato/awskeyring/pull/12) ([tristanmorgan](https://github.com/tristanmorgan))
|
154
|
-
|
155
|
-
## [v0.0.6](https://github.com/vibrato/awskeyring/tree/v0.0.6) (2018-03-01)
|
156
|
-
[Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.0.5...v0.0.6)
|
157
|
-
|
158
|
-
**Implemented enhancements:**
|
159
|
-
|
160
|
-
- Credential Rotation Feature [\#4](https://github.com/vibrato/awskeyring/issues/4)
|
161
|
-
- Rotate credentials feature. [\#11](https://github.com/vibrato/awskeyring/pull/11) ([tristanmorgan](https://github.com/tristanmorgan))
|
162
|
-
|
163
|
-
**Merged pull requests:**
|
164
|
-
|
165
|
-
- Input validation [\#10](https://github.com/vibrato/awskeyring/pull/10) ([tristanmorgan](https://github.com/tristanmorgan))
|
166
|
-
- Adding a check for incorrect file modes. [\#9](https://github.com/vibrato/awskeyring/pull/9) ([tristanmorgan](https://github.com/tristanmorgan))
|
167
|
-
|
168
|
-
## [v0.0.5](https://github.com/vibrato/awskeyring/tree/v0.0.5) (2018-02-15)
|
169
|
-
[Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.0.4...v0.0.5)
|
35
|
+
- auto-complete the --version [\#47](https://github.com/servian/awskeyring/pull/47) ([tristanmorgan](https://github.com/tristanmorgan))
|
170
36
|
|
171
37
|
**Fixed bugs:**
|
172
38
|
|
173
|
-
-
|
174
|
-
|
175
|
-
**Merged pull requests:**
|
39
|
+
- Unfreeze secret strings. [\#46](https://github.com/servian/awskeyring/pull/46) ([tristanmorgan](https://github.com/tristanmorgan))
|
176
40
|
|
177
|
-
|
41
|
+
## [v1.0.0](https://github.com/servian/awskeyring/tree/v1.0.0) (2019-05-19)
|
178
42
|
|
179
|
-
|
180
|
-
[Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.0.3...v0.0.4)
|
181
|
-
|
182
|
-
## [v0.0.3](https://github.com/vibrato/awskeyring/tree/v0.0.3) (2018-01-28)
|
183
|
-
[Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.0.2...v0.0.3)
|
43
|
+
[Full Changelog](https://github.com/servian/awskeyring/compare/v0.10.0...v1.0.0)
|
184
44
|
|
185
45
|
**Implemented enhancements:**
|
186
46
|
|
187
|
-
-
|
188
|
-
- Implement exec command [\#2](https://github.com/vibrato/awskeyring/issues/2)
|
189
|
-
- Add Remove token feature [\#6](https://github.com/vibrato/awskeyring/pull/6) ([tristanmorgan](https://github.com/tristanmorgan))
|
190
|
-
- Implement exec feature. [\#3](https://github.com/vibrato/awskeyring/pull/3) ([tristanmorgan](https://github.com/tristanmorgan))
|
191
|
-
|
192
|
-
## [v0.0.2](https://github.com/vibrato/awskeyring/tree/v0.0.2) (2018-01-18)
|
193
|
-
[Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.0.1...v0.0.2)
|
194
|
-
|
195
|
-
**Merged pull requests:**
|
196
|
-
|
197
|
-
- Sledgehammer disable of rubocop metrics. [\#1](https://github.com/vibrato/awskeyring/pull/1) ([tristanmorgan](https://github.com/tristanmorgan))
|
47
|
+
- More RuboCop changes and tweaked version string. [\#45](https://github.com/servian/awskeyring/pull/45) ([tristanmorgan](https://github.com/tristanmorgan))
|
198
48
|
|
199
|
-
## [v0.0.1](https://github.com/vibrato/awskeyring/tree/v0.0.1) (2017-12-25)
|
200
49
|
|
201
50
|
|
202
|
-
\* *This
|
51
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,48 @@
|
|
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/Gemfile
CHANGED
@@ -1,13 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source 'https://rubygems.org'
|
2
4
|
|
3
5
|
# Specify your gem's dependencies in awskeyring.gemspec
|
4
6
|
gemspec
|
5
7
|
|
6
8
|
group :development do
|
7
|
-
gem 'bundler'
|
8
9
|
gem 'github_changelog_generator'
|
9
10
|
gem 'rake'
|
10
11
|
gem 'rspec'
|
11
12
|
gem 'rubocop'
|
13
|
+
gem 'rubocop-performance'
|
14
|
+
gem 'rubocop-rspec'
|
12
15
|
gem 'yard'
|
13
16
|
end
|
data/README.md
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
# Awskeyring
|
2
2
|
|
3
|
-
|
3
|
+
![Awskeyring](https://raw.githubusercontent.com/servian/awskeyring/master/awskeyring-144.png)
|
4
|
+
|
5
|
+
* [![Build Status](https://travis-ci.org/servian/awskeyring.svg?branch=master)](https://travis-ci.org/servian/awskeyring)
|
4
6
|
* [![Gem Version](https://badge.fury.io/rb/awskeyring.svg)](https://badge.fury.io/rb/awskeyring)
|
5
|
-
* [![license MIT](
|
6
|
-
* [![All Downloads](
|
7
|
-
* [![Version Downloads](
|
8
|
-
* [![Documentation](
|
7
|
+
* [![license MIT](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)
|
8
|
+
* [![All Downloads](https://ruby-gem-downloads-badge.herokuapp.com/awskeyring?type=total)](https://rubygems.org/gems/awskeyring)
|
9
|
+
* [![Version Downloads](https://ruby-gem-downloads-badge.herokuapp.com/awskeyring?label=downloads-current-version)](https://rubygems.org/gems/awskeyring)
|
10
|
+
* [![Documentation](https://img.shields.io/badge/yard-docs-brightgreen.svg)](https://www.rubydoc.info/gems/awskeyring)
|
9
11
|
|
10
12
|
Awskeyring is a small tool to manage AWS account keys in the macOS Keychain.
|
11
13
|
|
@@ -24,6 +26,10 @@ Install it with:
|
|
24
26
|
|
25
27
|
$ gem install awskeyring --user-install
|
26
28
|
|
29
|
+
## Wiki
|
30
|
+
|
31
|
+
Please see the [Wiki](https://github.com/servian/awskeyring/wiki) for full usage instructions and tips.
|
32
|
+
|
27
33
|
## Quick start
|
28
34
|
|
29
35
|
First you need to initialise your keychain to hold your AWS credentials.
|
@@ -38,14 +44,12 @@ Now your keys are stored safely in the macOS keychain. To print environment vari
|
|
38
44
|
|
39
45
|
awskeyring env personal-aws
|
40
46
|
|
41
|
-
Alternatively you can create a profile using the credential_process config variable. See the [AWS CLI Config docs](
|
47
|
+
Alternatively you can create a profile using the credential_process config variable. See the [AWS CLI Config docs](https://docs.aws.amazon.com/cli/latest/topic/config-vars.html#cli-aws-help-config-vars) for more details on this config option.
|
42
48
|
|
43
49
|
[profile personal]
|
44
50
|
region = us-west-1
|
45
51
|
credential_process = /usr/local/bin/awskeyring json personal-aws
|
46
52
|
|
47
|
-
See below and in the [wiki](https://github.com/vibrato/awskeyring/wiki) for more details on usage.
|
48
|
-
|
49
53
|
## Usage
|
50
54
|
|
51
55
|
The CLI is using [Thor](http://whatisthor.com) with help provided interactively.
|
@@ -83,7 +87,7 @@ To set your environment easily the following bash function helps:
|
|
83
87
|
|
84
88
|
## Development
|
85
89
|
|
86
|
-
After checking out the repo, run `bundle update` to install dependencies. Then, run `rake` to run the tests. Run `bundle exec awskeyring` to use the gem in this directory, ignoring other installed copies of this gem.
|
90
|
+
After checking out the repo, run `bundle update` to install dependencies. Then, run `rake` to run the tests. Run `bundle exec awskeyring` to use the gem in this directory, ignoring other installed copies of this gem. Awskeyring is tested against the last two versions of Ruby shipped with macOS.
|
87
91
|
|
88
92
|
To install this gem onto your local machine, run `bundle exec rake install`.
|
89
93
|
|
@@ -93,9 +97,9 @@ If you believe you have found a security issue in Awskeyring, please responsibly
|
|
93
97
|
|
94
98
|
## Contributing
|
95
99
|
|
96
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
100
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/servian/awskeyring. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](https://contributor-covenant.org) code of conduct.
|
97
101
|
|
98
102
|
## License
|
99
103
|
|
100
|
-
The gem is available as open source under the terms of the [MIT License](
|
104
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
101
105
|
|
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'bundler/gem_tasks'
|
2
4
|
require 'rspec/core/rake_task'
|
3
5
|
require 'rubocop/rake_task'
|
@@ -5,7 +7,10 @@ require 'github_changelog_generator/task'
|
|
5
7
|
require 'yard'
|
6
8
|
|
7
9
|
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
10
|
+
config.user = 'servian'
|
11
|
+
config.project = 'awskeyring'
|
8
12
|
config.future_release = "v#{Awskeyring::VERSION}"
|
13
|
+
config.since_tag = 'v0.10.0'
|
9
14
|
end
|
10
15
|
|
11
16
|
RuboCop::RakeTask.new do |rubocop|
|
data/awskeyring.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
lib = File.expand_path('lib', __dir__)
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
5
|
require 'awskeyring/version'
|
@@ -10,10 +12,10 @@ Gem::Specification.new do |spec|
|
|
10
12
|
|
11
13
|
spec.summary = 'Manages AWS credentials in the macOS keychain'
|
12
14
|
spec.description = 'Manages AWS credentials in the macOS keychain'
|
13
|
-
spec.homepage =
|
15
|
+
spec.homepage = Awskeyring::HOMEPAGE
|
14
16
|
spec.license = 'MIT'
|
15
17
|
|
16
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/|^\..*|^.*\.png}) }
|
17
19
|
spec.bindir = 'exe'
|
18
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
21
|
spec.require_paths = ['lib']
|
data/exe/awskeyring
CHANGED
data/i18n/en.yml
CHANGED
data/lib/awskeyring.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'json'
|
2
4
|
require 'keychain'
|
3
5
|
require 'awskeyring/validate'
|
@@ -8,13 +10,13 @@ module Awskeyring # rubocop:disable Metrics/ModuleLength
|
|
8
10
|
# Default rpeferences fole path
|
9
11
|
PREFS_FILE = (File.expand_path '~/.awskeyring').freeze
|
10
12
|
# Prefix for Roles
|
11
|
-
ROLE_PREFIX = 'role '
|
13
|
+
ROLE_PREFIX = 'role '
|
12
14
|
# Prefix for Accounts
|
13
|
-
ACCOUNT_PREFIX = 'account '
|
15
|
+
ACCOUNT_PREFIX = 'account '
|
14
16
|
# Prefix for Session Keys
|
15
|
-
SESSION_KEY_PREFIX = 'session-key '
|
17
|
+
SESSION_KEY_PREFIX = 'session-key '
|
16
18
|
# Prefix for Session Tokens
|
17
|
-
SESSION_TOKEN_PREFIX = 'session-token '
|
19
|
+
SESSION_TOKEN_PREFIX = 'session-token '
|
18
20
|
# Default keychain Lock period
|
19
21
|
FIVE_MINUTES = 300
|
20
22
|
# Default warning of key age in days.
|
@@ -172,6 +174,11 @@ module Awskeyring # rubocop:disable Metrics/ModuleLength
|
|
172
174
|
list_roles.map { |elem| elem.attributes[:label][(ROLE_PREFIX.length)..-1] }
|
173
175
|
end
|
174
176
|
|
177
|
+
# Return a list role item names and arns
|
178
|
+
def self.list_role_names_plus
|
179
|
+
list_roles.map { |elem| "#{elem.attributes[:label][(ROLE_PREFIX.length)..-1]}\t#{elem.attributes[:account]}" }
|
180
|
+
end
|
181
|
+
|
175
182
|
# Return a list of console paths
|
176
183
|
def self.list_console_path
|
177
184
|
prefs.key?('console') ? prefs['console'] : DEFAULT_CONSOLE_LIST
|
@@ -300,4 +307,24 @@ module Awskeyring # rubocop:disable Metrics/ModuleLength
|
|
300
307
|
|
301
308
|
account_name
|
302
309
|
end
|
310
|
+
|
311
|
+
# Validate role exists
|
312
|
+
#
|
313
|
+
# @param [String] role_name the associated role name.
|
314
|
+
def self.role_exists(role_name)
|
315
|
+
Awskeyring::Validate.role_name(role_name)
|
316
|
+
raise 'Role does not exist' unless list_role_names.include?(role_name)
|
317
|
+
|
318
|
+
role_name
|
319
|
+
end
|
320
|
+
|
321
|
+
# Validate role does not exists
|
322
|
+
#
|
323
|
+
# @param [String] role_name the associated role name.
|
324
|
+
def self.role_not_exists(role_name)
|
325
|
+
Awskeyring::Validate.role_name(role_name)
|
326
|
+
raise 'Role already exists' if list_role_names.include?(role_name)
|
327
|
+
|
328
|
+
role_name
|
329
|
+
end
|
303
330
|
end
|
data/lib/awskeyring/awsapi.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'aws-sdk-iam'
|
2
4
|
require 'cgi'
|
3
5
|
require 'json'
|
@@ -18,7 +20,7 @@ module Awskeyring
|
|
18
20
|
}.to_json.freeze
|
19
21
|
|
20
22
|
# AWS Signin url
|
21
|
-
AWS_SIGNIN_URL = 'https://signin.aws.amazon.com/federation'
|
23
|
+
AWS_SIGNIN_URL = 'https://signin.aws.amazon.com/federation'
|
22
24
|
|
23
25
|
# AWS Env vars
|
24
26
|
AWS_ENV_VARS = %w[
|
@@ -149,8 +151,8 @@ module Awskeyring
|
|
149
151
|
ENV['AWS_DEFAULT_REGION'] = 'us-east-1' unless region
|
150
152
|
sts = Aws::STS::Client.new(access_key_id: key, secret_access_key: secret)
|
151
153
|
sts.get_caller_identity
|
152
|
-
rescue Aws::Errors::ServiceError =>
|
153
|
-
warn
|
154
|
+
rescue Aws::Errors::ServiceError => e
|
155
|
+
warn e.to_s
|
154
156
|
exit 1
|
155
157
|
end
|
156
158
|
true
|
@@ -257,13 +259,13 @@ module Awskeyring
|
|
257
259
|
retries ||= 1
|
258
260
|
begin
|
259
261
|
yield block
|
260
|
-
rescue Aws::IAM::Errors::InvalidClientTokenId =>
|
262
|
+
rescue Aws::IAM::Errors::InvalidClientTokenId => e
|
261
263
|
if retries < 4
|
262
264
|
sleep 2**retries
|
263
265
|
retries += 1
|
264
266
|
retry
|
265
267
|
end
|
266
|
-
warn
|
268
|
+
warn e.message
|
267
269
|
exit 1
|
268
270
|
end
|
269
271
|
end
|
data/lib/awskeyring/input.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'io/console'
|
2
4
|
|
3
5
|
# Awskeyring Module,
|
@@ -13,7 +15,7 @@ module Awskeyring
|
|
13
15
|
end
|
14
16
|
|
15
17
|
private_class_method def self.hide_input # rubocop:disable Metrics/MethodLength
|
16
|
-
password = ''
|
18
|
+
password = +''
|
17
19
|
loop do
|
18
20
|
character = $stdin.getch
|
19
21
|
break unless character
|
data/lib/awskeyring/validate.rb
CHANGED
data/lib/awskeyring/version.rb
CHANGED
data/lib/awskeyring_command.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'i18n'
|
2
4
|
require 'thor'
|
3
5
|
|
@@ -13,7 +15,9 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
13
15
|
I18n.backend.load_translations
|
14
16
|
|
15
17
|
map %w[--version -v] => :__version
|
18
|
+
map %w[--help -h] => :help
|
16
19
|
map ['init'] => :initialise
|
20
|
+
map ['adr'] => :add_role
|
17
21
|
map ['con'] => :console
|
18
22
|
map ['ls'] => :list
|
19
23
|
map ['lsr'] => :list_role
|
@@ -27,7 +31,8 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
27
31
|
desc '--version, -v', I18n.t('__version.desc')
|
28
32
|
# print the version number
|
29
33
|
def __version
|
30
|
-
puts Awskeyring::VERSION
|
34
|
+
puts "Awskeyring v#{Awskeyring::VERSION}"
|
35
|
+
puts "Homepage #{Awskeyring::HOMEPAGE}"
|
31
36
|
end
|
32
37
|
|
33
38
|
desc 'initialise', I18n.t('initialise.desc')
|
@@ -39,7 +44,12 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
39
44
|
exit 1
|
40
45
|
end
|
41
46
|
|
42
|
-
keychain =
|
47
|
+
keychain = ask_check(
|
48
|
+
existing: options[:keychain],
|
49
|
+
flags: 'optional',
|
50
|
+
message: I18n.t('message.keychain'),
|
51
|
+
validator: Awskeyring::Validate.method(:account_name)
|
52
|
+
)
|
43
53
|
keychain = 'awskeyring' if keychain.empty?
|
44
54
|
|
45
55
|
puts I18n.t('message.newkeychain')
|
@@ -58,9 +68,14 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
58
68
|
|
59
69
|
map 'list-role' => :list_role
|
60
70
|
desc 'list-role', I18n.t('list_role.desc')
|
71
|
+
method_option 'detail', type: :boolean, aliases: '-d', desc: I18n.t('method_option.detail'), default: false
|
61
72
|
# List roles
|
62
73
|
def list_role
|
63
|
-
|
74
|
+
if options['detail']
|
75
|
+
puts Awskeyring.list_role_names_plus.join("\n")
|
76
|
+
else
|
77
|
+
puts Awskeyring.list_role_names.join("\n")
|
78
|
+
end
|
64
79
|
end
|
65
80
|
|
66
81
|
desc 'env ACCOUNT', I18n.t('env.desc')
|
@@ -73,7 +88,8 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
73
88
|
else
|
74
89
|
account = ask_check(
|
75
90
|
existing: account, message: I18n.t('message.account'),
|
76
|
-
validator: Awskeyring.method(:account_exists)
|
91
|
+
validator: Awskeyring.method(:account_exists),
|
92
|
+
limited_to: Awskeyring.list_account_names
|
77
93
|
)
|
78
94
|
cred = age_check_and_get(account: account, no_token: options['no-token'])
|
79
95
|
put_env_string(cred)
|
@@ -83,7 +99,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
83
99
|
desc 'json ACCOUNT', I18n.t('json.desc')
|
84
100
|
method_option 'no-token', type: :boolean, aliases: '-n', desc: I18n.t('method_option.notoken'), default: false
|
85
101
|
# Print JSON for use with credential_process
|
86
|
-
def json(account
|
102
|
+
def json(account)
|
87
103
|
account = ask_check(
|
88
104
|
existing: account, message: I18n.t('message.account'), validator: Awskeyring.method(:account_exists)
|
89
105
|
)
|
@@ -132,11 +148,11 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
132
148
|
)
|
133
149
|
secret = ask_check(
|
134
150
|
existing: options[:secret], message: I18n.t('message.secret'),
|
135
|
-
|
151
|
+
flags: 'secure', validator: Awskeyring::Validate.method(:secret_access_key)
|
136
152
|
)
|
137
153
|
mfa = ask_check(
|
138
154
|
existing: options[:mfa], message: I18n.t('message.mfa'),
|
139
|
-
|
155
|
+
flags: 'optional', validator: Awskeyring::Validate.method(:mfa_arn)
|
140
156
|
)
|
141
157
|
Awskeyring::Awsapi.verify_cred(key: key, secret: secret) unless options['no-remote']
|
142
158
|
Awskeyring.add_account(
|
@@ -153,16 +169,18 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
153
169
|
method_option :secret, type: :string, aliases: '-s', desc: I18n.t('method_option.secret')
|
154
170
|
method_option 'no-remote', type: :boolean, aliases: '-r', desc: I18n.t('method_option.noremote'), default: false
|
155
171
|
# Update an Account
|
156
|
-
def update(account = nil) # rubocop:disable Metrics/MethodLength
|
172
|
+
def update(account = nil) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
157
173
|
account = ask_check(
|
158
|
-
existing: account, message: I18n.t('message.account'),
|
174
|
+
existing: account, message: I18n.t('message.account'),
|
175
|
+
validator: Awskeyring.method(:account_exists),
|
176
|
+
limited_to: Awskeyring.list_account_names
|
159
177
|
)
|
160
178
|
key = ask_check(
|
161
179
|
existing: options[:key], message: I18n.t('message.key'), validator: Awskeyring::Validate.method(:access_key)
|
162
180
|
)
|
163
181
|
secret = ask_check(
|
164
182
|
existing: options[:secret], message: I18n.t('message.secret'),
|
165
|
-
|
183
|
+
flags: 'secure', validator: Awskeyring::Validate.method(:secret_access_key)
|
166
184
|
)
|
167
185
|
Awskeyring::Awsapi.verify_cred(key: key, secret: secret) unless options['no-remote']
|
168
186
|
Awskeyring.update_account(
|
@@ -180,7 +198,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
180
198
|
def add_role(role = nil)
|
181
199
|
role = ask_check(
|
182
200
|
existing: role, message: I18n.t('message.role'),
|
183
|
-
validator: Awskeyring
|
201
|
+
validator: Awskeyring.method(:role_not_exists)
|
184
202
|
)
|
185
203
|
arn = ask_check(
|
186
204
|
existing: options[:arn], message: I18n.t('message.arn'),
|
@@ -198,7 +216,8 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
198
216
|
# Remove an account
|
199
217
|
def remove(account = nil)
|
200
218
|
account = ask_check(
|
201
|
-
existing: account, message: I18n.t('message.account'), validator: Awskeyring.method(:account_exists)
|
219
|
+
existing: account, message: I18n.t('message.account'), validator: Awskeyring.method(:account_exists),
|
220
|
+
limited_to: Awskeyring.list_account_names
|
202
221
|
)
|
203
222
|
Awskeyring.delete_account(account: account, message: I18n.t('message.delaccount', account: account))
|
204
223
|
end
|
@@ -207,7 +226,8 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
207
226
|
# remove a session token
|
208
227
|
def remove_token(account = nil)
|
209
228
|
account = ask_check(
|
210
|
-
existing: account, message: I18n.t('message.account'), validator: Awskeyring.method(:account_exists)
|
229
|
+
existing: account, message: I18n.t('message.account'), validator: Awskeyring.method(:account_exists),
|
230
|
+
limited_to: Awskeyring.list_account_names
|
211
231
|
)
|
212
232
|
Awskeyring.delete_token(account: account, message: I18n.t('message.deltoken', account: account))
|
213
233
|
end
|
@@ -217,7 +237,8 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
217
237
|
# remove a role
|
218
238
|
def remove_role(role = nil)
|
219
239
|
role = ask_check(
|
220
|
-
existing: role, message: I18n.t('message.role'), validator: Awskeyring
|
240
|
+
existing: role, message: I18n.t('message.role'), validator: Awskeyring.method(:role_exists),
|
241
|
+
limited_to: Awskeyring.list_role_names
|
221
242
|
)
|
222
243
|
Awskeyring.delete_role(role_name: role, message: I18n.t('message.delrole', role: role))
|
223
244
|
end
|
@@ -226,7 +247,10 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
226
247
|
# rotate Account keys
|
227
248
|
def rotate(account = nil) # rubocop:disable Metrics/MethodLength
|
228
249
|
account = ask_check(
|
229
|
-
existing: account,
|
250
|
+
existing: account,
|
251
|
+
message: I18n.t('message.account'),
|
252
|
+
validator: Awskeyring.method(:account_exists),
|
253
|
+
limited_to: Awskeyring.list_account_names
|
230
254
|
)
|
231
255
|
cred = Awskeyring.get_valid_creds(account: account, no_token: true)
|
232
256
|
|
@@ -237,8 +261,8 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
237
261
|
secret: cred[:secret],
|
238
262
|
key_message: I18n.t('message.rotate', account: account)
|
239
263
|
)
|
240
|
-
rescue Aws::Errors::ServiceError =>
|
241
|
-
warn
|
264
|
+
rescue Aws::Errors::ServiceError => e
|
265
|
+
warn e.to_s
|
242
266
|
exit 1
|
243
267
|
end
|
244
268
|
|
@@ -258,12 +282,16 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
258
282
|
# generate a sessiopn token
|
259
283
|
def token(account = nil, role = nil, code = nil) # rubocop:disable all
|
260
284
|
account = ask_check(
|
261
|
-
existing: account,
|
285
|
+
existing: account,
|
286
|
+
message: I18n.t('message.account'),
|
287
|
+
validator: Awskeyring.method(:account_exists),
|
288
|
+
limited_to: Awskeyring.list_account_names
|
262
289
|
)
|
263
290
|
role ||= options[:role]
|
264
291
|
if role
|
265
292
|
role = ask_check(
|
266
|
-
existing: role, message: I18n.t('message.role'), validator: Awskeyring
|
293
|
+
existing: role, message: I18n.t('message.role'), validator: Awskeyring.method(:role_exists),
|
294
|
+
limited_to: Awskeyring.list_role_names
|
267
295
|
)
|
268
296
|
end
|
269
297
|
code ||= options[:code]
|
@@ -291,8 +319,8 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
291
319
|
user: ENV['USER']
|
292
320
|
)
|
293
321
|
Awskeyring.delete_token(account: account, message: '# Removing STS credentials')
|
294
|
-
rescue Aws::Errors::ServiceError =>
|
295
|
-
warn
|
322
|
+
rescue Aws::Errors::ServiceError => e
|
323
|
+
warn e.to_s
|
296
324
|
exit 1
|
297
325
|
end
|
298
326
|
|
@@ -315,7 +343,10 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
315
343
|
# Open the AWS Console
|
316
344
|
def console(account = nil) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
317
345
|
account = ask_check(
|
318
|
-
existing: account,
|
346
|
+
existing: account,
|
347
|
+
message: I18n.t('message.account'),
|
348
|
+
validator: Awskeyring.method(:account_exists),
|
349
|
+
limited_to: Awskeyring.list_account_names
|
319
350
|
)
|
320
351
|
cred = age_check_and_get(account: account, no_token: options['no-token'])
|
321
352
|
|
@@ -329,8 +360,8 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
329
360
|
path: path,
|
330
361
|
user: ENV['USER']
|
331
362
|
)
|
332
|
-
rescue Aws::Errors::ServiceError =>
|
333
|
-
warn
|
363
|
+
rescue Aws::Errors::ServiceError => e
|
364
|
+
warn e.to_s
|
334
365
|
exit 1
|
335
366
|
end
|
336
367
|
|
@@ -375,7 +406,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
375
406
|
comp_len = 3 if curr.start_with?('-')
|
376
407
|
|
377
408
|
case prev
|
378
|
-
when 'help'
|
409
|
+
when 'help', File.basename($PROGRAM_NAME)
|
379
410
|
comp_len = 0
|
380
411
|
when 'remove-role', '-r', 'rmr'
|
381
412
|
comp_len = 2
|
@@ -431,13 +462,19 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
431
462
|
Awskeyring::Awsapi::AWS_ENV_VARS.each { |key| puts "unset #{key}" unless env_var.key?(key) }
|
432
463
|
end
|
433
464
|
|
434
|
-
def ask_check(existing:, message:,
|
465
|
+
def ask_check(existing:, message:, flags: nil, validator: nil, limited_to: nil) # rubocop:disable Metrics/MethodLength
|
435
466
|
retries ||= 3
|
436
467
|
begin
|
437
|
-
value = ask_missing(
|
438
|
-
|
439
|
-
|
440
|
-
|
468
|
+
value = ask_missing(
|
469
|
+
existing: existing,
|
470
|
+
message: message,
|
471
|
+
secure: 'secure'.eql?(flags),
|
472
|
+
optional: 'optional'.eql?(flags),
|
473
|
+
limited_to: limited_to
|
474
|
+
)
|
475
|
+
value = validator.call(value) unless value.empty? && 'optional'.eql?(flags)
|
476
|
+
rescue RuntimeError => e
|
477
|
+
warn e.message
|
441
478
|
existing = nil
|
442
479
|
retry unless (retries -= 1).zero?
|
443
480
|
exit 1
|
@@ -445,15 +482,17 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
445
482
|
value
|
446
483
|
end
|
447
484
|
|
448
|
-
def ask_missing(existing:, message:, secure: false, optional: false)
|
449
|
-
existing || ask(message: message, secure: secure, optional: optional).strip
|
485
|
+
def ask_missing(existing:, message:, secure: false, optional: false, limited_to: nil)
|
486
|
+
existing || ask(message: message, secure: secure, optional: optional, limited_to: limited_to).strip
|
450
487
|
end
|
451
488
|
|
452
|
-
def ask(message:, secure: false, optional: false)
|
489
|
+
def ask(message:, secure: false, optional: false, limited_to: nil)
|
453
490
|
if secure
|
454
491
|
Awskeyring::Input.read_secret(message.rjust(20) + ': ')
|
455
492
|
elsif optional
|
456
493
|
Thor::LineEditor.readline((message + ' (optional)').rjust(20) + ': ')
|
494
|
+
elsif limited_to
|
495
|
+
Thor::LineEditor.readline(message.rjust(20) + ': ', limited_to: limited_to)
|
457
496
|
else
|
458
497
|
Thor::LineEditor.readline(message.rjust(20) + ': ')
|
459
498
|
end
|
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:
|
4
|
+
version: 1.1.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: 2019-
|
11
|
+
date: 2019-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-iam
|
@@ -76,6 +76,7 @@ extra_rdoc_files: []
|
|
76
76
|
files:
|
77
77
|
- CHANGELOG.md
|
78
78
|
- CODE_OF_CONDUCT.md
|
79
|
+
- CONTRIBUTING.md
|
79
80
|
- Gemfile
|
80
81
|
- LICENSE.txt
|
81
82
|
- README.md
|
@@ -89,7 +90,7 @@ files:
|
|
89
90
|
- lib/awskeyring/validate.rb
|
90
91
|
- lib/awskeyring/version.rb
|
91
92
|
- lib/awskeyring_command.rb
|
92
|
-
homepage: https://github.com/
|
93
|
+
homepage: https://github.com/servian/awskeyring
|
93
94
|
licenses:
|
94
95
|
- MIT
|
95
96
|
metadata: {}
|
@@ -108,8 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
109
|
- !ruby/object:Gem::Version
|
109
110
|
version: '0'
|
110
111
|
requirements: []
|
111
|
-
|
112
|
-
rubygems_version: 2.5.2.3
|
112
|
+
rubygems_version: 3.0.3
|
113
113
|
signing_key:
|
114
114
|
specification_version: 4
|
115
115
|
summary: Manages AWS credentials in the macOS keychain
|