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
20d2c9ec
Commit
20d2c9ec
authored
Feb 16, 2012
by
Kaarle Ritvanen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
multiple configuration files, service definitions
parent
16e25b4f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
4 deletions
+41
-4
awall/init.lua
awall/init.lua
+26
-4
services.json
services.json
+15
-0
No files found.
awall/init.lua
View file @
20d2c9ec
...
@@ -7,6 +7,7 @@ Licensed under the terms of GPL2
...
@@ -7,6 +7,7 @@ Licensed under the terms of GPL2
module
(
...
,
package
.
seeall
)
module
(
...
,
package
.
seeall
)
require
'json'
require
'json'
require
'lfs'
require
'awall.iptables'
require
'awall.iptables'
require
'awall.util'
require
'awall.util'
...
@@ -14,7 +15,9 @@ require 'awall.util'
...
@@ -14,7 +15,9 @@ require 'awall.util'
local
modules
=
{}
local
modules
=
{}
local
modpath
=
arg
[
0
]
==
'/usr/sbin/awall'
and
'/usr/share/lua/5.1'
or
'.'
local
testmode
=
arg
[
0
]
~=
'/usr/sbin/awall'
local
modpath
=
testmode
and
'.'
or
'/usr/share/lua/5.1'
for
line
in
io.popen
(
'cd '
..
modpath
..
' && ls awall/model.lua awall/modules/*.lua'
):
lines
()
do
for
line
in
io.popen
(
'cd '
..
modpath
..
' && ls awall/model.lua awall/modules/*.lua'
):
lines
()
do
local
name
=
string.gsub
(
string.sub
(
line
,
1
,
-
5
),
'/'
,
'.'
)
local
name
=
string.gsub
(
string.sub
(
line
,
1
,
-
5
),
'/'
,
'.'
)
require
(
name
)
require
(
name
)
...
@@ -24,9 +27,28 @@ end
...
@@ -24,9 +27,28 @@ end
function
translate
()
function
translate
()
local
data
=
''
config
=
{}
for
line
in
io.lines
(
'config.json'
)
do
data
=
data
..
line
end
config
=
json
.
decode
(
data
)
local
confdirs
=
testmode
and
{
'config'
}
or
{
'/usr/share/awall'
,
'/etc/awall'
}
for
i
,
dir
in
ipairs
(
confdirs
)
do
for
fname
in
lfs
.
dir
(
dir
)
do
if
string.sub
(
fname
,
1
,
1
)
~=
'.'
then
local
data
=
''
for
line
in
io.lines
(
dir
..
'/'
..
fname
)
do
data
=
data
..
line
end
data
=
json
.
decode
(
data
)
for
cls
,
objs
in
pairs
(
data
)
do
if
not
config
[
cls
]
then
config
[
cls
]
=
objs
elseif
objs
[
1
]
then
util
.
extend
(
config
[
cls
],
objs
)
else
for
k
,
v
in
pairs
(
objs
)
do
config
[
cls
][
k
]
=
v
end
end
end
end
end
end
function
insertrule
(
trule
)
function
insertrule
(
trule
)
local
t
=
awall
.
iptables
.
config
[
trule
.
family
][
trule
.
table
][
trule
.
chain
]
local
t
=
awall
.
iptables
.
config
[
trule
.
family
][
trule
.
table
][
trule
.
chain
]
...
...
services.json
0 → 100644
View file @
20d2c9ec
{
"service"
:
{
"dns"
:
[
{
"proto"
:
"udp"
,
"port"
:
53
},
{
"proto"
:
"tcp"
,
"port"
:
53
}
],
"gre"
:
{
"proto"
:
"gre"
},
"icmp"
:
{
"proto"
:
"icmp"
},
"ipsec"
:
[
{
"proto"
:
"esp"
},
{
"proto"
:
"udp"
,
"port"
:
[
500
,
4500
]
}
],
"ssh"
:
{
"proto"
:
"tcp"
,
"port"
:
22
}
}
}
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