Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
awall
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
6
Issues
6
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpine
awall
Commits
1bc58d4a
Commit
1bc58d4a
authored
May 01, 2012
by
Kaarle Ritvanen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
policy file description attribute
parent
71803c12
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
10 deletions
+20
-10
awall-cli
awall-cli
+3
-1
policy.lua
awall/policy.lua
+15
-9
sample-policy.json
sample-policy.json
+2
-0
No files found.
awall-cli
View file @
1bc58d4a
...
...
@@ -100,7 +100,9 @@ require 'awall'
policyset
=
awall
.
PolicySet
.
new
(
params
.
i
,
params
.
I
)
if
mode
==
'list'
then
for
name
,
status
in
policyset
:
list
()
do
print
(
name
,
status
)
end
for
name
,
status
,
desc
in
policyset
:
list
()
do
print
(
name
,
status
,
desc
)
end
os.exit
()
end
...
...
awall/policy.lua
View file @
1bc58d4a
...
...
@@ -73,6 +73,17 @@ function PolicySet:init(confdirs, importdirs)
end
function
PolicySet
:
loadJSON
(
name
,
fname
)
local
file
=
fname
and
io.open
(
fname
)
or
open
(
name
,
self
.
importdirs
)
if
not
file
then
error
(
'Import failed: '
..
name
)
end
local
data
=
''
for
line
in
file
:
lines
()
do
data
=
data
..
line
end
file
:
close
()
return
json
.
decode
(
data
)
end
function
PolicySet
:
load
()
local
input
=
{}
...
...
@@ -86,20 +97,15 @@ function PolicySet:load()
error
(
'Circular import: '
..
name
)
end
local
file
=
fname
and
io.open
(
fname
)
or
open
(
name
,
self
.
importdirs
)
if
not
file
then
error
(
'Import failed: '
..
name
)
end
local
data
=
''
for
line
in
file
:
lines
()
do
data
=
data
..
line
end
file
:
close
()
data
=
json
.
decode
(
data
)
local
data
=
self
:
loadJSON
(
name
,
fname
)
table.insert
(
required
,
name
)
for
i
,
iname
in
util
.
listpairs
(
data
.
import
)
do
import
(
iname
)
end
table.insert
(
imported
,
name
)
for
cls
,
objs
in
pairs
(
data
)
do
if
cls
~=
'import'
then
if
not
util
.
contains
({
'description'
,
'import'
},
cls
)
then
if
not
input
[
cls
]
then
input
[
cls
]
=
objs
elseif
objs
[
1
]
then
util
.
extend
(
input
[
cls
],
objs
)
else
...
...
@@ -160,6 +166,6 @@ function PolicySet:list()
elseif
util
.
contains
(
imported
,
name
)
then
status
=
'required'
else
status
=
'disabled'
end
return
name
,
status
return
name
,
status
,
self
:
loadJSON
(
name
,
pols
[
i
][
2
]).
description
end
end
sample-policy.json
View file @
1bc58d4a
{
"description"
:
"Sample awall policy; copy to /etc/awall to use"
,
"variable"
:
{
"internet_if"
:
"eth0"
},
"zone"
:
{
...
...
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