Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
alpine
awall
Commits
7bb0674c
Commit
7bb0674c
authored
May 31, 2017
by
Kaarle Ritvanen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Log: new mode: none
parent
06591454
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
2237 additions
and
611 deletions
+2237
-611
README.md
README.md
+2
-1
awall/modules/filter.lua
awall/modules/filter.lua
+3
-2
awall/modules/log.lua
awall/modules/log.lua
+3
-1
test/mandatory/filter-limit.json
test/mandatory/filter-limit.json
+59
-1
test/mandatory/log.json
test/mandatory/log.json
+5
-1
test/output/dump
test/output/dump
+1471
-421
test/output/rules-save
test/output/rules-save
+347
-92
test/output/rules6-save
test/output/rules6-save
+347
-92
No files found.
README.md
View file @
7bb0674c
...
@@ -244,7 +244,8 @@ logging class names to setting objects.
...
@@ -244,7 +244,8 @@ logging class names to setting objects.
A setting object may have an attribute named
**mode**
, which specifies
A setting object may have an attribute named
**mode**
, which specifies
which logging facility to use. Allowed values are
**log**
,
**nflog**
,
which logging facility to use. Allowed values are
**log**
,
**nflog**
,
and
**ulog**
. The default is
**log**
, i.e. in-kernel logging.
**ulog**
, and
**none**
. The default is
**log**
, i.e. in-kernel
logging.
The following table shows the optional attributes valid for all
The following table shows the optional attributes valid for all
logging modes:
logging modes:
...
...
awall/modules/filter.lua
View file @
7bb0674c
...
@@ -177,7 +177,8 @@ end
...
@@ -177,7 +177,8 @@ end
function
LoggingRule
:
combinelog
(
ofrags
,
log
,
action
,
target
)
function
LoggingRule
:
combinelog
(
ofrags
,
log
,
action
,
target
)
local
actions
=
self
:
actofrags
(
log
,
target
)
local
actions
=
self
:
actofrags
(
log
,
target
)
return
actions
[
1
]
and
return
actions
[
1
]
and
self
:
combine
(
ofrags
,
actions
,
'log'
..
action
,
log
)
or
ofrags
self
:
combine
(
ofrags
,
actions
,
'log'
..
action
,
log
and
log
:
target
())
or
ofrags
end
end
function
LoggingRule
:
mangleoptfrags
(
ofrags
)
function
LoggingRule
:
mangleoptfrags
(
ofrags
)
...
@@ -407,7 +408,7 @@ function Filter:mangleoptfrags(ofrags)
...
@@ -407,7 +408,7 @@ function Filter:mangleoptfrags(ofrags)
if
ct
then
if
ct
then
extend
(
ofs
,
self
:
actofrags
(
self
.
log
))
extend
(
ofs
,
self
:
actofrags
(
self
.
log
))
nxt
=
target
nxt
=
target
elseif
sofs
and
not
pl
then
nxt
=
false
end
elseif
sofs
and
not
(
pl
and
pl
:
target
())
then
nxt
=
false
end
extend
(
ofs
,
combinations
(
sofs
,
self
:
actofrags
(
pl
,
nxt
)))
extend
(
ofs
,
combinations
(
sofs
,
self
:
actofrags
(
pl
,
nxt
)))
else
else
...
...
awall/modules/log.lua
View file @
7bb0674c
...
@@ -70,6 +70,7 @@ function Log:target()
...
@@ -70,6 +70,7 @@ function Log:target()
}
}
local
mode
=
self
.
mode
or
'log'
local
mode
=
self
.
mode
or
'log'
if
mode
==
'none'
then
return
end
if
not
optmap
[
mode
]
then
self
:
error
(
'Invalid logging mode: '
..
mode
)
end
if
not
optmap
[
mode
]
then
self
:
error
(
'Invalid logging mode: '
..
mode
)
end
local
res
=
mode
:
upper
()
local
res
=
mode
:
upper
()
...
@@ -84,7 +85,8 @@ function Log:target()
...
@@ -84,7 +85,8 @@ function Log:target()
end
end
function
Log
:
optfrags
()
function
Log
:
optfrags
()
return
combinations
(
self
:
matchofrags
(),
{{
target
=
self
:
target
()}})
local
target
=
self
:
target
()
return
combinations
(
self
:
matchofrags
(),
{
target
and
{
target
=
target
}})
end
end
function
Log
.
get
(
rule
,
spec
,
default
)
function
Log
.
get
(
rule
,
spec
,
default
)
...
...
test/mandatory/filter-limit.json
View file @
7bb0674c
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
{
"conn-limit"
:
1
,
"action"
:
"pass"
},
{
"conn-limit"
:
1
,
"action"
:
"pass"
},
{
"conn-limit"
:
1
,
"log"
:
true
},
{
"conn-limit"
:
1
,
"log"
:
true
},
{
"conn-limit"
:
1
,
"log"
:
true
,
"action"
:
"pass"
},
{
"conn-limit"
:
1
,
"log"
:
true
,
"action"
:
"pass"
},
{
"conn-limit"
:
1
,
"log"
:
"none"
},
{
"conn-limit"
:
1
,
"log"
:
"none"
,
"action"
:
"pass"
},
{
"conn-limit"
:
{
"count"
:
1
,
"log"
:
false
}
},
{
"conn-limit"
:
{
"count"
:
1
,
"log"
:
false
}
},
{
"conn-limit"
:
{
"count"
:
1
,
"log"
:
false
},
"action"
:
"pass"
},
{
"conn-limit"
:
{
"count"
:
1
,
"log"
:
false
},
"action"
:
"pass"
},
{
"conn-limit"
:
{
"count"
:
1
,
"log"
:
false
},
"log"
:
true
},
{
"conn-limit"
:
{
"count"
:
1
,
"log"
:
false
},
"log"
:
true
},
...
@@ -12,17 +14,46 @@
...
@@ -12,17 +14,46 @@
"log"
:
true
,
"log"
:
true
,
"action"
:
"pass"
"action"
:
"pass"
},
},
{
"conn-limit"
:
{
"count"
:
1
,
"log"
:
false
},
"log"
:
"none"
},
{
"conn-limit"
:
{
"count"
:
1
,
"log"
:
false
},
"log"
:
"none"
,
"action"
:
"pass"
},
{
"conn-limit"
:
{
"count"
:
1
,
"log"
:
"none"
}
},
{
"conn-limit"
:
{
"count"
:
1
,
"log"
:
"none"
},
"action"
:
"pass"
},
{
"conn-limit"
:
{
"count"
:
1
,
"log"
:
"none"
},
"log"
:
true
},
{
"conn-limit"
:
{
"count"
:
1
,
"log"
:
"none"
},
"log"
:
true
,
"action"
:
"pass"
},
{
"conn-limit"
:
{
"count"
:
1
,
"log"
:
"none"
},
"log"
:
"none"
},
{
"conn-limit"
:
{
"count"
:
1
,
"log"
:
"none"
},
"log"
:
"none"
,
"action"
:
"pass"
},
{
"conn-limit"
:
30
},
{
"conn-limit"
:
30
},
{
"conn-limit"
:
30
,
"action"
:
"pass"
},
{
"conn-limit"
:
30
,
"action"
:
"pass"
},
{
"conn-limit"
:
30
,
"log"
:
true
},
{
"conn-limit"
:
30
,
"log"
:
true
},
{
"conn-limit"
:
30
,
"log"
:
"none"
},
{
"conn-limit"
:
{
"count"
:
30
,
"log"
:
false
}
},
{
"conn-limit"
:
{
"count"
:
30
,
"log"
:
false
}
},
{
"conn-limit"
:
{
"count"
:
30
,
"log"
:
false
},
"action"
:
"pass"
},
{
"conn-limit"
:
{
"count"
:
30
,
"log"
:
false
},
"action"
:
"pass"
},
{
"conn-limit"
:
{
"count"
:
30
,
"log"
:
false
},
"log"
:
true
},
{
"conn-limit"
:
{
"count"
:
30
,
"log"
:
false
},
"log"
:
true
},
{
"conn-limit"
:
{
"count"
:
30
,
"log"
:
false
},
"log"
:
"none"
},
{
"conn-limit"
:
{
"count"
:
30
,
"log"
:
"none"
}
},
{
"conn-limit"
:
{
"count"
:
30
,
"log"
:
"none"
},
"action"
:
"pass"
},
{
"conn-limit"
:
{
"count"
:
30
,
"log"
:
"none"
},
"log"
:
true
},
{
"conn-limit"
:
{
"count"
:
30
,
"log"
:
"none"
},
"log"
:
"none"
},
{
"flow-limit"
:
1
},
{
"flow-limit"
:
1
},
{
"flow-limit"
:
1
,
"action"
:
"pass"
},
{
"flow-limit"
:
1
,
"action"
:
"pass"
},
{
"flow-limit"
:
1
,
"log"
:
true
},
{
"flow-limit"
:
1
,
"log"
:
true
},
{
"flow-limit"
:
1
,
"log"
:
true
,
"action"
:
"pass"
},
{
"flow-limit"
:
1
,
"log"
:
true
,
"action"
:
"pass"
},
{
"flow-limit"
:
1
,
"log"
:
"none"
},
{
"flow-limit"
:
1
,
"log"
:
"none"
,
"action"
:
"pass"
},
{
"flow-limit"
:
{
"count"
:
1
,
"log"
:
false
}
},
{
"flow-limit"
:
{
"count"
:
1
,
"log"
:
false
}
},
{
"flow-limit"
:
{
"count"
:
1
,
"log"
:
false
},
"action"
:
"pass"
},
{
"flow-limit"
:
{
"count"
:
1
,
"log"
:
false
},
"action"
:
"pass"
},
{
"flow-limit"
:
{
"count"
:
1
,
"log"
:
false
},
"log"
:
true
},
{
"flow-limit"
:
{
"count"
:
1
,
"log"
:
false
},
"log"
:
true
},
...
@@ -31,11 +62,38 @@
...
@@ -31,11 +62,38 @@
"log"
:
true
,
"log"
:
true
,
"action"
:
"pass"
"action"
:
"pass"
},
},
{
"flow-limit"
:
{
"count"
:
1
,
"log"
:
false
},
"log"
:
"none"
},
{
"flow-limit"
:
{
"count"
:
1
,
"log"
:
false
},
"log"
:
"none"
,
"action"
:
"pass"
},
{
"flow-limit"
:
{
"count"
:
1
,
"log"
:
"none"
}
},
{
"flow-limit"
:
{
"count"
:
1
,
"log"
:
"none"
},
"action"
:
"pass"
},
{
"flow-limit"
:
{
"count"
:
1
,
"log"
:
"none"
},
"log"
:
true
},
{
"flow-limit"
:
{
"count"
:
1
,
"log"
:
"none"
},
"log"
:
true
,
"action"
:
"pass"
},
{
"flow-limit"
:
{
"count"
:
1
,
"log"
:
"none"
},
"log"
:
"none"
},
{
"flow-limit"
:
{
"count"
:
1
,
"log"
:
"none"
},
"log"
:
"none"
,
"action"
:
"pass"
},
{
"flow-limit"
:
30
},
{
"flow-limit"
:
30
},
{
"flow-limit"
:
30
,
"action"
:
"pass"
},
{
"flow-limit"
:
30
,
"action"
:
"pass"
},
{
"flow-limit"
:
30
,
"log"
:
true
},
{
"flow-limit"
:
30
,
"log"
:
true
},
{
"flow-limit"
:
30
,
"log"
:
"none"
},
{
"flow-limit"
:
{
"count"
:
30
,
"log"
:
false
}
},
{
"flow-limit"
:
{
"count"
:
30
,
"log"
:
false
}
},
{
"flow-limit"
:
{
"count"
:
30
,
"log"
:
false
},
"action"
:
"pass"
},
{
"flow-limit"
:
{
"count"
:
30
,
"log"
:
false
},
"action"
:
"pass"
},
{
"flow-limit"
:
{
"count"
:
30
,
"log"
:
false
},
"log"
:
true
}
{
"flow-limit"
:
{
"count"
:
30
,
"log"
:
false
},
"log"
:
true
},
{
"flow-limit"
:
{
"count"
:
30
,
"log"
:
false
},
"log"
:
"none"
},
{
"flow-limit"
:
{
"count"
:
30
,
"log"
:
"none"
}
},
{
"flow-limit"
:
{
"count"
:
30
,
"log"
:
"none"
},
"action"
:
"pass"
},
{
"flow-limit"
:
{
"count"
:
30
,
"log"
:
"none"
},
"log"
:
true
},
{
"flow-limit"
:
{
"count"
:
30
,
"log"
:
"none"
},
"log"
:
"none"
}
]
]
}
}
test/mandatory/log.json
View file @
7bb0674c
{
{
"log"
:
{
"none"
:
{
"mode"
:
"none"
}
},
"filter"
:
[
"filter"
:
[
{},
{},
{
"action"
:
"drop"
},
{
"action"
:
"drop"
},
...
@@ -8,6 +9,9 @@
...
@@ -8,6 +9,9 @@
{
"log"
:
false
,
"action"
:
"pass"
},
{
"log"
:
false
,
"action"
:
"pass"
},
{
"log"
:
true
},
{
"log"
:
true
},
{
"log"
:
true
,
"action"
:
"drop"
},
{
"log"
:
true
,
"action"
:
"drop"
},
{
"log"
:
true
,
"action"
:
"pass"
}
{
"log"
:
true
,
"action"
:
"pass"
},
{
"log"
:
"none"
},
{
"log"
:
"none"
,
"action"
:
"drop"
},
{
"log"
:
"none"
,
"action"
:
"pass"
}
]
]
}
}
test/output/dump
View file @
7bb0674c
This diff is collapsed.
Click to expand it.
test/output/rules-save
View file @
7bb0674c
This diff is collapsed.
Click to expand it.
test/output/rules6-save
View file @
7bb0674c
This diff is collapsed.
Click to expand it.
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