From a7ccf0a9543f96eec7824926d4789281a68b876a Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 10 Apr 2022 20:38:27 +0200 Subject: ids: T4333: bugfix - threshold loop --- data/templates/ids/fastnetmon.tmpl | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/data/templates/ids/fastnetmon.tmpl b/data/templates/ids/fastnetmon.tmpl index 9d52be90a..b6bef9a68 100644 --- a/data/templates/ids/fastnetmon.tmpl +++ b/data/templates/ids/fastnetmon.tmpl @@ -25,27 +25,27 @@ unban_only_if_attack_finished = on # For each subnet, list track speed in bps and pps for both directions enable_subnet_counters = off -{% if mode is vyos_defined('mirror')%} +{% if mode.mirror is vyos_defined %} mirror_afpacket = on {% endif %} -{% if direction is vyos_defined %} -process_incoming_traffic = {{ 'on' if 'in' in direction else 'off '}} -process_outgoing_traffic = {{ 'on' if 'out' in direction else 'off '}} -{% endif %} +process_incoming_traffic = {{ 'on' if direction is vyos_defined and 'in' in direction else 'off '}} +process_outgoing_traffic = {{ 'on' if direction is vyos_defined and 'out' in direction else 'off '}} -{% for thr, thr_value in threshold.items() %} -{% if thr is vyos_defined('fps') %} +{% if threshold is vyos_defined %} +{% for thr, thr_value in threshold.items() %} +{% if thr is vyos_defined('fps') %} ban_for_flows = on threshold_flows = {{ thr_value }} -{% elif thr is vyos_defined('mbps') %} +{% elif thr is vyos_defined('mbps') %} ban_for_bandwidth = on threshold_mbps = {{ thr_value }} -{% elif thr is vyos_defined('pps') %} +{% elif thr is vyos_defined('pps') %} ban_for_pps = on threshold_pps = {{ thr_value }} -{% endif %} -{% endfor %} +{% endif %} +{% endfor %} +{% endif %} {% if listen_interface is vyos_defined %} interfaces = {{ listen_interface | join(',') }} -- cgit v1.2.3