[fix] indentation of filtron's rules (json)

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2020-06-18 18:31:46 +02:00
parent dda4a46f8e
commit 6ff20cef73
2 changed files with 200 additions and 207 deletions

View File

@ -57,100 +57,91 @@ of:
.. code:: json .. code:: json
[ [
{ "name": "search request", {
"filters": [ "name": "search request",
"Param:q", "filters": [
"Path=^(/|/search)$" "Param:q",
], "Path=^(/|/search)$"
"interval": "<time-interval-in-sec (int)>", ],
"limit": "<max-request-number-in-interval (int)>", "interval": "<time-interval-in-sec (int)>"
"subrules": [ "limit": "<max-request-number-in-interval (int)>",
{ "subrules": [
"name": "roboagent limit", {
"interval": "<time-interval-in-sec (int)>", "name": "missing Accept-Language",
"limit": "<max-request-number-in-interval (int)>", "filters": ["!Header:Accept-Language"],
"filters": [ "limit": "<max-request-number-in-interval (int)>",
"Header:User-Agent=(curl|cURL|Wget|python-requests|Scrapy|FeedFetcher|Go-http-client)" "stop": true,
], "actions": [
"actions": [ {"name":"log"},
{ "name": "log"}, {"name": "block",
{ "name": "block", "params": {"message": "Rate limit exceeded"}}
"params": { ]
"message": "Rate limit exceeded" },
} {
} "name": "suspiciously Connection=close header",
] "filters": ["Header:Connection=close"],
}, "limit": "<max-request-number-in-interval (int)>",
{ "stop": true,
"name": "botlimit", "actions": [
"limit": 0, {"name":"log"},
"stop": true, {"name": "block",
"filters": [ "params": {"message": "Rate limit exceeded"}}
"Header:User-Agent=(Googlebot|bingbot|Baiduspider|yacybot|YandexMobileBot|YandexBot|Yahoo! Slurp|MJ12bot|AhrefsBot|archive.org_bot|msnbot|MJ12bot|SeznamBot|linkdexbot|Netvibes|SMTBot|zgrab|James BOT)" ]
], },
"actions": [ {
{ "name": "log"}, "name": "IP limit",
{ "name": "block", "interval": "<time-interval-in-sec (int)>"
"params": { "limit": "<max-request-number-in-interval (int)>",
"message": "Rate limit exceeded" "stop": true,
} "aggregations": [
} "Header:X-Forwarded-For"
] ],
}, "actions": [
{ { "name": "log"},
"name": "IP limit", { "name": "block",
"interval": "<time-interval-in-sec (int)>", "params": {
"limit": "<max-request-number-in-interval (int)>", "message": "Rate limit exceeded"
"stop": true, }
"aggregations": [ }
"Header:X-Forwarded-For" ]
], },
"actions": [ {
{ "name": "log"}, "name": "rss/json limit",
{ "name": "block", "filters": [
"params": { "Param:format=(csv|json|rss)"
"message": "Rate limit exceeded" ],
} "interval": "<time-interval-in-sec (int)>"
} "limit": "<max-request-number-in-interval (int)>",
] "stop": true,
}, "actions": [
{ { "name": "log"},
"name": "rss/json limit", { "name": "block",
"interval": "<time-interval-in-sec (int)>", "params": {
"limit": "<max-request-number-in-interval (int)>", "message": "Rate limit exceeded"
"stop": true, }
"filters": [ }
"Param:format=(csv|json|rss)" ]
], },
"actions": [ {
{ "name": "log"}, "name": "useragent limit",
{ "name": "block", "interval": "<time-interval-in-sec (int)>"
"params": { "limit": "<max-request-number-in-interval (int)>",
"message": "Rate limit exceeded" "aggregations": [
} "Header:User-Agent"
} ],
] "actions": [
}, { "name": "log"},
{ { "name": "block",
"name": "useragent limit", "params": {
"interval": "<time-interval-in-sec (int)>", "message": "Rate limit exceeded"
"limit": "<max-request-number-in-interval (int)>", }
"aggregations": [ }
"Header:User-Agent" ]
], }
"actions": [ ]
{ "name": "log"}, }
{ "name": "block", ]
"params": {
"message": "Rate limit exceeded"
}
}
]
}
]
}
]
.. _filtron route request: .. _filtron route request:

View File

