awspec 0.16.0 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/awspec/generator/spec/security_group.rb +7 -1
- data/lib/awspec/stub/security_group.rb +11 -0
- data/lib/awspec/type/security_group.rb +14 -2
- data/lib/awspec/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 079365d4a013ed8f6ef32f280e5698831094b170
|
4
|
+
data.tar.gz: f6bf2551315170c4d5fe7fe4823387067ac60c50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6237ae37aa33e1decc7ff2fe2ddb1cb86ed3ade49d9f158a6609e7ffd23740057af858c8fc88d0d2ccff9c0f4164edeba650dd5bf14dee9a4649c8b33c244f4
|
7
|
+
data.tar.gz: 6cba16c1621ba3617c6280cfbc6d00322efbb5b6667c1d5a594b93795ed09831b544db40085c10bf183ab8ea10912f9d1a670ebbff2731745f5ae02023ee6993
|
@@ -28,7 +28,13 @@ module Awspec::Generator
|
|
28
28
|
linespecs.push('its(:' + inout + ') { should be_opened }')
|
29
29
|
next
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
|
+
if permission.from_port == permission.to_port
|
33
|
+
port = permission.from_port
|
34
|
+
else
|
35
|
+
port = "'" + permission.from_port.to_s + '-' + permission.to_port.to_s + "'"
|
36
|
+
end
|
37
|
+
|
32
38
|
protocol = permission.ip_protocol
|
33
39
|
permission.ip_ranges.each do |ip_range|
|
34
40
|
target = ip_range.cidr_ip
|
@@ -32,6 +32,17 @@ Aws.config[:ec2] = {
|
|
32
32
|
group_name: 'group-name-sg'
|
33
33
|
}
|
34
34
|
]
|
35
|
+
},
|
36
|
+
{
|
37
|
+
from_port: 50_000,
|
38
|
+
to_port: 50_009,
|
39
|
+
ip_protocol: 'tcp',
|
40
|
+
ip_ranges: [
|
41
|
+
{
|
42
|
+
cidr_ip: '123.456.789.012/32'
|
43
|
+
}
|
44
|
+
],
|
45
|
+
user_id_group_pairs: []
|
35
46
|
}
|
36
47
|
],
|
37
48
|
ip_permissions_egress: [
|
@@ -23,7 +23,7 @@ module Awspec::Type
|
|
23
23
|
next true unless port
|
24
24
|
next true unless permission[:from_port]
|
25
25
|
next true unless permission[:to_port]
|
26
|
-
next false unless
|
26
|
+
next false unless port_between?(port, permission[:from_port], permission[:to_port])
|
27
27
|
next false if protocol && permission[:ip_protocol] != protocol
|
28
28
|
next true unless cidr
|
29
29
|
ret = permission[:ip_ranges].select do |ip_range|
|
@@ -47,7 +47,7 @@ module Awspec::Type
|
|
47
47
|
next true unless port
|
48
48
|
next true unless permission[:from_port]
|
49
49
|
next true unless permission[:to_port]
|
50
|
-
next false unless
|
50
|
+
next false unless port_between?(port, permission[:from_port], permission[:to_port])
|
51
51
|
next false if protocol && permission[:ip_protocol] != protocol
|
52
52
|
next true unless cidr
|
53
53
|
ret = permission[:ip_ranges].select do |ip_range|
|
@@ -85,5 +85,17 @@ module Awspec::Type
|
|
85
85
|
@resource[:ip_permissions_egress].count
|
86
86
|
end
|
87
87
|
alias_method :outbound_permissions_count, :ip_permissions_egress_count
|
88
|
+
|
89
|
+
private
|
90
|
+
|
91
|
+
def port_between?(port, from_port, to_port)
|
92
|
+
if port.is_a?(String) && port.include?('-')
|
93
|
+
f, t = port.split('-')
|
94
|
+
false unless from_port == f.to_i && to_port == t.to_i
|
95
|
+
else
|
96
|
+
false unless port.between?(from_port, to_port)
|
97
|
+
end
|
98
|
+
true
|
99
|
+
end
|
88
100
|
end
|
89
101
|
end
|
data/lib/awspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- k1LoW
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|