stem 0.8.3 → 0.8.4
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.
- data/lib/stem/group.rb +5 -3
- metadata +2 -2
data/lib/stem/group.rb
CHANGED
@@ -6,6 +6,7 @@ module Stem
|
|
6
6
|
## Example Rules
|
7
7
|
|
8
8
|
## icmp://1.2.3.4/32
|
9
|
+
## icmp://1.2.3.4/32:8-0
|
9
10
|
## icmp://GroupName
|
10
11
|
## icmp://GroupName@UserId
|
11
12
|
## icmp://@UserId
|
@@ -117,10 +118,11 @@ module Stem
|
|
117
118
|
end
|
118
119
|
|
119
120
|
def gen_authorize(index, rule)
|
120
|
-
if rule =~ /icmp:\/\/(
|
121
|
-
{ "IpPermissions.#{index}.IpProtocol" => "icmp",
|
121
|
+
if rule =~ /icmp:\/\/([^:]+)(?::(.*))?/
|
122
|
+
auth = { "IpPermissions.#{index}.IpProtocol" => "icmp",
|
122
123
|
"IpPermissions.#{index}.FromPort" => "-1",
|
123
124
|
"IpPermissions.#{index}.ToPort" => "-1" }.merge(gen_authorize_target(index,$1))
|
125
|
+
$2 ? auth.merge(gen_authorize_ports(index, $2)) : auth
|
124
126
|
elsif rule =~ /(tcp|udp):\/\/(.*):(.*)/
|
125
127
|
{ "IpPermissions.#{index}.IpProtocol" => $1 }.merge(gen_authorize_target(index,$2)).merge(gen_authorize_ports(index,$3))
|
126
128
|
else
|
@@ -129,7 +131,7 @@ module Stem
|
|
129
131
|
end
|
130
132
|
|
131
133
|
def parse_rule_ports(rule)
|
132
|
-
if rule['ipProtocol'] == 'icmp'
|
134
|
+
if rule['ipProtocol'] == 'icmp' && rule['fromPort'] == '-1' && rule['toPort'] == '-1'
|
133
135
|
""
|
134
136
|
elsif rule['fromPort'] == '0' && rule['toPort'] == '65535'
|
135
137
|
":"
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: stem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.8.
|
5
|
+
version: 0.8.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Peter van Hardenberg
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2011-
|
15
|
+
date: 2011-06-30 00:00:00 -07:00
|
16
16
|
default_executable:
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|