-
Notifications
You must be signed in to change notification settings - Fork 647
/
ruleset.conf
29 lines (29 loc) · 1.24 KB
/
ruleset.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{% set naxsi_ruletype = 'main' %}
{% set main_policies = [] %}
{% set main_rules = [] %}
{# collect custom policy UUIDs from locations so we know, which ones are probably in use #}
{% if OPNsense.Nginx.location is defined %}
{% for location in helpers.toList('OPNsense.Nginx.location') %}
{% if location.custom_policy is defined and location.custom_policy != ""%}
{% for custompolicy_uuid in location.custom_policy.split(',') %}
{% if not custompolicy_uuid in main_policies %}
{% do main_policies.append(custompolicy_uuid) %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% for custom_policy_uuid in main_policies %}
{% set custom_policy = helpers.getUUID(custom_policy_uuid) %}
{% if custom_policy.naxsi_rules is defined %}
{% for main_rule_uuid in custom_policy.naxsi_rules.split(',') %}
{% if main_rule_uuid not in main_rules %}
{% do main_rules.append(main_rule_uuid) %}
{% set main_rule = helpers.getUUID(main_rule_uuid) %}
{% if main_rule.ruletype == 'main' %}
{% include "OPNsense/Nginx/naxsirule.conf" ignore missing with context %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}