Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
awall
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
7
Issues
7
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpine
awall
Commits
da7f4cb2
Commit
da7f4cb2
authored
Jul 13, 2012
by
Kaarle Ritvanen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dump level 4 prints generated files
parent
caa5010a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
5 deletions
+27
-5
awall-cli
awall-cli
+7
-3
awall/init.lua
awall/init.lua
+6
-0
awall/ipset.lua
awall/ipset.lua
+7
-2
awall/iptables.lua
awall/iptables.lua
+7
-0
No files found.
awall-cli
View file @
da7f4cb2
...
...
@@ -60,7 +60,7 @@ List optional policies:
Dump variable and zone definitions:
awall dump [level]
Verbosity level is an integer in range 0-
3
and defaults to 0.
Verbosity level is an integer in range 0-
4
and defaults to 0.
]]
)
os.exit
()
...
...
@@ -170,7 +170,7 @@ if mode == 'dump' then
end
end
os.exit
()
if
level
<
4
then
os.exit
()
end
end
...
...
@@ -179,7 +179,11 @@ awall.loadmodules(basedir)
config
=
awall
.
Config
.
new
(
config
)
if
mode
==
'translate'
then
if
mode
==
'dump'
then
config
:
print
()
elseif
mode
==
'translate'
then
if
verify
then
config
:
test
()
end
config
:
dump
(
iptdir
,
ipsfile
)
...
...
awall/init.lua
View file @
da7f4cb2
...
...
@@ -111,6 +111,12 @@ function Config:init(policyconfig)
self
.
ipset
=
ipset
.
IPSet
.
new
(
self
.
input
.
ipset
)
end
function
Config
:
print
()
self
.
ipset
:
print
()
print
()
self
.
iptables
:
print
()
end
function
Config
:
dump
(
iptdir
,
ipsfile
)
self
.
ipset
:
dump
(
ipsfile
or
'/etc/ipset.d/awall'
)
self
.
iptables
:
dump
(
iptdir
or
'/etc/iptables'
)
...
...
awall/ipset.lua
View file @
da7f4cb2
...
...
@@ -14,7 +14,7 @@ IPSet = awall.object.class(awall.object.Object)
function
IPSet
:
init
(
config
)
self
.
config
=
config
end
function
IPSet
:
commands
()
local
res
=
{}
local
res
=
{
'# ipset file generated by awall\n'
}
if
self
.
config
then
for
name
,
ipset
in
pairs
(
self
.
config
)
do
if
not
ipset
.
type
then
ipset
:
error
(
'Type not defined'
)
end
...
...
@@ -37,8 +37,13 @@ function IPSet:create()
end
end
function
IPSet
:
print
(
file
)
if
not
file
then
file
=
io.stdout
end
for
i
,
line
in
ipairs
(
self
:
commands
())
do
file
:
write
(
line
)
end
end
function
IPSet
:
dump
(
ipsfile
)
local
file
=
io.output
(
ipsfile
)
for
i
,
line
in
ipairs
(
self
:
commands
())
do
file
:
write
(
line
)
end
self
:
print
(
file
)
file
:
close
()
end
awall/iptables.lua
View file @
da7f4cb2
...
...
@@ -34,6 +34,13 @@ local backupdir = '/var/run/awall'
local
BaseIPTables
=
class
(
awall
.
object
.
Object
)
function
BaseIPTables
:
print
()
for
family
,
tbls
in
pairs
(
families
)
do
self
:
dumpfile
(
family
,
io.stdout
)
print
()
end
end
function
BaseIPTables
:
dump
(
dir
)
for
family
,
tbls
in
pairs
(
families
)
do
local
file
=
io.output
(
dir
..
'/'
..
families
[
family
].
file
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment