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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1725b31ac831ab9d03534988e9503c9531933be
4
- data.tar.gz: 77d0509bb39c0d274bedb21152c8de1c340ed9d2
3
+ metadata.gz: f9e60ed4c0cf8087605426ff18b859a4effcb7d0
4
+ data.tar.gz: 23c46cc1407a5c521b8d7ac4a3130f85c3ef368e
5
5
  SHA512:
6
- metadata.gz: c2d5095da3b865dc73abf72abf2492f12641d1ddef9b772f82ce6f68427354dcc10da2f1e4f81ec2766ee59133911f3a85a83239aca40f9b937eabc8c6b16122
7
- data.tar.gz: 660afcfda580390e17abe2cf36e0dc1c91980121953209ffe5baf4bba83ebd08480a3304673e8987fc0120b675a3771ca29618303bccbcd576c5f068eaf62b9c
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
- ;h�&���m��Nޭ��v}����5��}�[a\L/SX���u�,X��k,
2
- {(�T�f�cTT����fx3��&��8����B�*��+���[��4��a�m(�*�R� .zl�N-� �f8&t�A0W78^m��&/�gҊ�M��)^���Do�N
1
+ �{�ZL�q���G��ˉ٨xR�7�ˌ�):�[a�s?m`�`sE�ͫ��Z.je�J�Z��ӥo�=��;8���u)'F��O�;��dqZ�] ��[�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
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
 
38
38
  spec.required_ruby_version = ['>= 2.1']
39
39
 
40
- spec.add_dependency 'aws-sdk', '~> 2.2'
40
+ spec.add_dependency 'aws-sdk', '~> 2.6'
41
41
  spec.add_dependency 'inifile', '~> 3.0'
42
42
  spec.add_dependency 'trollop', '~> 2.1'
43
43
 
@@ -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
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module AwsRunAs
16
- VERSION = '0.3.0'
16
+ VERSION = '0.3.1'
17
17
  end
@@ -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
- it 'returns AWS_ACCESS_KEY_ID set in env' do
79
- expect(@env['AWS_ACCESS_KEY_ID']).to eq('accessKeyIdType')
80
- end
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
- it 'returns AWS_SECRET_ACCESS_KEY set in env' do
83
- expect(@env['AWS_SECRET_ACCESS_KEY']).to eq('accessKeySecretType')
84
- end
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
- it 'returns AWS_SESSION_TOKEN set in env' do
87
- expect(@env['AWS_SESSION_TOKEN']).to eq('tokenType')
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
 
@@ -16,3 +16,4 @@ require 'spec_helper'
16
16
 
17
17
  MOCK_AWS_CONFIGPATH = File.expand_path('../files/aws_config', __FILE__)
18
18
  MOCK_AWS_NO_MFA_PATH = File.expand_path('../files/aws_config_nomfa', __FILE__)
19
+ MOCK_AWS_NO_SOURCE_PATH = File.expand_path('../files/aws_config_nosource', __FILE__)
@@ -0,0 +1,6 @@
1
+ [default]
2
+ region = us-east-1
3
+
4
+ [profile test-profile]
5
+ role_arn = arn:aws:iam::123456789012:role/test-admin
6
+ region = us-west-1
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.0
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-06-11 00:00:00.000000000 Z
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.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.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