aws_security_viz 0.1.5.pre.alpha.pre.133 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.travis.yml +1 -1
- data/CHANGELOG.md +0 -17
- data/README.md +0 -11
- data/aws_security_viz.gemspec +4 -2
- data/lib/color_picker.rb +1 -228
- data/lib/provider/ec2.rb +19 -19
- data/spec/spec_helper.rb +8 -13
- data/spec/visualize_aws_spec.rb +29 -24
- metadata +76 -38
- data/Dockerfile +0 -9
- data/spec/color_picker_spec.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 013f7c6e5a7f2fd2984161c206560108439a7ba8
|
4
|
+
data.tar.gz: ca779e2929574efc55e771eff9397def34129c2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb3b21be3cabf46b232145c55395ad293a5b977ac9dad72c03f43fe0f3cb06541feefd5ed39b552a3e40e87f553cebf4cb5b7c01ea13c4632f693185ec6c9701
|
7
|
+
data.tar.gz: 7d8cffdaf190807ed531fa9efa21b44875cff97ab275eb126ea702c396141ba86d6ff8d4ca43368e3542fcbda5fd26c671f6e7c4eb27cb40e6e79d5dc1a81559
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -3,23 +3,6 @@ All notable changes to this project will be documented in this file.
|
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
|
5
5
|
## [Unreleased]
|
6
|
-
### Changed
|
7
|
-
- Replaced fog gem with aws-sdk-ec2
|
8
|
-
- Upgrade bundler to 2.x
|
9
|
-
- Removed unused dependencies
|
10
|
-
|
11
|
-
### Fixed
|
12
|
-
- Issue with --color=true failing with exception due to change in Graphviz library.
|
13
|
-
|
14
|
-
## [0.1.5] - 2018-10-10
|
15
|
-
### Added
|
16
|
-
- Filter by VPC id
|
17
|
-
- Support for AWS session token
|
18
|
-
- Use rankdir with graphviz to improve layout
|
19
|
-
|
20
|
-
### Changed
|
21
|
-
- Dependent trollop gem renamed to optimist
|
22
|
-
- Switched from ruby-graphviz to graphviz gem
|
23
6
|
|
24
7
|
## [0.1.4] - 2017-02-03
|
25
8
|
### Added
|
data/README.md
CHANGED
@@ -49,17 +49,6 @@ To generate a web view
|
|
49
49
|
* The json file name needs to be passed in as a html fragment identifier.
|
50
50
|
* The generated graph can be viewed in a webserver e.g. http://localhost:3000/view.html#aws.json by using `python -m SimpleHTTPServer 3000` (python2) or `python -m http.server 3000` (python3)
|
51
51
|
|
52
|
-
## DOCKER USAGE
|
53
|
-
|
54
|
-
If you don't want to install the dependencies and ruby libs you can execute aws-security-viz inside a docker container. To do so, follow these steps:
|
55
|
-
|
56
|
-
1. Clone this repository, open it in a console.
|
57
|
-
2. Build the docker container: `sudo docker build -t sec-viz .`
|
58
|
-
3. Run the container: `sudo docker run -i --rm -t -p 3000:3000 --name sec-viz sec-viz` (Description: `-i` interactive shell, `--rm` remove the container after usage, `-t` attach this terminal to it, `-p 3000:3000` we expose port 3000 for the HTTP server, `-name sec-viz` the container will have the same name as the image we will start)
|
59
|
-
4. Now you can use the tool as described in [usage](#USAGE). Make sure that you use the commands with `bundler exec ` as prefix. For example: `bundler exec aws_security_viz -a your_aws_key -s your_aws_secret_key -f aws.json`.
|
60
|
-
5. To start the web view, execute `python -m SimpleHTTPServer 3000` in the container. You can open it with your local browser at `http://0.0.0.0:3000/`. There you can view the generated images and the graph. Use `Ctrl+C` to close the HTTP server.
|
61
|
-
6. Terminate the docker container by typing `exit` in the console.
|
62
|
-
|
63
52
|
### Help
|
64
53
|
|
65
54
|
```
|
data/aws_security_viz.gemspec
CHANGED
@@ -21,15 +21,17 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
22
22
|
s.require_paths = ['lib']
|
23
23
|
|
24
|
-
s.add_development_dependency 'bundler', '~>
|
24
|
+
s.add_development_dependency 'bundler', '~> 1.15'
|
25
25
|
s.add_development_dependency 'rake', '~> 12.0', '>= 12.0.0'
|
26
26
|
s.add_development_dependency 'rspec', '~> 3.5', '>= 3.5.0'
|
27
27
|
|
28
28
|
s.add_runtime_dependency 'graphviz', '~> 1.1', '>= 1.1.0'
|
29
|
+
s.add_runtime_dependency 'fog-aws', '~> 2.0', '>= 2.0.1'
|
30
|
+
s.add_runtime_dependency 'unf', '~> 0.1.4'
|
31
|
+
s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'
|
29
32
|
s.add_runtime_dependency 'optimist', '~> 3.0.0'
|
30
33
|
s.add_runtime_dependency 'organic_hash', '~> 1.0', '>= 1.0.2'
|
31
34
|
s.add_runtime_dependency 'rgl', '~> 0.5.3'
|
32
|
-
s.add_runtime_dependency 'aws-sdk-ec2', '~> 1.65.0'
|
33
35
|
|
34
36
|
s.required_ruby_version = '>= 2.0.0'
|
35
37
|
end
|
data/lib/color_picker.rb
CHANGED
@@ -7,7 +7,7 @@ class ColorPicker
|
|
7
7
|
end
|
8
8
|
class NodeColors
|
9
9
|
def color(index, ingress)
|
10
|
-
|
10
|
+
GraphViz::Utils::Colors::COLORS.keys[index]
|
11
11
|
end
|
12
12
|
end
|
13
13
|
class DefaultColors
|
@@ -15,231 +15,4 @@ class ColorPicker
|
|
15
15
|
ingress ? :blue : :red
|
16
16
|
end
|
17
17
|
end
|
18
|
-
|
19
|
-
COLORS = %w(
|
20
|
-
#00004c
|
21
|
-
#000080
|
22
|
-
#0000fb
|
23
|
-
#003a52
|
24
|
-
#0040cd
|
25
|
-
#0050b2
|
26
|
-
#005390
|
27
|
-
#007800
|
28
|
-
#007eff
|
29
|
-
#0096D8
|
30
|
-
#009917
|
31
|
-
#00B4AB
|
32
|
-
#00a6a6
|
33
|
-
#00cafe
|
34
|
-
#012456
|
35
|
-
#0298c3
|
36
|
-
#02f88c
|
37
|
-
#04133b
|
38
|
-
#0579aa
|
39
|
-
#078193
|
40
|
-
#0aa0ff
|
41
|
-
#0db7ed
|
42
|
-
#0e60e3
|
43
|
-
#101F1F
|
44
|
-
#118f9e
|
45
|
-
#120F14
|
46
|
-
#14253c
|
47
|
-
#178600
|
48
|
-
#185619
|
49
|
-
#198CE7
|
50
|
-
#199f4b
|
51
|
-
#1C3552
|
52
|
-
#1D222D
|
53
|
-
#1F1F1F
|
54
|
-
#1ac620
|
55
|
-
#1e4aec
|
56
|
-
#22228f
|
57
|
-
#244776
|
58
|
-
#28431f
|
59
|
-
#2ACCA8
|
60
|
-
#2F2530
|
61
|
-
#2b7489
|
62
|
-
#2c3e50
|
63
|
-
#302B6D
|
64
|
-
#315665
|
65
|
-
#341708
|
66
|
-
#348a34
|
67
|
-
#3572A5
|
68
|
-
#358a5b
|
69
|
-
#375eab
|
70
|
-
#37775b
|
71
|
-
#3A4E3A
|
72
|
-
#3D6117
|
73
|
-
#3F3F3F
|
74
|
-
#3F85AF
|
75
|
-
#3ac486
|
76
|
-
#3be133
|
77
|
-
#3d3c6e
|
78
|
-
#3d9970
|
79
|
-
#3fb68b
|
80
|
-
#403a40
|
81
|
-
#40d47e
|
82
|
-
#427819
|
83
|
-
#42f1f4
|
84
|
-
#438eff
|
85
|
-
#447265
|
86
|
-
#44a51c
|
87
|
-
#46390b
|
88
|
-
#499886
|
89
|
-
#4A76B8
|
90
|
-
#4B6BEF
|
91
|
-
#4B6C4B
|
92
|
-
#4C3023
|
93
|
-
#4F5D95
|
94
|
-
#4d41b1
|
95
|
-
#5232e7
|
96
|
-
#555555
|
97
|
-
#563d7c
|
98
|
-
#596706
|
99
|
-
#5A8164
|
100
|
-
#5B2063
|
101
|
-
#5a6986
|
102
|
-
#5c7611
|
103
|
-
#5e5086
|
104
|
-
#60B5CC
|
105
|
-
#62A8D6
|
106
|
-
#636746
|
107
|
-
#646464
|
108
|
-
#64C800
|
109
|
-
#64b970
|
110
|
-
#652B81
|
111
|
-
#6594b9
|
112
|
-
#6600cc
|
113
|
-
#665a4e
|
114
|
-
#6866fb
|
115
|
-
#6E4C13
|
116
|
-
#6a40fd
|
117
|
-
#6c616e
|
118
|
-
#6e4a7e
|
119
|
-
#701516
|
120
|
-
#7055b5
|
121
|
-
#74283c
|
122
|
-
#747faa
|
123
|
-
#7582D1
|
124
|
-
#776791
|
125
|
-
#7790B2
|
126
|
-
#77d9fb
|
127
|
-
#79aa7a
|
128
|
-
#7b9db4
|
129
|
-
#7e7eff
|
130
|
-
#7fa2a7
|
131
|
-
#800000
|
132
|
-
#814CCC
|
133
|
-
#82937f
|
134
|
-
#843179
|
135
|
-
#878787
|
136
|
-
#87AED7
|
137
|
-
#882B0F
|
138
|
-
#88562A
|
139
|
-
#88ccff
|
140
|
-
#89e051
|
141
|
-
#8a1267
|
142
|
-
#8dc63f
|
143
|
-
#8f0f8d
|
144
|
-
#8f14e9
|
145
|
-
#8fb200
|
146
|
-
#913960
|
147
|
-
#945db7
|
148
|
-
#946d57
|
149
|
-
#94B0C7
|
150
|
-
#990000
|
151
|
-
#999999
|
152
|
-
#99DA07
|
153
|
-
#9DC3FF
|
154
|
-
#9EEDFF
|
155
|
-
#9d5200
|
156
|
-
#A0AA87
|
157
|
-
#AA6746
|
158
|
-
#B0CE4E
|
159
|
-
#B34936
|
160
|
-
#B5314C
|
161
|
-
#B83998
|
162
|
-
#B9D9FF
|
163
|
-
#C1F12E
|
164
|
-
#C76F5B
|
165
|
-
#C7D7DC
|
166
|
-
#DA5B0B
|
167
|
-
#DAE1C2
|
168
|
-
#DBCA00
|
169
|
-
#E3F171
|
170
|
-
#E4E6F3
|
171
|
-
#E6EFBB
|
172
|
-
#E8274B
|
173
|
-
#EB8CEB
|
174
|
-
#F18E33
|
175
|
-
#FEFE00
|
176
|
-
#FF5000
|
177
|
-
#FFF4F3
|
178
|
-
#a270ba
|
179
|
-
#a3522f
|
180
|
-
#a54c4d
|
181
|
-
#a78649
|
182
|
-
#a9188d
|
183
|
-
#a957b0
|
184
|
-
#aa2afe
|
185
|
-
#adb2cb
|
186
|
-
#b07219
|
187
|
-
#b0b77e
|
188
|
-
#b2011d
|
189
|
-
#b2b7f8
|
190
|
-
#b30000
|
191
|
-
#b7e1f4
|
192
|
-
#b845fc
|
193
|
-
#ba595e
|
194
|
-
#c065db
|
195
|
-
#c22d40
|
196
|
-
#c4a79c
|
197
|
-
#c7a938
|
198
|
-
#c9df40
|
199
|
-
#cabbff
|
200
|
-
#cc0000
|
201
|
-
#cc0088
|
202
|
-
#cc9900
|
203
|
-
#cca760
|
204
|
-
#ccccff
|
205
|
-
#ccce35
|
206
|
-
#cd6400
|
207
|
-
#cdd0e3
|
208
|
-
#cf142b
|
209
|
-
#d4bec1
|
210
|
-
#d80074
|
211
|
-
#da291c
|
212
|
-
#dad8d8
|
213
|
-
#db5855
|
214
|
-
#db901e
|
215
|
-
#dbb284
|
216
|
-
#dc566d
|
217
|
-
#dce200
|
218
|
-
#dea584
|
219
|
-
#df7900
|
220
|
-
#dfa535
|
221
|
-
#e16737
|
222
|
-
#e34c26
|
223
|
-
#e4cc98
|
224
|
-
#e69f56
|
225
|
-
#ecdebe
|
226
|
-
#ed2cd6
|
227
|
-
#f0a9f0
|
228
|
-
#f1e05a
|
229
|
-
#f34b7d
|
230
|
-
#f3ca0a
|
231
|
-
#f50000
|
232
|
-
#f7ede0
|
233
|
-
#f97732
|
234
|
-
#fab738
|
235
|
-
#fb855d
|
236
|
-
#fbe5cd
|
237
|
-
#fcd7de
|
238
|
-
#ff0c5a
|
239
|
-
#ff2b2b
|
240
|
-
#ff6375
|
241
|
-
#ff7f7f
|
242
|
-
#ffac45
|
243
|
-
#fffaa0
|
244
|
-
)
|
245
18
|
end
|
data/lib/provider/ec2.rb
CHANGED
@@ -1,21 +1,25 @@
|
|
1
|
-
require 'aws
|
1
|
+
require 'fog/aws'
|
2
2
|
|
3
3
|
class Ec2Provider
|
4
4
|
|
5
5
|
def initialize(options)
|
6
6
|
@options = options
|
7
7
|
conn_opts = {
|
8
|
-
region: options[:region]
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
region: options[:region]
|
9
|
+
}
|
10
|
+
|
11
|
+
conn_opts[:aws_access_key_id] = options[:access_key]
|
12
|
+
conn_opts[:aws_secret_access_key] = options[:secret_key]
|
13
|
+
|
14
|
+
if options[:session_token]
|
15
|
+
conn_opts[:aws_session_token] = options[:session_token]
|
16
|
+
end
|
13
17
|
|
14
|
-
@
|
18
|
+
@compute = Fog::Compute::AWS.new conn_opts
|
15
19
|
end
|
16
20
|
|
17
21
|
def security_groups
|
18
|
-
@
|
22
|
+
@compute.security_groups.reject { |sg|
|
19
23
|
@options[:vpc_id] && sg.vpc_id != @options[:vpc_id]
|
20
24
|
}.collect { |sg|
|
21
25
|
Ec2::SecurityGroup.new(sg)
|
@@ -31,10 +35,6 @@ module Ec2
|
|
31
35
|
@sg = sg
|
32
36
|
end
|
33
37
|
|
34
|
-
def name
|
35
|
-
@sg.group_name
|
36
|
-
end
|
37
|
-
|
38
38
|
def ip_permissions
|
39
39
|
@sg.ip_permissions.collect { |ip|
|
40
40
|
Ec2::IpPermission.new(ip)
|
@@ -54,25 +54,25 @@ module Ec2
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def protocol
|
57
|
-
@ip['
|
57
|
+
@ip['ipProtocol']
|
58
58
|
end
|
59
59
|
|
60
60
|
def from
|
61
|
-
@ip['
|
61
|
+
@ip['fromPort']
|
62
62
|
end
|
63
63
|
|
64
64
|
def to
|
65
|
-
@ip['
|
65
|
+
@ip['toPort']
|
66
66
|
end
|
67
67
|
|
68
68
|
def ip_ranges
|
69
|
-
@ip['
|
69
|
+
@ip['ipRanges'].collect {|gp|
|
70
70
|
Ec2::IpPermissionRange.new(gp)
|
71
71
|
}
|
72
72
|
end
|
73
73
|
|
74
74
|
def groups
|
75
|
-
@ip['
|
75
|
+
@ip['groups'].collect {|gp|
|
76
76
|
Ec2::IpPermissionGroup.new(gp)
|
77
77
|
}
|
78
78
|
end
|
@@ -84,7 +84,7 @@ module Ec2
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def cidr_ip
|
87
|
-
@range['
|
87
|
+
@range['cidrIp']
|
88
88
|
end
|
89
89
|
|
90
90
|
def to_str
|
@@ -98,7 +98,7 @@ module Ec2
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def name
|
101
|
-
@gp['
|
101
|
+
@gp['groupName'] || @gp['groupId']
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
data/spec/spec_helper.rb
CHANGED
@@ -7,23 +7,18 @@ require File.expand_path(File.dirname(__FILE__) + "/../config/boot")
|
|
7
7
|
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}
|
8
8
|
|
9
9
|
def group name, *ingress
|
10
|
-
|
10
|
+
group = double("Group")
|
11
|
+
allow(group).to receive(:ip_permissions).and_return(ingress)
|
12
|
+
allow(group).to receive(:ip_permissions_egress).and_return([])
|
13
|
+
allow(group).to receive(:name).and_return(name)
|
14
|
+
allow(group).to receive(:group_id).and_return('some group')
|
15
|
+
group
|
11
16
|
end
|
12
17
|
|
13
18
|
def group_ingress port, name
|
14
|
-
{
|
19
|
+
{"groups"=>[{"userId"=>"userId", "groupId"=>"sg-groupId", "groupName"=>name}], "ipRanges"=>[], "ipProtocol"=>"tcp", "fromPort"=>port, "toPort"=>port}
|
15
20
|
end
|
16
21
|
|
17
22
|
def cidr_ingress port, cidr_ip
|
18
|
-
{
|
23
|
+
{"groups"=>[], "ipRanges"=>[{"cidrIp"=> cidr_ip}], "ipProtocol"=>"tcp", "fromPort"=>port, "toPort"=>port}
|
19
24
|
end
|
20
|
-
|
21
|
-
def stub_security_groups groups
|
22
|
-
Aws.config[:ec2] = {
|
23
|
-
stub_responses: {
|
24
|
-
describe_security_groups: {
|
25
|
-
security_groups: groups
|
26
|
-
}
|
27
|
-
}
|
28
|
-
}
|
29
|
-
end
|
data/spec/visualize_aws_spec.rb
CHANGED
@@ -17,11 +17,16 @@ class DummyRenderer
|
|
17
17
|
end
|
18
18
|
|
19
19
|
describe VisualizeAws do
|
20
|
+
before do
|
21
|
+
@ec2 = double(Fog::Compute)
|
22
|
+
allow(Fog::Compute::AWS).to receive(:new).and_return(@ec2)
|
23
|
+
end
|
24
|
+
|
20
25
|
let(:visualize_aws) { VisualizeAws.new(AwsConfig.new) }
|
21
26
|
let(:renderer) { DummyRenderer.new }
|
22
27
|
|
23
|
-
it 'should add nodes, edges for each security group' do
|
24
|
-
|
28
|
+
it 'should add nodes, edges for each security group' do
|
29
|
+
expect(@ec2).to receive(:security_groups).and_return([group('Remote ssh', group_ingress('22', 'My machine')), group('My machine')])
|
25
30
|
graph = visualize_aws.build
|
26
31
|
|
27
32
|
expect(graph.output(renderer)).to contain_exactly(
|
@@ -33,7 +38,7 @@ describe VisualizeAws do
|
|
33
38
|
|
34
39
|
context 'groups' do
|
35
40
|
it 'should add nodes for external security groups defined through ingress' do
|
36
|
-
|
41
|
+
expect(@ec2).to receive(:security_groups).and_return([group('Web', group_ingress('80', 'ELB'))])
|
37
42
|
graph = visualize_aws.build
|
38
43
|
|
39
44
|
expect(graph.output(renderer)).to contain_exactly(
|
@@ -44,11 +49,11 @@ describe VisualizeAws do
|
|
44
49
|
end
|
45
50
|
|
46
51
|
it 'should add an edge for each security ingress' do
|
47
|
-
|
52
|
+
expect(@ec2).to receive(:security_groups).and_return(
|
48
53
|
[
|
49
|
-
group('App', group_ingress(80, 'Web'), group_ingress(8983, 'Internal')),
|
50
|
-
group('Web', group_ingress(80, 'External')),
|
51
|
-
group('Db', group_ingress(7474, 'App'))
|
54
|
+
group('App', group_ingress('80', 'Web'), group_ingress('8983', 'Internal')),
|
55
|
+
group('Web', group_ingress('80', 'External')),
|
56
|
+
group('Db', group_ingress('7474', 'App'))
|
52
57
|
])
|
53
58
|
graph = visualize_aws.build
|
54
59
|
|
@@ -70,10 +75,10 @@ describe VisualizeAws do
|
|
70
75
|
context 'cidr' do
|
71
76
|
|
72
77
|
it 'should add an edge for each cidr ingress' do
|
73
|
-
|
78
|
+
expect(@ec2).to receive(:security_groups).and_return(
|
74
79
|
[
|
75
|
-
group('Web', group_ingress(80, 'External')),
|
76
|
-
group('Db', group_ingress(7474, 'App'), cidr_ingress(22, '127.0.0.1/32'))
|
80
|
+
group('Web', group_ingress('80', 'External')),
|
81
|
+
group('Db', group_ingress('7474', 'App'), cidr_ingress('22', '127.0.0.1/32'))
|
77
82
|
])
|
78
83
|
graph = visualize_aws.build
|
79
84
|
|
@@ -91,10 +96,10 @@ describe VisualizeAws do
|
|
91
96
|
end
|
92
97
|
|
93
98
|
it 'should add map edges for cidr ingress' do
|
94
|
-
|
99
|
+
expect(@ec2).to receive(:security_groups).and_return(
|
95
100
|
[
|
96
|
-
group('Web', group_ingress(80, 'External')),
|
97
|
-
group('Db', group_ingress(7474, 'App'), cidr_ingress(22, '127.0.0.1/32'))
|
101
|
+
group('Web', group_ingress('80', 'External')),
|
102
|
+
group('Db', group_ingress('7474', 'App'), cidr_ingress('22', '127.0.0.1/32'))
|
98
103
|
])
|
99
104
|
mapping = {'127.0.0.1/32' => 'Work'}
|
100
105
|
mapping = CidrGroupMapping.new([], mapping)
|
@@ -116,9 +121,9 @@ describe VisualizeAws do
|
|
116
121
|
end
|
117
122
|
|
118
123
|
it 'should group mapped duplicate edges for cidr ingress' do
|
119
|
-
|
124
|
+
expect(@ec2).to receive(:security_groups).and_return(
|
120
125
|
[
|
121
|
-
group('ssh', cidr_ingress(22, '192.168.0.1/32'), cidr_ingress(22, '127.0.0.1/32'))
|
126
|
+
group('ssh', cidr_ingress('22', '192.168.0.1/32'), cidr_ingress('22', '127.0.0.1/32'))
|
122
127
|
])
|
123
128
|
mapping = {'127.0.0.1/32' => 'Work', '192.168.0.1/32' => 'Work'}
|
124
129
|
mapping = CidrGroupMapping.new([], mapping)
|
@@ -136,10 +141,10 @@ describe VisualizeAws do
|
|
136
141
|
|
137
142
|
context "filter" do
|
138
143
|
it 'include cidr which do not match the pattern' do
|
139
|
-
|
144
|
+
expect(@ec2).to receive(:security_groups).and_return(
|
140
145
|
[
|
141
|
-
group('Web', cidr_ingress(22, '127.0.0.1/32')),
|
142
|
-
group('Db', cidr_ingress(22, '192.0.1.1/32'))
|
146
|
+
group('Web', cidr_ingress('22', '127.0.0.1/32')),
|
147
|
+
group('Db', cidr_ingress('22', '192.0.1.1/32'))
|
143
148
|
])
|
144
149
|
|
145
150
|
opts = {:exclude => ['127.*']}
|
@@ -154,10 +159,10 @@ describe VisualizeAws do
|
|
154
159
|
end
|
155
160
|
|
156
161
|
it 'include groups which do not match the pattern' do
|
157
|
-
|
162
|
+
expect(@ec2).to receive(:security_groups).and_return(
|
158
163
|
[
|
159
|
-
group('Web', group_ingress(80, 'External')),
|
160
|
-
group('Db', group_ingress(7474, 'App'), cidr_ingress(22, '127.0.0.1/32'))
|
164
|
+
group('Web', group_ingress('80', 'External')),
|
165
|
+
group('Db', group_ingress('7474', 'App'), cidr_ingress('22', '127.0.0.1/32'))
|
161
166
|
])
|
162
167
|
|
163
168
|
opts = {:exclude => ['D.*b', 'App']}
|
@@ -171,10 +176,10 @@ describe VisualizeAws do
|
|
171
176
|
end
|
172
177
|
|
173
178
|
it 'include derived groups which do not match the pattern' do
|
174
|
-
|
179
|
+
expect(@ec2).to receive(:security_groups).and_return(
|
175
180
|
[
|
176
|
-
group('Web', group_ingress(80, 'External')),
|
177
|
-
group('Db', group_ingress(7474, 'App'), cidr_ingress(22, '127.0.0.1/32'))
|
181
|
+
group('Web', group_ingress('80', 'External')),
|
182
|
+
group('Db', group_ingress('7474', 'App'), cidr_ingress('22', '127.0.0.1/32'))
|
178
183
|
])
|
179
184
|
|
180
185
|
opts = {:exclude => ['App']}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws_security_viz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.5
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anay Nayak
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,74 +16,128 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '1.15'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '1.15'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 12.0.0
|
34
31
|
- - "~>"
|
35
32
|
- !ruby/object:Gem::Version
|
36
33
|
version: '12.0'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 12.0.0
|
37
37
|
type: :development
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
|
-
- - ">="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: 12.0.0
|
44
41
|
- - "~>"
|
45
42
|
- !ruby/object:Gem::Version
|
46
43
|
version: '12.0'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 12.0.0
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - ">="
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 3.5.0
|
54
51
|
- - "~>"
|
55
52
|
- !ruby/object:Gem::Version
|
56
53
|
version: '3.5'
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 3.5.0
|
57
57
|
type: :development
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- - ">="
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: 3.5.0
|
64
61
|
- - "~>"
|
65
62
|
- !ruby/object:Gem::Version
|
66
63
|
version: '3.5'
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 3.5.0
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: graphviz
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
|
+
- - "~>"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '1.1'
|
71
74
|
- - ">="
|
72
75
|
- !ruby/object:Gem::Version
|
73
76
|
version: 1.1.0
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
74
81
|
- - "~>"
|
75
82
|
- !ruby/object:Gem::Version
|
76
83
|
version: '1.1'
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 1.1.0
|
87
|
+
- !ruby/object:Gem::Dependency
|
88
|
+
name: fog-aws
|
89
|
+
requirement: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - "~>"
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '2.0'
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 2.0.1
|
77
97
|
type: :runtime
|
78
98
|
prerelease: false
|
79
99
|
version_requirements: !ruby/object:Gem::Requirement
|
80
100
|
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '2.0'
|
81
104
|
- - ">="
|
82
105
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
106
|
+
version: 2.0.1
|
107
|
+
- !ruby/object:Gem::Dependency
|
108
|
+
name: unf
|
109
|
+
requirement: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
84
111
|
- - "~>"
|
85
112
|
- !ruby/object:Gem::Version
|
86
|
-
version:
|
113
|
+
version: 0.1.4
|
114
|
+
type: :runtime
|
115
|
+
prerelease: false
|
116
|
+
version_requirements: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - "~>"
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: 0.1.4
|
121
|
+
- !ruby/object:Gem::Dependency
|
122
|
+
name: json
|
123
|
+
requirement: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - "~>"
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '2.1'
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: 2.1.0
|
131
|
+
type: :runtime
|
132
|
+
prerelease: false
|
133
|
+
version_requirements: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - "~>"
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '2.1'
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: 2.1.0
|
87
141
|
- !ruby/object:Gem::Dependency
|
88
142
|
name: optimist
|
89
143
|
requirement: !ruby/object:Gem::Requirement
|
@@ -132,20 +186,6 @@ dependencies:
|
|
132
186
|
- - "~>"
|
133
187
|
- !ruby/object:Gem::Version
|
134
188
|
version: 0.5.3
|
135
|
-
- !ruby/object:Gem::Dependency
|
136
|
-
name: aws-sdk-ec2
|
137
|
-
requirement: !ruby/object:Gem::Requirement
|
138
|
-
requirements:
|
139
|
-
- - "~>"
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
version: 1.65.0
|
142
|
-
type: :runtime
|
143
|
-
prerelease: false
|
144
|
-
version_requirements: !ruby/object:Gem::Requirement
|
145
|
-
requirements:
|
146
|
-
- - "~>"
|
147
|
-
- !ruby/object:Gem::Version
|
148
|
-
version: 1.65.0
|
149
189
|
description: Provides a quick mechanism to visualize your EC2 security groups in multiple
|
150
190
|
formats
|
151
191
|
email: anayak007+rubygems@gmail.com
|
@@ -158,7 +198,6 @@ files:
|
|
158
198
|
- ".travis.yml"
|
159
199
|
- CHANGELOG.md
|
160
200
|
- CODE_OF_CONDUCT.md
|
161
|
-
- Dockerfile
|
162
201
|
- Gemfile
|
163
202
|
- LICENSE.md
|
164
203
|
- README.md
|
@@ -186,7 +225,6 @@ files:
|
|
186
225
|
- lib/renderer/graphviz.rb
|
187
226
|
- lib/renderer/json.rb
|
188
227
|
- lib/version.rb
|
189
|
-
- spec/color_picker_spec.rb
|
190
228
|
- spec/graph_filter_spec.rb
|
191
229
|
- spec/integration/aws_expected.json
|
192
230
|
- spec/integration/dummy.dot
|
@@ -210,16 +248,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
210
248
|
version: 2.0.0
|
211
249
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
250
|
requirements:
|
213
|
-
- - "
|
251
|
+
- - ">="
|
214
252
|
- !ruby/object:Gem::Version
|
215
|
-
version:
|
253
|
+
version: '0'
|
216
254
|
requirements: []
|
217
|
-
|
255
|
+
rubyforge_project:
|
256
|
+
rubygems_version: 2.5.2.3
|
218
257
|
signing_key:
|
219
258
|
specification_version: 4
|
220
259
|
summary: Visualize your aws security groups
|
221
260
|
test_files:
|
222
|
-
- spec/color_picker_spec.rb
|
223
261
|
- spec/graph_filter_spec.rb
|
224
262
|
- spec/integration/aws_expected.json
|
225
263
|
- spec/integration/dummy.dot
|
data/Dockerfile
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
FROM ubuntu:latest
|
2
|
-
RUN apt-get update
|
3
|
-
# RUN gem install aws_security_viz # use bundler instead because nokogiri makes problems
|
4
|
-
RUN apt-get install -y git ruby-dev ruby graphviz libxml2-dev g++ zlib1g-dev python
|
5
|
-
RUN git clone https://github.com/anaynayak/aws-security-viz.git
|
6
|
-
WORKDIR /aws-security-viz
|
7
|
-
RUN gem install bundler --no-document
|
8
|
-
RUN bundle install
|
9
|
-
ENTRYPOINT ["/bin/sh"]
|
data/spec/color_picker_spec.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe ColorPicker do
|
4
|
-
context 'default picker' do
|
5
|
-
let(:picker) { ColorPicker.new(false) }
|
6
|
-
|
7
|
-
it 'should add default colors for edges' do
|
8
|
-
expect(picker.color(0, true)).to eq(:blue)
|
9
|
-
expect(picker.color(0, false)).to eq(:red)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
context 'color picker' do
|
13
|
-
let(:picker) { ColorPicker.new(true) }
|
14
|
-
|
15
|
-
it 'should add default colors for edges' do
|
16
|
-
expect(picker.color(0, 'ignore')).to eq('#00004c')
|
17
|
-
expect(picker.color(10000, 'ignore')).to eq('#C76F5B')
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|