aws_runas 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +1 -0
- data/.gitignore +13 -0
- data/.rubocop.yml +5 -0
- data/.travis.yml +4 -0
- data/Gemfile +17 -0
- data/LICENSE +201 -0
- data/README.md +73 -0
- data/Rakefile +19 -0
- data/aws_runas.gemspec +47 -0
- data/certs/vancluever.pem +22 -0
- data/exe/aws-runas +19 -0
- data/lib/aws_runas/cli.rb +64 -0
- data/lib/aws_runas/config.rb +57 -0
- data/lib/aws_runas/main.rb +69 -0
- data/lib/aws_runas/version.rb +17 -0
- data/lib/aws_runas.rb +15 -0
- data/spec/aws_runas/cli_spec.rb +59 -0
- data/spec/aws_runas/config_spec.rb +78 -0
- data/spec/aws_runas/main_spec.rb +78 -0
- data/spec/helpers/config_spec.rb +17 -0
- data/spec/helpers/files/aws_config +8 -0
- data/spec/spec_helper.rb +30 -0
- data.tar.gz.sig +0 -0
- metadata +179 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 37b01d059e3e638dbb72b1f44c8c045538d5dd09
|
4
|
+
data.tar.gz: e87607cde3cf9fe18224cdb37c541250b043492e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 428dcad9d20132126ca3219a0281fde61eb623f4d381cc8c94978d9d253cb5b1995968db32bb78beda907772b1d259bbab35d6cb950738650350e39cdf0f0bda
|
7
|
+
data.tar.gz: e350dce44f330823342244ff1e8756170211a945d5028fcd92e18f4288d5a8d68e7836b47d40ffc4a9f4883d088e55dcb3fb2f8c368e6353436b644d956742dc
|
checksums.yaml.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
�)g&;�,�I䖞���@��GS^��:���5w�=��Ne/k�_9k5���`�'˖�B}� �_�'�,I�G;��5s/i�*+Ǹ�_ie�~��Т���̟s����a'70ܸߖ:��.UI\����m�W��(C�i�Mk2}�)��̝��mv�0��5.�
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Copyright 2015 Chris Marchesi
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
source 'https://rubygems.org'
|
16
|
+
|
17
|
+
gemspec
|
data/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright 2015 Chris Marchesi
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
aws-runas
|
2
|
+
==========
|
3
|
+
|
4
|
+
**The problem:** You manage AWS across several different roles and need to use
|
5
|
+
tools outside of the regular `aws-cli` toolchain.
|
6
|
+
|
7
|
+
**The solution:** Use `aws-runas` :)
|
8
|
+
|
9
|
+
Features
|
10
|
+
---------
|
11
|
+
|
12
|
+
There are a few other tools and shell scripts out there that do the same
|
13
|
+
thing, but there are some differentiators in this gem:
|
14
|
+
|
15
|
+
* Support for your roles already laid out in `~/.aws/config`.
|
16
|
+
* These roles can also be copied to a local `aws_config` file and pushed
|
17
|
+
to source control to ensure your deployment targets live with source.
|
18
|
+
* Support for single-run commands (supplied on the command line) or
|
19
|
+
interactive shell sessions (by supplying no commands).
|
20
|
+
* MFA will be auto-detected and only prompted for if necessary (allowing one
|
21
|
+
to assume a role that does not have a MFA serial supplied).
|
22
|
+
|
23
|
+
Usage
|
24
|
+
------
|
25
|
+
|
26
|
+
Install the gem (`gem install aws-runas`), and the command can be run via
|
27
|
+
`aws-runas` via your regular `$PATH`.
|
28
|
+
|
29
|
+
```
|
30
|
+
aws-runas: Run commands under AWS IAM roles
|
31
|
+
|
32
|
+
Usage:
|
33
|
+
aws-runas [options] COMMAND ARGS
|
34
|
+
|
35
|
+
If COMMAND is omitted, the default shell (/bin/sh) will
|
36
|
+
launch.
|
37
|
+
|
38
|
+
[options] are:
|
39
|
+
-p, --path=<s> Path to the AWS config file
|
40
|
+
-r, --profile=<s> The AWS profile to load (default: default)
|
41
|
+
-h, --help Show this message
|
42
|
+
```
|
43
|
+
|
44
|
+
`--path` is optional, and if omitted will default to the files in the
|
45
|
+
following order:
|
46
|
+
|
47
|
+
* `aws_config`, in the current working directory
|
48
|
+
* `~/.aws/config`, in your user directory.
|
49
|
+
|
50
|
+
|
51
|
+
Author
|
52
|
+
-------
|
53
|
+
|
54
|
+
Chris Marchesi <chrism@vancluevertech.com>
|
55
|
+
|
56
|
+
License
|
57
|
+
--------
|
58
|
+
|
59
|
+
```
|
60
|
+
Copyright 2015 Chris Marchesi
|
61
|
+
|
62
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
63
|
+
you may not use this file except in compliance with the License.
|
64
|
+
You may obtain a copy of the License at
|
65
|
+
|
66
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
67
|
+
|
68
|
+
Unless required by applicable law or agreed to in writing, software
|
69
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
70
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
71
|
+
See the License for the specific language governing permissions and
|
72
|
+
limitations under the License.
|
73
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Copyright 2015 Chris Marchesi
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require 'bundler/gem_tasks'
|
16
|
+
require 'rspec/core/rake_task'
|
17
|
+
RSpec::Core::RakeTask.new(:spec)
|
18
|
+
|
19
|
+
task :default => :spec
|
data/aws_runas.gemspec
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# Copyright 2015 Chris Marchesi
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
lib = File.expand_path('../lib', __FILE__)
|
16
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
17
|
+
require 'aws_runas/version'
|
18
|
+
|
19
|
+
Gem::Specification.new do |spec|
|
20
|
+
spec.name = 'aws_runas'
|
21
|
+
spec.version = AwsRunAs::VERSION
|
22
|
+
spec.authors = ['Chris Marchesi']
|
23
|
+
spec.email = %w(chrism@vancluevertech.com)
|
24
|
+
spec.description = 'Run a command or shell under an assumed AWS IAM role'
|
25
|
+
spec.summary = spec.description
|
26
|
+
spec.homepage = 'https://github.com/vancluever/aws-runas'
|
27
|
+
spec.license = 'Apache 2.0'
|
28
|
+
|
29
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.bindir = 'exe'
|
32
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
33
|
+
spec.require_paths = %w(lib)
|
34
|
+
|
35
|
+
spec.cert_chain = ['certs/vancluever.pem']
|
36
|
+
spec.signing_key = File.expand_path('~/.ssh/gem-private_key.pem') if $PROGRAM_NAME =~ /gem\z/
|
37
|
+
|
38
|
+
spec.required_ruby_version = ['>= 2.1.7']
|
39
|
+
|
40
|
+
spec.add_dependency 'aws-sdk', '~> 2.2.1'
|
41
|
+
spec.add_dependency 'inifile', '~> 3.0.0'
|
42
|
+
spec.add_dependency 'trollop', '~> 2.1.2'
|
43
|
+
|
44
|
+
spec.add_development_dependency 'rake', '~> 10.4.2'
|
45
|
+
spec.add_development_dependency 'rspec', '~> 3.4.0'
|
46
|
+
spec.add_development_dependency 'simplecov', '~> 0.10.0'
|
47
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIDjjCCAnagAwIBAgIBATANBgkqhkiG9w0BAQUFADBGMQ8wDQYDVQQDDAZjaHJp
|
3
|
+
c20xHjAcBgoJkiaJk/IsZAEZFg52YW5jbHVldmVydGVjaDETMBEGCgmSJomT8ixk
|
4
|
+
ARkWA2NvbTAeFw0xNTExMjMyMzQ3NTdaFw0xNjExMjIyMzQ3NTdaMEYxDzANBgNV
|
5
|
+
BAMMBmNocmlzbTEeMBwGCgmSJomT8ixkARkWDnZhbmNsdWV2ZXJ0ZWNoMRMwEQYK
|
6
|
+
CZImiZPyLGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
|
7
|
+
uQTxFEI+Xzntwk3P+EAX4alaLkLAUA4x5jVbP4bEaOIfixQkur5js3XS5UfKlxEW
|
8
|
+
Tf4pmiXqlrrLSm5o1EURpQao8DdWkMiAvfr/M8WHTzWng+YmpvctjcGFofq4w+Zk
|
9
|
+
IJ0RsOEKFv7VOSn3qr1Aee9BVXSPb0+yCu6Kjt8u768M2wq8WNQW66XG2+tQW4UT
|
10
|
+
khadeSU2srZfd7H7T3LSzjOtWedcy/foiJvULlWqFuBUv67Qp04GXHT4n5cukuIH
|
11
|
+
eNQgqfa9CIyhzpyyS+mPY8D8ewjIWrptQbUiFeB2dE37xes+uaRMdwwhk2oU6jLV
|
12
|
+
QMv1YG4V3JxFpTNPea5jfQIDAQABo4GGMIGDMAkGA1UdEwQCMAAwCwYDVR0PBAQD
|
13
|
+
AgSwMB0GA1UdDgQWBBRj5uLoIYZHX/b+IlvCAN337VfHpzAkBgNVHREEHTAbgRlj
|
14
|
+
aHJpc21AdmFuY2x1ZXZlcnRlY2guY29tMCQGA1UdEgQdMBuBGWNocmlzbUB2YW5j
|
15
|
+
bHVldmVydGVjaC5jb20wDQYJKoZIhvcNAQEFBQADggEBAH5sOPRECuSAXi6eXk1g
|
16
|
+
04V407WVxvc2Hu3uuyIIna43VbjI9yJ3C8DpRDxOCJylJCeuINm21CkIYbizUCXo
|
17
|
+
E/KLT1S+kpSnNqccX0DHqrDWHPZ8ilWSaWQlMRiK0wXwcPOvRvbEkJETZkIKJxgF
|
18
|
+
FdFk9TXbiqYN/owwcHkhfbpoFtP2VQ3jMsGvMsYDq1r2IZvNLH0O1ZFj+LEmG+TL
|
19
|
+
E1p79m5ad6mXuceNGNmPacLSkJWLfKZXaxjB8Yz1fINOmnXTBgxP67ix9ini3EM6
|
20
|
+
reriQxVYXGlD8ZDuaKlDyVqUbF026ZHIlHKIgg90O037qFPxCBACTtxtYTP2hwug
|
21
|
+
Yis=
|
22
|
+
-----END CERTIFICATE-----
|
data/exe/aws-runas
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Copyright 2015 Chris Marchesi
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
require 'aws_runas/cli'
|
18
|
+
|
19
|
+
AwsRunAs::Cli.start
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# Copyright 2015 Chris Marchesi
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require 'trollop'
|
16
|
+
require 'aws_runas/config'
|
17
|
+
require 'aws_runas/main'
|
18
|
+
require 'io/console'
|
19
|
+
|
20
|
+
module AwsRunAs
|
21
|
+
module Cli
|
22
|
+
module_function
|
23
|
+
|
24
|
+
# loads the command-line options.
|
25
|
+
def load_opts(args: ARGV)
|
26
|
+
Trollop.options(args) do
|
27
|
+
banner <<-EOS.gsub(/^ {10}/, '')
|
28
|
+
aws-runas: Run commands under AWS IAM roles
|
29
|
+
|
30
|
+
Usage:
|
31
|
+
aws-runas [options] COMMAND ARGS
|
32
|
+
|
33
|
+
If COMMAND is omitted, the default shell (/bin/sh) will
|
34
|
+
launch.
|
35
|
+
|
36
|
+
[options] are:
|
37
|
+
EOS
|
38
|
+
|
39
|
+
opt :path, 'Path to the AWS config file', type: String
|
40
|
+
opt :profile, 'The AWS profile to load', type: String, default: 'default'
|
41
|
+
stop_on_unknown
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Start the CLI. Load options (profile, specific config path), and run
|
46
|
+
# main.
|
47
|
+
def start
|
48
|
+
opts = load_opts
|
49
|
+
mfa_code = read_mfa_if_needed(path: opts[:path], profile: opts[:profile])
|
50
|
+
@main = AwsRunAs::Main.new(path: opts[:path], profile: opts[:profile], mfa_code: mfa_code)
|
51
|
+
@main.assume_role
|
52
|
+
command = ARGV.shift
|
53
|
+
@main.handoff(command: command, argv: ARGV)
|
54
|
+
end
|
55
|
+
|
56
|
+
# Reads the MFA code from standard input.
|
57
|
+
def read_mfa_if_needed(path: nil, profile: 'default')
|
58
|
+
@cfg = AwsRunAs::Config.new(path: path, profile: profile)
|
59
|
+
return nil unless @cfg.mfa_required?
|
60
|
+
puts 'Enter MFA code:'
|
61
|
+
STDIN.noecho(&:gets).chomp
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Copyright 2015 Chris Marchesi
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require 'inifile'
|
16
|
+
|
17
|
+
module AwsRunAs
|
18
|
+
# Manages the configuartion file, including loading and retrieving values.
|
19
|
+
class Config
|
20
|
+
# Finds the configuration file (used if no file is specified).
|
21
|
+
# paths searched: ./aws_config, and ~/.aws/config.
|
22
|
+
def self.find_config_file
|
23
|
+
local_config = File.expand_path('aws_config')
|
24
|
+
user_config = File.expand_path('~/.aws/config')
|
25
|
+
return local_config if File.exist?(local_config)
|
26
|
+
user_config if File.exist?(user_config)
|
27
|
+
end
|
28
|
+
|
29
|
+
def initialize(path:, profile:)
|
30
|
+
@path = path
|
31
|
+
@path = self.class.find_config_file unless @path
|
32
|
+
@profile = profile
|
33
|
+
end
|
34
|
+
|
35
|
+
# Loads the config section for a specific profile.
|
36
|
+
def load_config_value(key:)
|
37
|
+
section = @profile
|
38
|
+
section = "profile #{@profile}" unless @profile == 'default'
|
39
|
+
aws_config = IniFile.load(@path) if File.exist?(@path)
|
40
|
+
nil unless aws_config
|
41
|
+
aws_config[section][key]
|
42
|
+
end
|
43
|
+
|
44
|
+
# Checks to see if MFA is required for a specific profile.
|
45
|
+
def mfa_required?
|
46
|
+
return true if load_config_value(key: 'mfa_serial')
|
47
|
+
false
|
48
|
+
end
|
49
|
+
|
50
|
+
# loads the soruce credentials profile based on the supplied profile.
|
51
|
+
def load_source_profile
|
52
|
+
source_profile = load_config_value(key: 'source_profile')
|
53
|
+
return source_profile if source_profile
|
54
|
+
profile
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# Copyright 2015 Chris Marchesi
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require 'aws_runas/config'
|
16
|
+
require 'aws-sdk'
|
17
|
+
|
18
|
+
module AwsRunAs
|
19
|
+
# Main program logic for aws-runas - sets up sts asession and assumed role,
|
20
|
+
# and hands off environment to called process.
|
21
|
+
class Main
|
22
|
+
# Instantiate the object and set up the path, profile, and
|
23
|
+
def initialize(path: nil, profile: default, mfa_code: nil)
|
24
|
+
if path
|
25
|
+
cfg_path = path
|
26
|
+
else
|
27
|
+
cfg_path = AwsRunAs::Config.find_config_file
|
28
|
+
end
|
29
|
+
@cfg = AwsRunAs::Config.new(path: cfg_path, profile: profile)
|
30
|
+
@mfa_code = mfa_code
|
31
|
+
end
|
32
|
+
|
33
|
+
def sts_client
|
34
|
+
region = @cfg.load_config_value(key: 'region')
|
35
|
+
region = 'us-east-1' unless region
|
36
|
+
Aws::STS::Client.new(
|
37
|
+
profile: @cfg.load_source_profile,
|
38
|
+
region: region
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
def assume_role
|
43
|
+
session_id = "aws-runas-session_#{Time.now.to_i}"
|
44
|
+
role_arn = @cfg.load_config_value(key: 'role_arn')
|
45
|
+
mfa_serial = @cfg.load_config_value(key: 'mfa_serial')
|
46
|
+
@role_credentials = Aws::AssumeRoleCredentials.new(
|
47
|
+
client: sts_client,
|
48
|
+
role_arn: role_arn,
|
49
|
+
serial_number: mfa_serial,
|
50
|
+
token_code: @mfa_code,
|
51
|
+
role_session_name: session_id
|
52
|
+
).credentials
|
53
|
+
end
|
54
|
+
|
55
|
+
def credentials_env
|
56
|
+
env = {}
|
57
|
+
env['AWS_ACCESS_KEY_ID'] = @role_credentials.access_key_id
|
58
|
+
env['AWS_SECRET_ACCESS_KEY'] = @role_credentials.secret_access_key
|
59
|
+
env['AWS_SESSION_TOKEN'] = @role_credentials.session_token
|
60
|
+
env
|
61
|
+
end
|
62
|
+
|
63
|
+
def handoff(command: nil, argv: nil)
|
64
|
+
env = credentials_env
|
65
|
+
command = '/bin/sh' unless command
|
66
|
+
exec(env, command, *argv)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Copyright 2015 Chris Marchesi
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
module AwsRunAs
|
16
|
+
VERSION = '0.1.1'
|
17
|
+
end
|
data/lib/aws_runas.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Copyright 2015 Chris Marchesi
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require 'aws_runas/main'
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# Copyright 2015 Chris Marchesi
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require 'spec_helper'
|
16
|
+
require 'aws_runas/cli'
|
17
|
+
require 'aws_runas/main'
|
18
|
+
|
19
|
+
describe AwsRunAs::Cli do
|
20
|
+
describe '::load_opts' do
|
21
|
+
it 'loads the path option' do
|
22
|
+
opts = AwsRunAs::Cli.load_opts(args: ['--path', 'test-opts/aws_config'])
|
23
|
+
expect(opts[:path]).to eq('test-opts/aws_config')
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'loads the profile option' do
|
27
|
+
opts = AwsRunAs::Cli.load_opts(args: ['--profile', 'test-profile'])
|
28
|
+
expect(opts[:profile]).to eq('test-profile')
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '::start' do
|
33
|
+
before(:example) do
|
34
|
+
allow(AwsRunAs::Cli).to receive(:load_opts).and_return({})
|
35
|
+
allow(AwsRunAs::Cli).to receive(:read_mfa_if_needed)
|
36
|
+
allow(AwsRunAs::Main).to receive(:new).and_return double(
|
37
|
+
'AwsRunAs::Main',
|
38
|
+
assume_role: true,
|
39
|
+
handoff: true
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'creates an AwsConfig::Main instance' do
|
44
|
+
expect(AwsRunAs::Main).to receive(:new)
|
45
|
+
AwsRunAs::Cli.start
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe '::read_mfa_if_needed' do
|
50
|
+
it 'reads the MFA code' do
|
51
|
+
allow(STDIN).to receive(:gets).and_return('123456')
|
52
|
+
mfa_code = AwsRunAs::Cli.read_mfa_if_needed(
|
53
|
+
path: MOCK_AWS_CONFIGPATH,
|
54
|
+
profile: 'test-profile'
|
55
|
+
)
|
56
|
+
expect(mfa_code).to eq('123456')
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# Copyright 2015 Chris Marchesi
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require 'spec_helper'
|
16
|
+
require 'aws_runas/config'
|
17
|
+
|
18
|
+
describe AwsRunAs::Config do
|
19
|
+
describe '::find_config_file' do
|
20
|
+
before(:example) do
|
21
|
+
allow(File).to receive(:expand_path).with('aws_config').and_return('./aws_config')
|
22
|
+
allow(File).to receive(:expand_path).with('~/.aws/config').and_return('./.aws/config')
|
23
|
+
allow(File).to receive(:exist?).with('./.aws/config').and_return true
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'finds a file at ./aws_config' do
|
27
|
+
allow(File).to receive(:exist?).with('./aws_config').and_return true
|
28
|
+
expect(AwsRunAs::Config.find_config_file).to eq('./aws_config')
|
29
|
+
end
|
30
|
+
it 'finds a file at ~/.aws/config' do
|
31
|
+
allow(File).to receive(:exist?).with('./aws_config').and_return false
|
32
|
+
expect(AwsRunAs::Config.find_config_file).to eq('./.aws/config')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'with profile set to default' do
|
37
|
+
before(:context) do
|
38
|
+
@cfg = AwsRunAs::Config.new(path: MOCK_AWS_CONFIGPATH, profile: 'default')
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#load_config_value' do
|
42
|
+
it 'loads a value from the default profile' do
|
43
|
+
expect(@cfg.load_config_value(key: 'region')).to eq('us-east-1')
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context 'with profile set to test-profile' do
|
49
|
+
before(:context) do
|
50
|
+
@cfg = AwsRunAs::Config.new(path: MOCK_AWS_CONFIGPATH, profile: 'test-profile')
|
51
|
+
end
|
52
|
+
|
53
|
+
describe '#initialize' do
|
54
|
+
it 'sets the profile correctly' do
|
55
|
+
expect(@cfg.instance_variable_get('@profile')).to eq('test-profile')
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe '#load_config_value' do
|
60
|
+
it 'loads a value from the non-default profile' do
|
61
|
+
expect(@cfg.load_config_value(key: 'mfa_serial')).to eq('arn:aws:iam::123456789012:mfa/test')
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe '#mfa_required' do
|
66
|
+
it 'confirms MFA is required the non-default profile' do
|
67
|
+
expect(@cfg.instance_variable_get('@profile')).to eq('test-profile')
|
68
|
+
expect(@cfg.mfa_required?).to be true
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe '#load_source_profile' do
|
73
|
+
it 'loads the source credentials profile for the the non-default profile' do
|
74
|
+
expect(@cfg.load_source_profile).to eq('default')
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# Copyright 2015 Chris Marchesi
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require 'spec_helper'
|
16
|
+
require 'aws_runas/main'
|
17
|
+
|
18
|
+
describe AwsRunAs::Main do
|
19
|
+
before(:context) do
|
20
|
+
@main = AwsRunAs::Main.new(
|
21
|
+
path: MOCK_AWS_CONFIGPATH,
|
22
|
+
profile: 'test-profile',
|
23
|
+
mfa_code: '123456'
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '#sts_client' do
|
28
|
+
it 'returns a proper Aws::STS::Client object' do
|
29
|
+
expect(@main.sts_client.class.name).to eq('Aws::STS::Client')
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '#assume_role' do
|
34
|
+
it 'calls out to Aws::AssumeRoleCredentials.new' do
|
35
|
+
expect(Aws::AssumeRoleCredentials).to receive(:new).and_call_original
|
36
|
+
@main.assume_role
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#credentials_env' do
|
41
|
+
before(:context) do
|
42
|
+
@env = @main.credentials_env
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'returns AWS_ACCESS_KEY_ID set in env' do
|
46
|
+
expect(@env['AWS_ACCESS_KEY_ID']).to eq('accessKeyIdType')
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'returns AWS_SECRET_ACCESS_KEY set in env' do
|
50
|
+
expect(@env['AWS_SECRET_ACCESS_KEY']).to eq('accessKeySecretType')
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'returns AWS_SESSION_TOKEN set in env' do
|
54
|
+
expect(@env['AWS_SESSION_TOKEN']).to eq('tokenType')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe '#handoff' do
|
59
|
+
before(:context) do
|
60
|
+
@env = @main.credentials_env
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'calls exec with the environment properly set' do
|
64
|
+
expect(@main).to receive(:exec).with(@env, any_args)
|
65
|
+
@main.handoff
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'starts a shell if no command is specified' do
|
69
|
+
expect(@main).to receive(:exec).with(@env, '/bin/sh', *nil)
|
70
|
+
@main.handoff
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'execs a command when a command is specified' do
|
74
|
+
expect(@main).to receive(:exec).with(anything, '/usr/bin/foo', *['--bar', 'baz'])
|
75
|
+
@main.handoff(command: '/usr/bin/foo', argv: ['--bar', 'baz'])
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Copyright 2015 Chris Marchesi
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require 'spec_helper'
|
16
|
+
|
17
|
+
MOCK_AWS_CONFIGPATH = File.expand_path('../files/aws_config', __FILE__)
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Copyright 2015 Chris Marchesi
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require 'simplecov'
|
16
|
+
SimpleCov.start do
|
17
|
+
add_filter '/vendor/'
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'aws-sdk'
|
21
|
+
|
22
|
+
RSpec.configure do |config|
|
23
|
+
config.color = true
|
24
|
+
|
25
|
+
config.mock_with :rspec do |mocks|
|
26
|
+
mocks.verify_partial_doubles = true
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
Aws.config.update(stub_responses: true)
|
data.tar.gz.sig
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,179 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aws_runas
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chris Marchesi
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDjjCCAnagAwIBAgIBATANBgkqhkiG9w0BAQUFADBGMQ8wDQYDVQQDDAZjaHJp
|
14
|
+
c20xHjAcBgoJkiaJk/IsZAEZFg52YW5jbHVldmVydGVjaDETMBEGCgmSJomT8ixk
|
15
|
+
ARkWA2NvbTAeFw0xNTExMjMyMzQ3NTdaFw0xNjExMjIyMzQ3NTdaMEYxDzANBgNV
|
16
|
+
BAMMBmNocmlzbTEeMBwGCgmSJomT8ixkARkWDnZhbmNsdWV2ZXJ0ZWNoMRMwEQYK
|
17
|
+
CZImiZPyLGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
|
18
|
+
uQTxFEI+Xzntwk3P+EAX4alaLkLAUA4x5jVbP4bEaOIfixQkur5js3XS5UfKlxEW
|
19
|
+
Tf4pmiXqlrrLSm5o1EURpQao8DdWkMiAvfr/M8WHTzWng+YmpvctjcGFofq4w+Zk
|
20
|
+
IJ0RsOEKFv7VOSn3qr1Aee9BVXSPb0+yCu6Kjt8u768M2wq8WNQW66XG2+tQW4UT
|
21
|
+
khadeSU2srZfd7H7T3LSzjOtWedcy/foiJvULlWqFuBUv67Qp04GXHT4n5cukuIH
|
22
|
+
eNQgqfa9CIyhzpyyS+mPY8D8ewjIWrptQbUiFeB2dE37xes+uaRMdwwhk2oU6jLV
|
23
|
+
QMv1YG4V3JxFpTNPea5jfQIDAQABo4GGMIGDMAkGA1UdEwQCMAAwCwYDVR0PBAQD
|
24
|
+
AgSwMB0GA1UdDgQWBBRj5uLoIYZHX/b+IlvCAN337VfHpzAkBgNVHREEHTAbgRlj
|
25
|
+
aHJpc21AdmFuY2x1ZXZlcnRlY2guY29tMCQGA1UdEgQdMBuBGWNocmlzbUB2YW5j
|
26
|
+
bHVldmVydGVjaC5jb20wDQYJKoZIhvcNAQEFBQADggEBAH5sOPRECuSAXi6eXk1g
|
27
|
+
04V407WVxvc2Hu3uuyIIna43VbjI9yJ3C8DpRDxOCJylJCeuINm21CkIYbizUCXo
|
28
|
+
E/KLT1S+kpSnNqccX0DHqrDWHPZ8ilWSaWQlMRiK0wXwcPOvRvbEkJETZkIKJxgF
|
29
|
+
FdFk9TXbiqYN/owwcHkhfbpoFtP2VQ3jMsGvMsYDq1r2IZvNLH0O1ZFj+LEmG+TL
|
30
|
+
E1p79m5ad6mXuceNGNmPacLSkJWLfKZXaxjB8Yz1fINOmnXTBgxP67ix9ini3EM6
|
31
|
+
reriQxVYXGlD8ZDuaKlDyVqUbF026ZHIlHKIgg90O037qFPxCBACTtxtYTP2hwug
|
32
|
+
Yis=
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
date: 2015-11-24 00:00:00.000000000 Z
|
35
|
+
dependencies:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: aws-sdk
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 2.2.1
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 2.2.1
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: inifile
|
52
|
+
requirement: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 3.0.0
|
57
|
+
type: :runtime
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 3.0.0
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: trollop
|
66
|
+
requirement: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 2.1.2
|
71
|
+
type: :runtime
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - "~>"
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 2.1.2
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rake
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - "~>"
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: 10.4.2
|
85
|
+
type: :development
|
86
|
+
prerelease: false
|
87
|
+
version_requirements: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - "~>"
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: 10.4.2
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
name: rspec
|
94
|
+
requirement: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - "~>"
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 3.4.0
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - "~>"
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: 3.4.0
|
106
|
+
- !ruby/object:Gem::Dependency
|
107
|
+
name: simplecov
|
108
|
+
requirement: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - "~>"
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 0.10.0
|
113
|
+
type: :development
|
114
|
+
prerelease: false
|
115
|
+
version_requirements: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - "~>"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: 0.10.0
|
120
|
+
description: Run a command or shell under an assumed AWS IAM role
|
121
|
+
email:
|
122
|
+
- chrism@vancluevertech.com
|
123
|
+
executables:
|
124
|
+
- aws-runas
|
125
|
+
extensions: []
|
126
|
+
extra_rdoc_files: []
|
127
|
+
files:
|
128
|
+
- ".gitignore"
|
129
|
+
- ".rubocop.yml"
|
130
|
+
- ".travis.yml"
|
131
|
+
- Gemfile
|
132
|
+
- LICENSE
|
133
|
+
- README.md
|
134
|
+
- Rakefile
|
135
|
+
- aws_runas.gemspec
|
136
|
+
- certs/vancluever.pem
|
137
|
+
- exe/aws-runas
|
138
|
+
- lib/aws_runas.rb
|
139
|
+
- lib/aws_runas/cli.rb
|
140
|
+
- lib/aws_runas/config.rb
|
141
|
+
- lib/aws_runas/main.rb
|
142
|
+
- lib/aws_runas/version.rb
|
143
|
+
- spec/aws_runas/cli_spec.rb
|
144
|
+
- spec/aws_runas/config_spec.rb
|
145
|
+
- spec/aws_runas/main_spec.rb
|
146
|
+
- spec/helpers/config_spec.rb
|
147
|
+
- spec/helpers/files/aws_config
|
148
|
+
- spec/spec_helper.rb
|
149
|
+
homepage: https://github.com/vancluever/aws-runas
|
150
|
+
licenses:
|
151
|
+
- Apache 2.0
|
152
|
+
metadata: {}
|
153
|
+
post_install_message:
|
154
|
+
rdoc_options: []
|
155
|
+
require_paths:
|
156
|
+
- lib
|
157
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
158
|
+
requirements:
|
159
|
+
- - ">="
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: 2.1.7
|
162
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
requirements: []
|
168
|
+
rubyforge_project:
|
169
|
+
rubygems_version: 2.4.5.1
|
170
|
+
signing_key:
|
171
|
+
specification_version: 4
|
172
|
+
summary: Run a command or shell under an assumed AWS IAM role
|
173
|
+
test_files:
|
174
|
+
- spec/aws_runas/cli_spec.rb
|
175
|
+
- spec/aws_runas/config_spec.rb
|
176
|
+
- spec/aws_runas/main_spec.rb
|
177
|
+
- spec/helpers/config_spec.rb
|
178
|
+
- spec/helpers/files/aws_config
|
179
|
+
- spec/spec_helper.rb
|
metadata.gz.sig
ADDED
Binary file
|