aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2017-09-30 12:45:35 +0300
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2017-09-30 23:28:29 +0300
commit467948551a7ed784c206675eba2e29e034484ed1 (patch)
tree481e65e7874853040939a68b4721db4d785f81d6 /test
parent65c82f54d6268c55b28ab3a3de088c859f7b88d1 (diff)
downloadawall-467948551a7ed784c206675eba2e29e034484ed1.tar.bz2
awall-467948551a7ed784c206675eba2e29e034484ed1.tar.xz
generate test policy: filter-limits
Diffstat (limited to 'test')
-rw-r--r--test/mandatory/filter-limit.json301
-rw-r--r--test/mandatory/filter-limit.lua36
2 files changed, 36 insertions, 301 deletions
diff --git a/test/mandatory/filter-limit.json b/test/mandatory/filter-limit.json
deleted file mode 100644
index 3082dc1..0000000
--- a/test/mandatory/filter-limit.json
+++ /dev/null
@@ -1,301 +0,0 @@
-{
- "filter": [
- { "conn-limit": 1 },
- { "conn-limit": 1, "action": "pass" },
- { "conn-limit": 1, "log": true },
- { "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 }, "action": "pass" },
- { "conn-limit": { "count": 1, "log": false }, "log": true },
- {
- "conn-limit": { "count": 1, "log": false },
- "log": true,
- "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, "action": "pass" },
- { "conn-limit": 30, "log": true },
- { "conn-limit": 30, "log": "none" },
- { "conn-limit": { "count": 30, "log": false } },
- { "conn-limit": { "count": 30, "log": false }, "action": "pass" },
- { "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, "action": "pass" },
- { "flow-limit": 1, "log": true },
- { "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 }, "action": "pass" },
- { "flow-limit": { "count": 1, "log": false }, "log": true },
- {
- "flow-limit": { "count": 1, "log": false },
- "log": true,
- "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, "action": "pass" },
- { "flow-limit": 30, "log": true },
- { "flow-limit": 30, "log": "none" },
- { "flow-limit": { "count": 30, "log": false } },
- { "flow-limit": { "count": 30, "log": false }, "action": "pass" },
- { "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" },
-
- { "in": "A", "out": "_fw", "flow-limit": 1, "no-track": true },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": 1,
- "action": "pass",
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": 1,
- "log": true,
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": 1,
- "log": true,
- "action": "pass",
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": 1,
- "log": "none",
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": 1,
- "log": "none",
- "action": "pass",
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": { "count": 1, "log": false },
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": { "count": 1, "log": false },
- "action": "pass",
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": { "count": 1, "log": false },
- "log": true,
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": { "count": 1, "log": false },
- "log": true,
- "action": "pass",
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": { "count": 1, "log": false },
- "log": "none",
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": { "count": 1, "log": false },
- "log": "none",
- "action": "pass",
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": { "count": 1, "log": "none" },
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": { "count": 1, "log": "none" },
- "action": "pass",
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": { "count": 1, "log": "none" },
- "log": true,
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": { "count": 1, "log": "none" },
- "log": true,
- "action": "pass",
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": { "count": 1, "log": "none" },
- "log": "none",
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": { "count": 1, "log": "none" },
- "log": "none",
- "action": "pass",
- "no-track": true
- },
-
- { "in": "A", "out": "_fw", "flow-limit": 30, "no-track": true },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": 30,
- "action": "pass",
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": 30,
- "log": true,
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": 30,
- "log": "none",
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": { "count": 30, "log": false },
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": { "count": 30, "log": false },
- "action": "pass",
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": { "count": 30, "log": false },
- "log": true,
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": { "count": 30, "log": false },
- "log": "none",
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": { "count": 30, "log": "none" },
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": { "count": 30, "log": "none" },
- "action": "pass",
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": { "count": 30, "log": "none" },
- "log": true,
- "no-track": true
- },
- {
- "in": "A",
- "out": "_fw",
- "flow-limit": { "count": 30, "log": "none" },
- "log": "none",
- "no-track": true
- }
- ]
-}
diff --git a/test/mandatory/filter-limit.lua b/test/mandatory/filter-limit.lua
new file mode 100644
index 0000000..a2f2838
--- /dev/null
+++ b/test/mandatory/filter-limit.lua
@@ -0,0 +1,36 @@
+util = require('awall.util')
+json = require('cjson')
+
+res = {}
+
+function add(limit_type, base)
+ for _, count in ipairs{1, 30} do
+ for _, limit in ipairs{
+ count, {count=count, log=false}, {count=count, log='none'}
+ } do
+ for _, log in ipairs{false, true, 'none'} do
+ for _, action in ipairs{false, 'pass'} do
+ if not (count == 30 and log and action) then
+ table.insert(
+ res,
+ util.update(
+ util.copy(base or {}),
+ {
+ [limit_type..'-limit']=limit,
+ log=log or nil,
+ action=action or nil
+ }
+ )
+ )
+ end
+ end
+ end
+ end
+ end
+end
+
+add('conn')
+add('flow')
+add('flow', {['in']='A', out='_fw', ['no-track']=true})
+
+print(json.encode{filter=res})