iptables-web 0.2.2.pre → 0.2.2.pre2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/iptables-web +2 -3
- data/lib/iptables_web/configuration.rb +9 -4
- data/lib/iptables_web/iptables.rb +7 -6
- data/lib/iptables_web/version.rb +1 -1
- metadata +14 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee89cd5a890a8e586e177f8027ed8af3bfbd0193
|
4
|
+
data.tar.gz: 8ea6fc5dccb2f42da7e830f0614a4a5a9d19c530
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 651f82ae7d49552941459d554209611426c96043633037a86e13575d0dbf6f21eacaec9b40eb7ddd0064021d37275042a9ee75974fdcb3eed60151acb82b4e3d
|
7
|
+
data.tar.gz: 5123f6eba6ec4c1a17fcba242b81b0e50f4e06261e493f25049c2de968e98aa3d330ef473ef87ed8a8e703a523659fbe473bd7c0be1aac2337a59fec352ab05a
|
data/bin/iptables-web
CHANGED
@@ -78,8 +78,7 @@ command :update do |c|
|
|
78
78
|
c.option '--print', 'Show rules without restoring'
|
79
79
|
c.action do |_, options|
|
80
80
|
IptablesWeb.configuration.load(options.config) if options.config
|
81
|
-
|
82
|
-
# IptablesWeb::Model::Node.handshake do
|
81
|
+
IptablesWeb::Model::Node.handshake do
|
83
82
|
rules = IptablesWeb::Model::AccessRule.all
|
84
83
|
iptables = IptablesWeb::Iptables.new
|
85
84
|
if options.print
|
@@ -87,6 +86,6 @@ command :update do |c|
|
|
87
86
|
else
|
88
87
|
iptables.restore(rules)
|
89
88
|
end
|
90
|
-
|
89
|
+
end
|
91
90
|
end
|
92
91
|
end
|
@@ -23,10 +23,15 @@ module IptablesWeb
|
|
23
23
|
rules = STATIC_RULES_FILES.map do |file|
|
24
24
|
File.exist?(file) ? File.read(file) : nil
|
25
25
|
end.compact.join("\n").strip
|
26
|
-
rules.scan(/\*([a-z]+)(.*?)COMMIT/m)
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
chains = rules.scan(/\*([a-z]+)(.*?)COMMIT/m)
|
27
|
+
if chains && chains.size > 0
|
28
|
+
chains.each_with_object({}) do |r, obj|
|
29
|
+
chain = r[0]
|
30
|
+
obj[chain] ||= []
|
31
|
+
obj[chain] = obj[chain] | r[1].split("\n")
|
32
|
+
end
|
33
|
+
else
|
34
|
+
{ 'filter' => rules.split("\n") }
|
30
35
|
end
|
31
36
|
end
|
32
37
|
|
@@ -25,20 +25,21 @@ module IptablesWeb
|
|
25
25
|
|
26
26
|
def render(rules)
|
27
27
|
static_rules = self.static_rules
|
28
|
+
static_filter = static_rules.delete('filter')
|
28
29
|
lines = []
|
29
30
|
lines << '*filter'
|
30
31
|
lines << ':INPUT DROP [0:0]'
|
31
32
|
lines << ':FORWARD ACCEPT [0:0]'
|
32
33
|
lines << ':OUTPUT ACCEPT [0:0]'
|
33
|
-
lines <<
|
34
|
-
lines << Array(rules).map(&:to_s).join("\n")
|
35
|
-
lines <<
|
34
|
+
lines << static_filter.strip if static_filter
|
35
|
+
lines << Array(rules).map(&:to_s).join("\n").strip
|
36
|
+
lines << "COMMIT\n"
|
36
37
|
static_rules.each do |chain, sub_rules|
|
37
38
|
lines << "*#{chain}"
|
38
|
-
lines << sub_rules.join("\n")
|
39
|
-
lines <<
|
39
|
+
lines << sub_rules.join("\n").strip
|
40
|
+
lines << "COMMIT\n"
|
40
41
|
end
|
41
|
-
lines.join("\n")
|
42
|
+
lines.join("\n")
|
42
43
|
end
|
43
44
|
end
|
44
45
|
end
|
data/lib/iptables_web/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iptables-web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.2.
|
4
|
+
version: 0.2.2.pre2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NikolayMurga
|
@@ -29,6 +29,9 @@ dependencies:
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '4.0'
|
34
|
+
- - '>='
|
32
35
|
- !ruby/object:Gem::Version
|
33
36
|
version: 4.0.0
|
34
37
|
type: :runtime
|
@@ -36,6 +39,9 @@ dependencies:
|
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
41
|
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '4.0'
|
44
|
+
- - '>='
|
39
45
|
- !ruby/object:Gem::Version
|
40
46
|
version: 4.0.0
|
41
47
|
- !ruby/object:Gem::Dependency
|
@@ -43,6 +49,9 @@ dependencies:
|
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
51
|
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '4.0'
|
54
|
+
- - '>='
|
46
55
|
- !ruby/object:Gem::Version
|
47
56
|
version: 4.0.0
|
48
57
|
type: :runtime
|
@@ -50,6 +59,9 @@ dependencies:
|
|
50
59
|
version_requirements: !ruby/object:Gem::Requirement
|
51
60
|
requirements:
|
52
61
|
- - ~>
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '4.0'
|
64
|
+
- - '>='
|
53
65
|
- !ruby/object:Gem::Version
|
54
66
|
version: 4.0.0
|
55
67
|
- !ruby/object:Gem::Dependency
|
@@ -100,7 +112,7 @@ files:
|
|
100
112
|
- lib/iptables_web/model/base.rb
|
101
113
|
- lib/iptables_web/model/node.rb
|
102
114
|
- lib/iptables_web/version.rb
|
103
|
-
homepage:
|
115
|
+
homepage: https://github.com/MurgaNikolay/iptables-web-client
|
104
116
|
licenses:
|
105
117
|
- MIT
|
106
118
|
metadata: {}
|