aws-mfa-secure 0.4.0 → 0.4.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 +3 -0
- data/README.md +3 -1
- data/lib/aws_mfa_secure/cli.rb +1 -0
- data/lib/aws_mfa_secure/exports.rb +14 -5
- data/lib/aws_mfa_secure/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e66bc2f12700653f9b9bfd044cfab1432726f29209f5204c53ca788d54a86b0b
|
4
|
+
data.tar.gz: 0fd9d8501d6d5c29f18417bd1e547972023e9dc836a29718d834f5567a95b994
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8d1d77709dd02f91b5e3ea798dfcccdf12e6264bd07328d342440a4e6c027f41e8533378e3ca919a6a8e94ad689394a1970d3a3b6955d7772ed3cb6208bd4be
|
7
|
+
data.tar.gz: d3c13915fee57d807e567a86c10410646397e2b5bc62bb8309631b4bd9079b1a6d16ef3a316b88e7157bd303d317b44ccad3fe1eb2d393f47d144718765dd6ec
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [0.4.1]
|
7
|
+
- #3 no-mfa option for exports
|
8
|
+
|
6
9
|
## [0.4.0]
|
7
10
|
- #2 do not eager load ext/aws.rb
|
8
11
|
|
data/README.md
CHANGED
@@ -8,6 +8,8 @@
|
|
8
8
|
|
9
9
|
Surprisingly, the [aws cli](https://docs.aws.amazon.com/cli/latest/reference/) does not yet support MFA for normal IAM users. See: [boto/botocore/pull/1399](https://github.com/boto/botocore/pull/1399) The aws-mfa-secure tool decorates the AWS CLI or API to handle MFA authentication. The MFA prompt only activates if `mfa_serial` is configured.
|
10
10
|
|
11
|
+
An advantage of the aws-mfa-secure is that it caches the temporary credentials `~/.aws/aws-mfa-secure-sessions` and reuses them until they expire. The expiration is 8 hours by default. This means that when you open a new terminal tab, you won’t have to re-enter the MFA code.
|
12
|
+
|
11
13
|
## Installation
|
12
14
|
|
13
15
|
gem install aws-mfa-secure
|
@@ -41,7 +43,7 @@ Note: AWS already supports `mfa_serial` for assumed roles: [AWS Configuration an
|
|
41
43
|
|
42
44
|
alias aws="aws-mfa-secure session"
|
43
45
|
|
44
|
-
You may want to add the alias to your `~/.bash_profile`
|
46
|
+
The alias allows us to intercept the normal aws cli command and decorate it. The `aws-mfa-secure session` only activates if `mfa_serial` is configured in your `~/.aws/credentials` file. Otherwise, it will pass the command through to the normal aws cli. You may want to add the alias to your `~/.bash_profile` do you don't have to alias it every time you open a new terminal.
|
45
47
|
|
46
48
|
Autocompletion still works with the alias.
|
47
49
|
|
data/lib/aws_mfa_secure/cli.rb
CHANGED
@@ -8,6 +8,7 @@ module AwsMfaSecure
|
|
8
8
|
|
9
9
|
desc "exports", "Generate export statements that can be eval"
|
10
10
|
long_desc Help.text(:exports)
|
11
|
+
option :mfa, type: :boolean, desc: "Use --no-mfa to bypass the mfa_profile check for a normal get session token call"
|
11
12
|
def exports
|
12
13
|
Exports.new(options).run
|
13
14
|
end
|
@@ -6,6 +6,15 @@ module AwsMfaSecure
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def run
|
9
|
+
# Allow use `aws-mfa-secure exports --no-mfa`
|
10
|
+
# This bypasses the check for mfa_serial being configured in the ~/.aws/credentials profile
|
11
|
+
# Useful if we want to grab temporary AWS_xxx credentials for testing.
|
12
|
+
if @options[:mfa] == false
|
13
|
+
resp = sts.get_session_token
|
14
|
+
puts script(resp.credentials)
|
15
|
+
return
|
16
|
+
end
|
17
|
+
|
9
18
|
unless iam_mfa?
|
10
19
|
$stderr.puts "WARN: mfa_serial is not configured for this AWS_PROFILE=#{@aws_profile}"
|
11
20
|
return
|
@@ -16,14 +25,14 @@ module AwsMfaSecure
|
|
16
25
|
save_creds(resp.credentials.to_h)
|
17
26
|
end
|
18
27
|
|
19
|
-
puts script
|
28
|
+
puts script(credentials)
|
20
29
|
end
|
21
30
|
|
22
|
-
def script
|
31
|
+
def script(creds)
|
23
32
|
<<~EOL
|
24
|
-
export AWS_ACCESS_KEY_ID=#{
|
25
|
-
export AWS_SECRET_ACCESS_KEY=#{
|
26
|
-
export AWS_SESSION_TOKEN=#{
|
33
|
+
export AWS_ACCESS_KEY_ID=#{creds["access_key_id"]}
|
34
|
+
export AWS_SECRET_ACCESS_KEY=#{creds["secret_access_key"]}
|
35
|
+
export AWS_SESSION_TOKEN=#{creds["session_token"]}
|
27
36
|
EOL
|
28
37
|
end
|
29
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-mfa-secure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -243,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
243
243
|
- !ruby/object:Gem::Version
|
244
244
|
version: '0'
|
245
245
|
requirements: []
|
246
|
-
rubygems_version: 3.
|
246
|
+
rubygems_version: 3.1.2
|
247
247
|
signing_key:
|
248
248
|
specification_version: 4
|
249
249
|
summary: Adds MFA Support to AWS CLI and Ruby SDKs for normal IAM user
|