summaryrefslogtreecommitdiff
path: root/data/templates
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-04-10 20:01:15 +0200
committerChristian Poessinger <christian@poessinger.com>2022-04-10 20:01:15 +0200
commit66dd2792a80050bf11e422074011fe38b7294302 (patch)
treea39633131c84821f0007bdc70a9403af238b75a2 /data/templates
parentb90a3133468c6e37fbfba23e1dc03be27bc5969c (diff)
downloadvyos-1x-66dd2792a80050bf11e422074011fe38b7294302.tar.gz
vyos-1x-66dd2792a80050bf11e422074011fe38b7294302.zip
ids: T4333: migrate to new vyos_defined Jinja2 test
Diffstat (limited to 'data/templates')
-rw-r--r--data/templates/ids/fastnetmon.tmpl36
1 files changed, 16 insertions, 20 deletions
diff --git a/data/templates/ids/fastnetmon.tmpl b/data/templates/ids/fastnetmon.tmpl
index 1f6a1c808..9d52be90a 100644
--- a/data/templates/ids/fastnetmon.tmpl
+++ b/data/templates/ids/fastnetmon.tmpl
@@ -25,36 +25,32 @@ unban_only_if_attack_finished = on
# For each subnet, list track speed in bps and pps for both directions
enable_subnet_counters = off
-{% if "mirror" in mode %}
+{% if mode is vyos_defined('mirror')%}
mirror_afpacket = on
{% endif %}
-{% if "in" in direction %}
-process_incoming_traffic = on
+{% 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 %}
-{% if "out" in direction %}
-process_outgoing_traffic = on
-{% endif %}
-{% for th in threshold %}
-{% if th == "fps" %}
+
+{% for thr, thr_value in threshold.items() %}
+{% if thr is vyos_defined('fps') %}
ban_for_flows = on
-threshold_flows = {{ threshold[th] }}
-{% endif %}
-{% if th == "mbps" %}
+threshold_flows = {{ thr_value }}
+{% elif thr is vyos_defined('mbps') %}
ban_for_bandwidth = on
-threshold_mbps = {{ threshold[th] }}
-{% endif %}
-{% if th == "pps" %}
+threshold_mbps = {{ thr_value }}
+{% elif thr is vyos_defined('pps') %}
ban_for_pps = on
-threshold_pps = {{ threshold[th] }}
-{% endif %}
+threshold_pps = {{ thr_value }}
+{% endif %}
{% endfor %}
-{% if listen_interface %}
-{% set value = listen_interface if listen_interface is string else listen_interface | join(',') %}
-interfaces = {{ value }}
+{% if listen_interface is vyos_defined %}
+interfaces = {{ listen_interface | join(',') }}
{% endif %}
-{% if alert_script %}
+{% if alert_script is vyos_defined %}
notify_script_path = {{ alert_script }}
{% endif %}