aws_runas 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +3 -2
- data/CHANGELOG.md +9 -0
- data/aws_runas.gemspec +1 -1
- data/lib/aws_runas/main.rb +5 -0
- data/lib/aws_runas/version.rb +1 -1
- data/spec/aws_runas/main_spec.rb +38 -8
- data/spec/helpers/config_spec.rb +1 -0
- data/spec/helpers/files/aws_config_nosource +6 -0
- metadata +6 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9e60ed4c0cf8087605426ff18b859a4effcb7d0
|
4
|
+
data.tar.gz: 23c46cc1407a5c521b8d7ac4a3130f85c3ef368e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2774fd7e5f13d104a7c2cf24bcd03f8402162e388a296dbfe75d1632e8a2c60477d106923a89a95ade20b8185fd324a40ef30de2a264ee3707620fd3818eb579
|
7
|
+
data.tar.gz: d283315d8d0025df28dc433b01fbd8a883f219c3dd1bb022e194f967ee4bf4d17a810bea6ec73e65aac40f5f497e5496fb7a67424452dfdcd99b953581a4cfdd
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
�{�ZL�q���G��ˉ٨xR�7�ˌ�):�[a�s?m`�`sE�ͫ��Z.je�J�Z��ӥo�=��;8���u)'F��O�;��d�qZ�] ��[�J���)=KWwj��2�wX�hK}&�.T���[w��)�*w�PW5�h��MpT|��h�}JF�z��uå�1l�H���]�z$
|
2
|
+
l
|
3
|
+
�_}|����-�����6IB�m��Zq�j5䂚<g�]b��*�6���։�Ԭ+9]:O9����O&n�ͳ
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## v0.3.1
|
2
|
+
|
3
|
+
This update sets `AWS_SDK_CONFIG_OPT_OUT` before the `aws-sdk` Ruby gem is
|
4
|
+
loaded to start assuming roles, to disable newer AWS Ruby SDK functionality that
|
5
|
+
allows the assumption of roles from `~/.aws/config` directly through the
|
6
|
+
toolchain. This conflicts with `aws-runas`'s own config file handling and breaks
|
7
|
+
in scenarios where one may want a default `~/.aws/config` file but no
|
8
|
+
credentials (ie: instance profiles).
|
9
|
+
|
1
10
|
## v0.3.0
|
2
11
|
|
3
12
|
Add session only features:
|
data/aws_runas.gemspec
CHANGED
data/lib/aws_runas/main.rb
CHANGED
@@ -14,6 +14,11 @@
|
|
14
14
|
|
15
15
|
require 'aws_runas/config'
|
16
16
|
require 'aws_runas/utils'
|
17
|
+
|
18
|
+
# AWS_SDK_CONFIG_OPT_OUT must be set here so that we use the pre-2.4 SDK
|
19
|
+
# behaviour, which ensures that ~/.aws/config is not re-read when assuming
|
20
|
+
# roles.
|
21
|
+
ENV.store('AWS_SDK_CONFIG_OPT_OUT', '1')
|
17
22
|
require 'aws-sdk'
|
18
23
|
|
19
24
|
module AwsRunAs
|
data/lib/aws_runas/version.rb
CHANGED
data/spec/aws_runas/main_spec.rb
CHANGED
@@ -16,6 +16,9 @@ require 'spec_helper'
|
|
16
16
|
require 'aws_runas/main'
|
17
17
|
|
18
18
|
MFA_ERROR = 'No mfa_serial in selected profile, session will be useless'.freeze
|
19
|
+
AWS_DEFAULT_CFG_PATH = "#{Dir.home}/.aws/config".freeze
|
20
|
+
AWS_DEFAULT_CREDENTIALS_PATH = "#{Dir.home}/.aws/credentials".freeze
|
21
|
+
AWS_LOCAL_CFG_PATH = "#{Dir.pwd}/aws_config".freeze
|
19
22
|
|
20
23
|
describe AwsRunAs::Main do
|
21
24
|
before(:context) do
|
@@ -68,6 +71,31 @@ describe AwsRunAs::Main do
|
|
68
71
|
ENV.store('AWS_SESSION_TOKEN', 'foo')
|
69
72
|
@main.assume_role
|
70
73
|
end
|
74
|
+
|
75
|
+
context 'with $HOME/.aws/config (test AWS_SDK_CONFIG_OPT_OUT)' do
|
76
|
+
before(:example) do
|
77
|
+
Aws.config.update(stub_responses: false)
|
78
|
+
allow(File).to receive(:exist?).with(AWS_LOCAL_CFG_PATH).and_return false
|
79
|
+
allow(File).to receive(:exist?).with(AWS_DEFAULT_CFG_PATH).and_return true
|
80
|
+
allow(File).to receive(:exist?).with(AWS_DEFAULT_CREDENTIALS_PATH).and_return false
|
81
|
+
allow(File).to receive(:read).with(AWS_DEFAULT_CFG_PATH).and_return File.read(MOCK_AWS_NO_SOURCE_PATH)
|
82
|
+
allow(IniFile).to receive(:load).with(AWS_DEFAULT_CFG_PATH).and_return IniFile.load(MOCK_AWS_NO_SOURCE_PATH)
|
83
|
+
allow(Aws::AssumeRoleCredentials).to receive(:new).and_return(
|
84
|
+
Aws::AssumeRoleCredentials.new(
|
85
|
+
role_arn: 'roleARN',
|
86
|
+
role_session_name: 'roleSessionName',
|
87
|
+
stub_responses: true
|
88
|
+
)
|
89
|
+
)
|
90
|
+
@main = AwsRunAs::Main.new(
|
91
|
+
profile: 'test-profile'
|
92
|
+
)
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'assumes a role correctly' do
|
96
|
+
@main.assume_role
|
97
|
+
end
|
98
|
+
end
|
71
99
|
end
|
72
100
|
|
73
101
|
describe '#credentials_env' do
|
@@ -75,16 +103,18 @@ describe AwsRunAs::Main do
|
|
75
103
|
@env = @main.credentials_env
|
76
104
|
end
|
77
105
|
|
78
|
-
|
79
|
-
|
80
|
-
|
106
|
+
context 'with a static, user-defined config path' do
|
107
|
+
it 'returns AWS_ACCESS_KEY_ID set in env' do
|
108
|
+
expect(@env['AWS_ACCESS_KEY_ID']).to eq('accessKeyIdType')
|
109
|
+
end
|
81
110
|
|
82
|
-
|
83
|
-
|
84
|
-
|
111
|
+
it 'returns AWS_SECRET_ACCESS_KEY set in env' do
|
112
|
+
expect(@env['AWS_SECRET_ACCESS_KEY']).to eq('accessKeySecretType')
|
113
|
+
end
|
85
114
|
|
86
|
-
|
87
|
-
|
115
|
+
it 'returns AWS_SESSION_TOKEN set in env' do
|
116
|
+
expect(@env['AWS_SESSION_TOKEN']).to eq('tokenType')
|
117
|
+
end
|
88
118
|
end
|
89
119
|
end
|
90
120
|
|
data/spec/helpers/config_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws_runas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Marchesi
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
reriQxVYXGlD8ZDuaKlDyVqUbF026ZHIlHKIgg90O037qFPxCBACTtxtYTP2hwug
|
32
32
|
Yis=
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2016-
|
34
|
+
date: 2016-10-24 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: aws-sdk
|
@@ -39,14 +39,14 @@ dependencies:
|
|
39
39
|
requirements:
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '2.
|
42
|
+
version: '2.6'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '2.
|
49
|
+
version: '2.6'
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
51
|
name: inifile
|
52
52
|
requirement: !ruby/object:Gem::Requirement
|
@@ -163,6 +163,7 @@ files:
|
|
163
163
|
- spec/helpers/config_spec.rb
|
164
164
|
- spec/helpers/files/aws_config
|
165
165
|
- spec/helpers/files/aws_config_nomfa
|
166
|
+
- spec/helpers/files/aws_config_nosource
|
166
167
|
- spec/spec_helper.rb
|
167
168
|
homepage: https://github.com/vancluever/aws-runas
|
168
169
|
licenses:
|
@@ -196,4 +197,5 @@ test_files:
|
|
196
197
|
- spec/helpers/config_spec.rb
|
197
198
|
- spec/helpers/files/aws_config
|
198
199
|
- spec/helpers/files/aws_config_nomfa
|
200
|
+
- spec/helpers/files/aws_config_nosource
|
199
201
|
- spec/spec_helper.rb
|
metadata.gz.sig
CHANGED
Binary file
|