@ -1,127 +1,129 @@
[ [
{ {
"name": "roboagent limit", "name": "roboagent limit",
"filters": [ "filters": [
"Header:User-Agent=(curl|cURL|Wget|python-requests|Scrapy|FeedFetcher|Go-http-client|Ruby|UniversalFeedParser)" "Header:User-Agent=(curl|cURL|Wget|python-requests|Scrapy|FeedFetcher|Go-http-client|Ruby|UniversalFeedParser)"
], ],
"limit": 0, "limit": 0,
"stop": true, "stop": true,
"actions": [ "actions": [
{ "name": "log"}, { "name": "log"},
{ "name": "block", { "name": "block",
"params": { "params": {
"message": "Rate limit exceeded" "message": "Rate limit exceeded"
} }
} }
] ]
}, },
{ {
"name": "botlimit", "name": "botlimit",
"filters": [ "filters": [
"Header:User-Agent=(Googlebot|bingbot|Baiduspider|yacybot|YandexMobileBot|YandexBot|Yahoo! Slurp|MJ12bot|AhrefsBot|archive.org_bot|msnbot|MJ12bot|SeznamBot|linkdexbot|Netvibes|SMTBot|zgrab|James BOT)" "Header:User-Agent=(Googlebot|bingbot|Baiduspider|yacybot|YandexMobileBot|YandexBot|Yahoo! Slurp|MJ12bot|AhrefsBot|archive.org_bot|msnbot|MJ12bot|SeznamBot|linkdexbot|Netvibes|SMTBot|zgrab|James BOT)"
], ],
"limit": 0, "limit": 0,
"stop": true, "stop": true,
"actions": [ "actions": [
{ "name": "log"}, { "name": "log"},
{ "name": "block", { "name": "block",
"params": { "params": {
"message": "Rate limit exceeded" "message": "Rate limit exceeded"
} }
} }
] ]
}, },
{ "name": "suspiciously frequent IP", {
"filters": [], "name": "suspiciously frequent IP",
"interval": 600, "filters": [],
"limit": 30, "interval": 600,
"aggregations": [ "limit": 30,
"Header:X-Forwarded-For" "aggregations": [
"Header:X-Forwarded-For"
], ],
"actions":[ "actions":[
{"name":"log"} {"name":"log"}
] ]
}, },
{ "name": "search request", {
"filters": [ "name": "search request",
"Param:q", "filters": [
"Path=^(/|/search)$" "Param:q",
], "Path=^(/|/search)$"
"interval": 61, ],
"limit": 999, "interval": 61,
"subrules": [ "limit": 999,
{ "subrules": [
"name": "missing Accept-Language", {
"filters": ["!Header:Accept-Language"], "name": "missing Accept-Language",
"limit": 0, "filters": ["!Header:Accept-Language"],
"stop": true, "limit": 0,
"actions": [ "stop": true,
{"name":"log"}, "actions": [
{"name": "block", {"name":"log"},
"params": {"message": "Rate limit exceeded"}} {"name": "block",
] "params": {"message": "Rate limit exceeded"}}
}, ]
{ },
"name": "suspiciously Connection=close header", {
"filters": ["Header:Connection=close"], "name": "suspiciously Connection=close header",
"limit": 0, "filters": ["Header:Connection=close"],
"stop": true, "limit": 0,
"actions": [ "stop": true,
{"name":"log"}, "actions": [
{"name": "block", {"name":"log"},
"params": {"message": "Rate limit exceeded"}} {"name": "block",
] "params": {"message": "Rate limit exceeded"}}
}, ]
{ },
"name": "IP limit", {
"interval": 61, "name": "IP limit",
"limit": 9, "interval": 61,
"stop": true, "limit": 9,
"aggregations": [ "stop": true,
"Header:X-Forwarded-For" "aggregations": [
], "Header:X-Forwarded-For"
"actions": [ ],
{ "name": "log"}, "actions": [
{ "name": "block", { "name": "log"},
"params": { { "name": "block",
"message": "Rate limit exceeded" "params": {
} "message": "Rate limit exceeded"
} }
] }
}, ]
{ },
"name": "rss/json limit", {
"filters": [ "name": "rss/json limit",
"Param:format=(csv|json|rss)" "filters": [
], "Param:format=(csv|json|rss)"
"interval": 121, ],
"limit": 2, "interval": 121,
"stop": true, "limit": 2,
"actions": [ "stop": true,
{ "name": "log"}, "actions": [
{ "name": "block", { "name": "log"},
"params": { { "name": "block",
"message": "Rate limit exceeded" "params": {
} "message": "Rate limit exceeded"
} }
] }
}, ]
{ },
"name": "useragent limit", {
"interval": 61, "name": "useragent limit",
"limit": 199, "interval": 61,
"aggregations": [ "limit": 199,
"Header:User-Agent" "aggregations": [
], "Header:User-Agent"
"actions": [ ],
{ "name": "log"}, "actions": [
{ "name": "block", { "name": "log"},
"params": { { "name": "block",
"message": "Rate limit exceeded" "params": {
} "message": "Rate limit exceeded"
} }
] }
} ]
] }
]
} }
] ]