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
Incidents
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
20ae74c3
Commit
20ae74c3
authored
Jun 26, 2012
by
Kaarle Ritvanen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
command for dumping variable and zone definitions
parent
6b7e5230
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
1 deletion
+34
-1
awall-cli
awall-cli
+26
-1
awall/policy.lua
awall/policy.lua
+8
-0
No files found.
awall-cli
View file @
20ae74c3
...
...
@@ -50,6 +50,9 @@ List optional policies:
enabled by the user but is in use because it is required by
another policy which is in use.
Dump variable and zone definitions:
awall dump
]]
)
os.exit
()
end
...
...
@@ -91,7 +94,7 @@ end
require
'awall.util'
if
not
awall
.
util
.
contains
({
'translate'
,
'activate'
,
'fallback'
,
'enable'
,
'disable'
,
'list'
},
'enable'
,
'disable'
,
'list'
,
'dump'
},
mode
)
then
help
()
end
...
...
@@ -115,8 +118,30 @@ if awall.util.contains({'disable', 'enable'}, mode) then
os.exit
()
end
config
=
policyset
:
load
()
if
mode
==
'dump'
then
require
'json'
function
dump
(
title
,
data
)
print
(
title
..
':'
)
local
lines
=
{}
for
k
,
v
in
pairs
(
data
)
do
table.insert
(
lines
,
k
..
' = '
..
json
.
encode
(
v
))
end
table.sort
(
lines
)
for
i
,
line
in
ipairs
(
lines
)
do
print
(
line
)
end
print
()
end
dump
(
'Variables'
,
config
:
variables
())
config
=
config
:
expand
()
dump
(
'Zones'
,
config
.
zone
)
os.exit
()
end
require
'awall.iptables'
awall
.
loadmodules
(
basedir
)
...
...
awall/policy.lua
View file @
20ae74c3
...
...
@@ -49,6 +49,14 @@ function PolicyConfig:eval(value)
return
value
~=
''
and
value
or
nil
end
function
PolicyConfig
:
variables
()
local
res
=
{}
for
name
,
value
in
pairs
(
self
.
data
.
variable
or
{})
do
res
[
name
]
=
self
:
eval
(
'$'
..
name
)
end
return
res
end
function
PolicyConfig
:
expand
()
local
function
expand
(
obj
)
...
...
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