@@ -2713,6 +4305,19 @@
Should be a string between 1 and 255 characters.
N
+
+ Y
+ dom
+
+ beg – key begins with requested value
+ dom – Domains
+ end – key ends with requested value
+ int – Integers
+ ip – IPs
+ reg – Regular Expressions
+ str – Strings
+
+
Y
diff --git a/net/haproxy/src/opnsense/mvc/app/models/OPNsense/HAProxy/Migrations/M5_0_0.php b/net/haproxy/src/opnsense/mvc/app/models/OPNsense/HAProxy/Migrations/M5_0_0.php
new file mode 100644
index 0000000000..04f55aae85
--- /dev/null
+++ b/net/haproxy/src/opnsense/mvc/app/models/OPNsense/HAProxy/Migrations/M5_0_0.php
@@ -0,0 +1,309 @@
+getNodeByReference('actions.action')->iterateItems() as $action) {
+ // Rules have an 'enabled' field now
+ $action->enabled = '1';
+ // Migrate TCP/HTTP rules to new format
+ switch ((string)$action->type) {
+ case 'http-request_add-header':
+ $action->type = 'http-request';
+ $action->http_request_action = 'add-header';
+ if (!empty((string)$action->http_request_add_header_name)) {
+ $action->http_request_option = (string)$action->http_request_add_header_name . ' ' . (string)$action->http_request_add_header_content;
+ $action->http_request_add_header_name = null;
+ $action->http_request_add_header_content = null;
+ }
+ break;
+ case 'http-request_allow':
+ $action->type = 'http-request';
+ $action->http_request_action = 'allow';
+ break;
+ case 'http-request_auth':
+ $action->type = 'http-request';
+ $action->http_request_action = 'auth';
+ if (!empty((string)$action->http_request_auth)) {
+ $action->http_request_option = 'realm ' . (string)$action->http_request_auth;
+ $action->http_request_auth = null;
+ }
+ break;
+ case 'http-request_del-header':
+ $action->type = 'http-request';
+ $action->http_request_action = 'del-header';
+ if (!empty((string)$action->http_request_del_header_name)) {
+ $action->http_request_option = (string)$action->http_request_del_header_name;
+ $action->http_request_del_header_name = null;
+ }
+ break;
+ case 'http-request_deny':
+ $action->type = 'http-request';
+ $action->http_request_action = 'deny';
+ break;
+ case 'http-request_lua':
+ $action->type = 'http-request';
+ $action->http_request_action = 'lua';
+ if (!empty((string)$action->http_request_lua)) {
+ $action->http_request_option = (string)$action->http_request_lua;
+ $action->http_request_lua = null;
+ }
+ break;
+ case 'http-request_redirect':
+ $action->type = 'http-request';
+ $action->http_request_action = 'redirect';
+ if (!empty((string)$action->http_request_redirect)) {
+ $action->http_request_option = (string)$action->http_request_redirect;
+ $action->http_request_redirect = null;
+ }
+ break;
+ case 'http-request_replace-header':
+ $action->type = 'http-request';
+ $action->http_request_action = 'replace-header';
+ if (!empty((string)$action->http_request_replace_header_name)) {
+ $action->http_request_option = (string)$action->http_request_replace_header_name . ' ' . (string)$action->http_request_replace_header_regex;
+ $action->http_request_replace_header_name = null;
+ $action->http_request_replace_header_regex = null;
+ }
+ break;
+ case 'http-request_replace-value':
+ $action->type = 'http-request';
+ $action->http_request_action = 'replace-value';
+ if (!empty((string)$action->http_request_replace_value_name)) {
+ $action->http_request_option = (string)$action->http_request_replace_value_name . ' ' . (string)$action->http_request_replace_value_regex;
+ $action->http_request_replace_value_name = null;
+ $action->http_request_replace_value_regex = null;
+ }
+ break;
+ case 'http-request_set-header':
+ $action->type = 'http-request';
+ $action->http_request_action = 'set-header';
+ if (!empty((string)$action->http_request_set_header_name)) {
+ $action->http_request_option = (string)$action->http_request_set_header_name . ' ' . (string)$action->http_request_set_header_content;
+ $action->http_request_set_header_name = null;
+ $action->http_request_set_header_content = null;
+ }
+ break;
+ case 'http-request_set-path':
+ $action->type = 'http-request';
+ $action->http_request_action = 'set-path';
+ if (!empty((string)$action->http_request_set_path)) {
+ $action->http_request_option = (string)$action->http_request_set_path;
+ $action->http_request_set_path = null;
+ }
+ break;
+ case 'http-request_set-var':
+ $action->type = 'http-request';
+ $action->http_request_action = 'set-var';
+ if (!empty((string)$action->http_request_set_var_name)) {
+ $action->http_request_option = '(' . (string)$action->http_request_set_var_scope . '.' . (string)$action->http_request_set_var_name . ') ' . (string)$action->http_request_set_var_expr;
+ $action->http_request_set_var_scope = null;
+ $action->http_request_set_var_name = null;
+ $action->http_request_set_var_expr = null;
+ }
+ break;
+ case 'http-request_silent-drop':
+ $action->type = 'http-request';
+ $action->http_request_action = 'silent-drop';
+ break;
+ case 'http-request_tarpit':
+ $action->type = 'http-request';
+ $action->http_request_action = 'tarpit';
+ break;
+ case 'http-request_use-service':
+ $action->type = 'http-request';
+ $action->http_request_action = 'use-service';
+ if (!empty((string)$action->http_request_use_service)) {
+ $action->http_request_option = (string)$action->http_request_use_service;
+ $action->http_request_use_service = null;
+ }
+ break;
+ case 'http-response_add-header':
+ $action->type = 'http-response';
+ $action->http_response_action = 'add-header';
+ if (!empty((string)$action->http_response_add_header_name)) {
+ $action->http_response_option = (string)$action->http_response_add_header_name . ' ' . (string)$action->http_response_add_header_content;
+ $action->http_response_add_header_name = null;
+ $action->http_response_add_header_content = null;
+ }
+ break;
+ case 'http-response_allow':
+ $action->type = 'http-response';
+ $action->http_response_action = 'allow';
+ break;
+ case 'http-response_del-header':
+ $action->type = 'http-response';
+ $action->http_response_action = 'del-header';
+ if (!empty((string)$action->http_response_del_header_name)) {
+ $action->http_response_option = (string)$action->http_response_del_header_name;
+ $action->http_response_del_header_name = null;
+ }
+ break;
+ case 'http-response_deny':
+ $action->type = 'http-response';
+ $action->http_response_action = 'deny';
+ break;
+ case 'http-response_lua':
+ $action->type = 'http-response';
+ $action->http_response_action = 'lua';
+ if (!empty((string)$action->http_response_lua)) {
+ $action->http_response_option = (string)$action->http_response_lua;
+ $action->http_response_lua = null;
+ }
+ break;
+ case 'http-response_replace-header':
+ $action->type = 'http-response';
+ $action->http_response_action = 'replace-header';
+ if (!empty((string)$action->http_response_replace_header_name)) {
+ $action->http_response_option = (string)$action->http_response_replace_header_name . ' ' . (string)$action->http_response_replace_header_regex;
+ $action->http_response_replace_header_name = null;
+ $action->http_response_replace_header_regex = null;
+ }
+ break;
+ case 'http-response_replace-value':
+ $action->type = 'http-response';
+ $action->http_response_action = 'replace-value';
+ if (!empty((string)$action->http_response_replace_value_name)) {
+ $action->http_response_option = (string)$action->http_response_replace_value_name . ' ' . (string)$action->http_response_replace_value_regex;
+ $action->http_response_replace_value_name = null;
+ $action->http_response_replace_value_regex = null;
+ }
+ break;
+ case 'http-response_set-header':
+ $action->type = 'http-response';
+ $action->http_response_action = 'set-header';
+ if (!empty((string)$action->http_response_set_header_name)) {
+ $action->http_response_option = (string)$action->http_response_set_header_name . ' ' . (string)$action->http_response_set_header_content;
+ $action->http_response_set_header_name = null;
+ $action->http_response_set_header_content = null;
+ }
+ break;
+ case 'http-response_set-status':
+ $action->type = 'http-response';
+ $action->http_response_action = 'set-status';
+ if (!empty((string)$action->http_response_set_status_code)) {
+ if (!empty((string)$action->http_response_set_status_reason)) {
+ $status_reason = ' reason "' . (string)$action->http_response_set_status_reason . '"';
+ } else {
+ $status_reason = '';
+ }
+ $action->http_response_option = (string)$action->http_response_set_status_code . $status_reason;
+ $action->http_response_set_status_code = null;
+ $action->http_response_set_status_reason = null;
+ }
+ break;
+ case 'http-response_set-var':
+ $action->type = 'http-response';
+ $action->http_response_action = 'set-var';
+ if (!empty((string)$action->http_response_set_var_name)) {
+ $action->http_response_option = '(' . (string)$action->http_response_set_var_scope . '.' . (string)$action->http_response_set_var_name . ') ' . (string)$action->http_response_set_var_expr;
+ $action->http_response_set_var_scope = null;
+ $action->http_response_set_var_name = null;
+ $action->http_response_set_var_expr = null;
+ }
+ break;
+ case 'tcp-request_connection_accept':
+ $action->type = 'tcp-request';
+ $action->tcp_request_action = 'connection_accept';
+ break;
+ case 'tcp-request_connection_reject':
+ $action->type = 'tcp-request';
+ $action->tcp_request_action = 'connection_reject';
+ break;
+ case 'tcp-request_content_accept':
+ $action->type = 'tcp-request';
+ $action->tcp_request_action = 'content_accept';
+ break;
+ case 'tcp-request_content_lua':
+ $action->type = 'tcp-request';
+ $action->tcp_request_action = 'content_lua';
+ if (!empty((string)$action->tcp_request_content_lua)) {
+ $action->tcp_request_option = (string)$action->tcp_request_content_lua;
+ $action->tcp_request_content_lua = null;
+ }
+ break;
+ case 'tcp-request_content_reject':
+ $action->type = 'tcp-request';
+ $action->tcp_request_action = 'content_reject';
+ break;
+ case 'tcp-request_content_use-service':
+ $action->type = 'tcp-request';
+ $action->tcp_request_action = 'content_use-service';
+ if (!empty((string)$action->tcp_request_content_use_service)) {
+ $action->tcp_request_option = (string)$action->tcp_request_content_use_service;
+ $action->tcp_request_content_use_service = null;
+ }
+ break;
+ case 'tcp-request_inspect-delay':
+ $action->type = 'tcp-request';
+ $action->tcp_request_action = 'inspect-delay';
+ if (!empty((string)$action->tcp_request_inspect_delay)) {
+ $action->tcp_request_option = (string)$action->tcp_request_inspect_delay;
+ $action->tcp_request_inspect_delay = null;
+ }
+ break;
+ case 'tcp-response_content_accept':
+ $action->type = 'tcp-response';
+ $action->tcp_response_action = 'content_accept';
+ break;
+ case 'tcp-response_content_close':
+ $action->type = 'tcp-response';
+ $action->tcp_response_action = 'content_close';
+ break;
+ case 'tcp-response_content_lua':
+ $action->type = 'tcp-response';
+ $action->tcp_response_action = 'content_lua';
+ if (!empty((string)$action->tcp_response_content_lua)) {
+ $action->tcp_response_option = (string)$action->tcp_response_content_lua;
+ $action->tcp_response_content_lua = null;
+ }
+ break;
+ case 'tcp-response_content_reject':
+ $action->type = 'tcp-response';
+ $action->tcp_response_action = 'content_reject';
+ break;
+ case 'tcp-response_inspect-delay':
+ $action->type = 'tcp-response';
+ $action->tcp_response_action = 'inspect-delay';
+ if (!empty((string)$action->tcp_response_inspect_delay)) {
+ $action->tcp_response_option = (string)$action->tcp_response_inspect_delay;
+ $action->tcp_response_inspect_delay = null;
+ }
+ break;
+ }
+ }
+ }
+}
diff --git a/net/haproxy/src/opnsense/mvc/app/views/OPNsense/HAProxy/index.volt b/net/haproxy/src/opnsense/mvc/app/views/OPNsense/HAProxy/index.volt
index cb6eea31a4..6402371b2e 100644
--- a/net/haproxy/src/opnsense/mvc/app/views/OPNsense/HAProxy/index.volt
+++ b/net/haproxy/src/opnsense/mvc/app/views/OPNsense/HAProxy/index.volt
@@ -101,6 +101,7 @@ POSSIBILITY OF SUCH DAMAGE.
set:'/api/haproxy/settings/set_action/',
add:'/api/haproxy/settings/add_action/',
del:'/api/haproxy/settings/del_action/',
+ toggle:'/api/haproxy/settings/toggle_action/',
options: {
}
}
@@ -702,7 +703,7 @@ POSSIBILITY OF SUCH DAMAGE.
{{ lang._('Lastly, enable HAProxy using the %sService%s settings page.') | format('', '') }}
{{ lang._('Please be aware that you need to %smanually%s add the required firewall rules for all configured services.') | format('', '') }}
- {{ lang._('Further information is available in the %sofficial HAProxy documentation%s. Be sure to report bugs and request features on our %sGitHub issue page%s. Code contributions are also very welcome!') | format('', '', '', '') }}
+ {{ lang._('Further information is available in the %sofficial HAProxy documentation%s. Be sure to report bugs and request features on our %sGitHub issue page%s. Code contributions are also very welcome!') | format('', '', '', '') }}
@@ -744,7 +745,7 @@ POSSIBILITY OF SUCH DAMAGE.
{{ lang._('%sConditions:%s HAProxy is capable of extracting data from requests, responses and other connection data and match it against predefined patterns. Use these powerful patterns to compose a condition that may be used in multiple Rules.') | format('', '') }}
{{ lang._('%sRules:%s Perform a large set of actions if one or more %sConditions%s match. These Rules may be used in %sBackend Pools%s as well as %sPublic Services%s.') | format('', '', '', '', '', '', '', '') }}
- {{ lang._("For more information on HAProxy's %sACL feature%s see the %sofficial documentation%s.") | format('', '', '', '') }}
+ {{ lang._("For more information on HAProxy's %sACL feature%s see the %sofficial documentation%s.") | format('', '', '', '') }}
{{ lang._('Note that it is possible to directly add options to the HAProxy configuration by using the "option pass-through", a setting that is available for several configuration items. It allows you to implement configurations that are currently not officially supported by this plugin. It is strongly discouraged to rely on this feature. Please report missing features on our GitHub page!') | format('', '') }}
@@ -759,7 +760,7 @@ POSSIBILITY OF SUCH DAMAGE.
{{ lang._('%sGroup:%s A optional list containing one or more users. Groups usually make it easier to manage permissions for a large number of users') | format('', '') }}
{{ lang._('Note that users and groups must be selected from the Backend Pool or Public Service configuration in order to be used for authentication. In addition to this users and groups may also be used in Rules/Conditions.') }}
- {{ lang._("For more information on HAProxy's %suser/group management%s see the %sofficial documentation%s.") | format('', '', '', '') }}
+ {{ lang._("For more information on HAProxy's %suser/group management%s see the %sofficial documentation%s.") | format('', '', '', '') }}
@@ -777,7 +778,7 @@ POSSIBILITY OF SUCH DAMAGE.
{{ lang._("%sCache:%s HAProxy's cache which was designed to perform cache on small objects (favicon, css, etc.). This is a minimalist low-maintenance cache which runs in RAM.") | format('', '', '', '') }}
{{ lang._("%sPeers:%s Configure a communication channel between two HAProxy instances. This will propagate entries of any data-types in stick-tables between these HAProxy instances over TCP connections in a multi-master fashion. Useful when aiming for a seamless failover in a HA setup.") | format('', '', '', '') }}
- {{ lang._("For more details visit HAProxy's official documentation regarding the %sStatistics%s, %sCache%s and %sPeers%s features.") | format('', '', '', '', '', '') }}
+ {{ lang._("For more details visit HAProxy's official documentation regarding the %sStatistics%s, %sCache%s and %sPeers%s features.") | format('', '', '', '', '', '') }}
@@ -795,7 +796,7 @@ POSSIBILITY OF SUCH DAMAGE.
{{ lang._("%sResolvers:%s This feature allows in-depth configuration of how HAProxy handles name resolution and interacts with name resolvers (DNS). Each resolver configuration can be used in %sBackend Pools%s to apply individual name resolution configurations.") | format('', '', '', '') }}
{{ lang._("%sE-Mail Alerts:%s It is possible to send email alerts when the state of servers changes. Each configuration can be used in %sBackend Pools%s to send e-mail alerts to the configured recipient.") | format('', '', '', '') }}
- {{ lang._("For more details visit HAProxy's official documentation regarding the %sError Messages%s, %sLua Script%s and the %sMap Files%s features. More information on HAProxy's CPU Affinity is also available %shere%s, %shere%s and %shere%s. A detailed explanation of the resolvers feature can be found %shere%s.") | format('', '', '', '', '', '' ,'', '' ,'', '' ,'', '','', '') }}
+ {{ lang._("For more details visit HAProxy's official documentation regarding the %sError Messages%s, %sLua Script%s and the %sMap Files%s features. More information on HAProxy's CPU Affinity is also available %shere%s, %shere%s and %shere%s. A detailed explanation of the resolvers feature can be found %shere%s.") | format('', '', '', '', '', '' ,'', '' ,'', '' ,'', '','', '') }}
@@ -860,6 +861,7 @@ POSSIBILITY OF SUCH DAMAGE.
{{ lang._('Server ID') }} |
{{ lang._('Server Name') }} |
{{ lang._('Type') }} |
+ {{ lang._('Mode') }} |
{{ lang._('Server Address') }} |
{{ lang._('Server Port') }} |
{{ lang._('Description') }} |
@@ -910,6 +912,7 @@ POSSIBILITY OF SUCH DAMAGE.
+ | {{ lang._('Enabled') }} |
{{ lang._('Rule ID') }} |
{{ lang._('Rule Name') }} |
{{ lang._('Description') }} |
diff --git a/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/haproxy.conf b/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/haproxy.conf
index 642a84e4a6..21b83addf1 100644
--- a/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/haproxy.conf
+++ b/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/haproxy.conf
@@ -38,9 +38,50 @@
{% endif %}
{%- endmacro -%}
+{#- Macro expects an action item and checks for conditional args. #}
+{%- macro ActionConditionalArgs(action_data,action_name) -%}
+{% if action_data is defined and action_name is defined %}
+{# action_data | pprint #}
+{# # Check if the action keyword may need conditional parameters. #}
+{# # Order is important: Usually the first value needs to be the #}
+{# # GPC/GPT number, followed by the SC number, e.g. sc-inc-gpc(,). #}
+{% set action_keyword_args = '' %}
+{% if 'sc-' in action_name or '-sc' in action_name %}
+{% set action_keyword_tmp = [] %}
+{# # Check if the GPC number should be added. #}
+{% if 'gpc0' in action_name or 'gpc1' in action_name %}
+{# # Legacy syntax. #}
+{% elif 'gpc' in action_name and action_data.gpc_number|default('') != '' %}
+{% do action_keyword_tmp.append(action_data.gpc_number) %}
+{% endif %}
+{# # Check if the GPT number should be added. #}
+{% if 'gpt0' in action_name or 'gpt1' in action_name %}
+{# # Legacy syntax. #}
+{% elif 'gpt' in action_name and action_data.gpt_number|default('') != '' %}
+{% do action_keyword_tmp.append(action_data.gpt_number) %}
+{% endif %}
+{# # Check if the SC number should be added. #}
+{% if 'sc0' in action_name or 'sc1' in action_name %}
+{# # Legacy syntax. #}
+{% elif action_data.sc_number|default('') != '' %}
+{% do action_keyword_tmp.append(action_data.sc_number) %}
+{% endif %}
+{# # If parameters were found, add them to the config. #}
+{% if action_keyword_tmp|length > 0 %}
+{% set action_keyword_args = '(' ~ action_keyword_tmp|join(',') ~ ')' %}
+{% endif %}
+{% endif %}
+{{ action_keyword_args }}
+{% else %}
+# ERROR: ActionConditionalArgs called with empty data
+{% endif %}
+{%- endmacro -%}
+
{# Macro expects a CSV list of Actions and validates them. #}
{%- macro AclsAndActions(linkedData) -%}
{% if linkedData is defined %}
+{# # a list of simple boolean ACL types #}
+{% set acl_boolean_types = ['quic_enabled', 'src_is_local', 'stopping', 'wait_end'] %}
{# # remember all ACLs to avoid duplicate declarations #}
{% set acls_seen = [] %}
{% set global_action_options = [] %}
@@ -57,7 +98,7 @@
{% set acl_data = helpers.getUUID(acl) %}
{# # check if this ACL can be found in configuration #}
{% if acl_data == {} %}
- # ERROR: ACL data not found ({{acl}})
+ # ERROR: Condition data not found ({{acl}})
{% set acl_errors = acl_errors + 1 %}
{% set acl_enabled = '0' %}
{% else %}
@@ -69,36 +110,62 @@
{% endif %}
{# # check if this ACL was already defined in this scope #}
{% if acl_data.id in acls_seen %}
-{# # DEBUG: ignoring duplicate ACL {{acl_data.name}} #}
+{# # DEBUG: ignoring duplicate condition {{acl_data.name}} #}
{% continue %}
{% endif %}
{% do acls_seen.append(acl_data.id) %}
{% set acl_options = [] %}
-{% if acl_data.expression == 'http_auth' %}
-{% if acl_data.allowedUsers|default("") != "" or acl_data.allowedGroups|default("") != "" %}
-{% do acl_options.append('http_auth(acl_' ~ acl_data.id ~ ')') %}
+{% if acl_data.expression == 'cust_hdr' %}
+{% if acl_data.cust_hdr|default("") != "" and acl_data.cust_hdr_name|default("") != "" %}
+{% do acl_options.append('hdr(' ~ acl_data.cust_hdr_name ~ ')') %}
+{% if acl_data.caseSensitive|default('0') == '0' %}
+{% do acl_options.append('-i') %}
+{% endif %}
+{% do acl_options.append(acl_data.cust_hdr) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
-{% elif acl_data.expression == 'hdr_beg' %}
-{% if acl_data.hdr_beg|default("") != "" %}
-{% do acl_options.append('hdr_beg(host)') %}
+{% elif acl_data.expression == 'cust_hdr_beg' %}
+{% if acl_data.cust_hdr_beg|default("") != "" and acl_data.cust_hdr_beg_name|default("") != "" %}
+{% do acl_options.append('hdr_beg(' ~ acl_data.cust_hdr_beg_name ~ ')') %}
{% if acl_data.caseSensitive|default('0') == '0' %}
{% do acl_options.append('-i') %}
{% endif %}
-{% do acl_options.append(acl_data.hdr_beg) %}
+{% do acl_options.append(acl_data.cust_hdr_beg) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
-{% elif acl_data.expression == 'hdr_end' %}
-{% if acl_data.hdr_end|default("") != "" %}
-{% do acl_options.append('hdr_end(host)') %}
+{% elif acl_data.expression == 'cust_hdr_end' %}
+{% if acl_data.cust_hdr_end|default("") != "" and acl_data.cust_hdr_end_name|default("") %}
+{% do acl_options.append('hdr_end(' ~ acl_data.cust_hdr_end_name ~ ')') %}
{% if acl_data.caseSensitive|default('0') == '0' %}
{% do acl_options.append('-i') %}
{% endif %}
-{% do acl_options.append(acl_data.hdr_end) %}
+{% do acl_options.append(acl_data.cust_hdr_end) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'cust_hdr_reg' %}
+{% if acl_data.cust_hdr_reg|default("") != "" and acl_data.cust_hdr_reg_name|default("") != "" %}
+{% do acl_options.append('hdr_reg(' ~ acl_data.cust_hdr_reg_name ~ ')') %}
+{% if acl_data.caseSensitive|default('0') == '0' %}
+{% do acl_options.append('-i') %}
+{% endif %}
+{% do acl_options.append(acl_data.cust_hdr_reg) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'cust_hdr_sub' %}
+{% if acl_data.cust_hdr_sub|default("") != "" and acl_data.cust_hdr_sub_name|default("") != "" %}
+{% do acl_options.append('hdr_sub(' ~ acl_data.cust_hdr_sub_name ~ ')') %}
+{% if acl_data.caseSensitive|default('0') == '0' %}
+{% do acl_options.append('-i') %}
+{% endif %}
+{% do acl_options.append(acl_data.cust_hdr_sub) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
@@ -114,6 +181,28 @@
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
+{% elif acl_data.expression == 'hdr_beg' %}
+{% if acl_data.hdr_beg|default("") != "" %}
+{% do acl_options.append('hdr_beg(host)') %}
+{% if acl_data.caseSensitive|default('0') == '0' %}
+{% do acl_options.append('-i') %}
+{% endif %}
+{% do acl_options.append(acl_data.hdr_beg) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'hdr_end' %}
+{% if acl_data.hdr_end|default("") != "" %}
+{% do acl_options.append('hdr_end(host)') %}
+{% if acl_data.caseSensitive|default('0') == '0' %}
+{% do acl_options.append('-i') %}
+{% endif %}
+{% do acl_options.append(acl_data.hdr_end) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
{% elif acl_data.expression == 'hdr_reg' %}
{% if acl_data.hdr_reg|default("") != "" %}
{% do acl_options.append('hdr_reg(host)') %}
@@ -136,24 +225,29 @@
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
-{% elif acl_data.expression == 'path_beg' %}
-{% if acl_data.path_beg|default("") != "" %}
-{% do acl_options.append('path_beg') %}
-{% if acl_data.caseSensitive|default('0') == '0' %}
-{% do acl_options.append('-i') %}
-{% endif %}
-{% do acl_options.append(acl_data.path_beg) %}
+{% elif acl_data.expression == 'http_auth' %}
+{% if acl_data.allowedUsers|default("") != "" or acl_data.allowedGroups|default("") != "" %}
+{% do acl_options.append('http_auth(acl_' ~ acl_data.id ~ ')') %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
-{% elif acl_data.expression == 'path_end' %}
-{% if acl_data.path_end|default("") != "" %}
-{% do acl_options.append('path_end') %}
-{% if acl_data.caseSensitive|default('0') == '0' %}
-{% do acl_options.append('-i') %}
+{% elif acl_data.expression == 'http_method' %}
+{% if acl_data.http_method|default("") != "" %}
+{% do acl_options.append('method ' ~ acl_data.http_method|replace(',', ' ')) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'nbsrv' %}
+{% do acl_options.append('') %}
+{% if acl_data.nbsrv|default("") != "" %}
+{% if acl_data.nbsrv_backend|default("") != "" %}
+{% set nbsrv_backend_data = helpers.getUUID(acl_data.nbsrv_backend) %}
+{% do acl_options.append('nbsrv(' ~ nbsrv_backend_data.name ~ ') ge ' ~ acl_data.nbsrv) %}
+{% else %}
+{% do acl_options.append('nbsrv ge ' ~ acl_data.nbsrv) %}
{% endif %}
-{% do acl_options.append(acl_data.path_end) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
@@ -169,13 +263,13 @@
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
-{% elif acl_data.expression == 'path_reg' %}
-{% if acl_data.path_reg|default("") != "" %}
-{% do acl_options.append('path_reg') %}
+{% elif acl_data.expression == 'path_beg' %}
+{% if acl_data.path_beg|default("") != "" %}
+{% do acl_options.append('path_beg') %}
{% if acl_data.caseSensitive|default('0') == '0' %}
{% do acl_options.append('-i') %}
{% endif %}
-{% do acl_options.append(acl_data.path_reg) %}
+{% do acl_options.append(acl_data.path_beg) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
@@ -191,83 +285,1038 @@
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
-{% elif acl_data.expression == 'path_sub' %}
-{% if acl_data.path_sub|default("") != "" %}
-{% do acl_options.append('path_sub') %}
+{% elif acl_data.expression == 'path_end' %}
+{% if acl_data.path_end|default("") != "" %}
+{% do acl_options.append('path_end') %}
{% if acl_data.caseSensitive|default('0') == '0' %}
{% do acl_options.append('-i') %}
{% endif %}
-{% do acl_options.append(acl_data.path_sub) %}
+{% do acl_options.append(acl_data.path_end) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
-{% elif acl_data.expression == 'cust_hdr_beg' %}
-{% if acl_data.cust_hdr_beg|default("") != "" and acl_data.cust_hdr_beg_name|default("") != "" %}
-{% do acl_options.append('hdr_beg(' ~ acl_data.cust_hdr_beg_name ~ ')') %}
+{% elif acl_data.expression == 'path_reg' %}
+{% if acl_data.path_reg|default("") != "" %}
+{% do acl_options.append('path_reg') %}
{% if acl_data.caseSensitive|default('0') == '0' %}
{% do acl_options.append('-i') %}
{% endif %}
-{% do acl_options.append(acl_data.cust_hdr_beg) %}
+{% do acl_options.append(acl_data.path_reg) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
-{% elif acl_data.expression == 'cust_hdr_end' %}
-{% if acl_data.cust_hdr_end|default("") != "" and acl_data.cust_hdr_end_name|default("") %}
-{% do acl_options.append('hdr_end(' ~ acl_data.cust_hdr_end_name ~ ')') %}
+{% elif acl_data.expression == 'path_sub' %}
+{% if acl_data.path_sub|default("") != "" %}
+{% do acl_options.append('path_sub') %}
{% if acl_data.caseSensitive|default('0') == '0' %}
{% do acl_options.append('-i') %}
{% endif %}
-{% do acl_options.append(acl_data.cust_hdr_end) %}
+{% do acl_options.append(acl_data.path_sub) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
-{% elif acl_data.expression == 'cust_hdr' %}
-{% if acl_data.cust_hdr|default("") != "" and acl_data.cust_hdr_name|default("") != "" %}
-{% do acl_options.append('hdr(' ~ acl_data.cust_hdr_name ~ ')') %}
-{% if acl_data.caseSensitive|default('0') == '0' %}
-{% do acl_options.append('-i') %}
+{% elif acl_data.expression == 'sc_bytes_in_rate' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.sc_bytes_in_rate|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
{% endif %}
-{% do acl_options.append(acl_data.cust_hdr) %}
+{% do acl_options.append('sc_bytes_in_rate(' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_bytes_in_rate_comparison ~ ' ' ~ acl_data.sc_bytes_in_rate) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
-{% elif acl_data.expression == 'cust_hdr_reg' %}
-{% if acl_data.cust_hdr_reg|default("") != "" and acl_data.cust_hdr_reg_name|default("") != "" %}
-{% do acl_options.append('hdr_reg(' ~ acl_data.cust_hdr_reg_name ~ ')') %}
-{% if acl_data.caseSensitive|default('0') == '0' %}
-{% do acl_options.append('-i') %}
+{% elif acl_data.expression == 'sc_bytes_out_rate' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.sc_bytes_out_rate|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
{% endif %}
-{% do acl_options.append(acl_data.cust_hdr_reg) %}
+{% do acl_options.append('sc_bytes_out_rate(' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_bytes_out_rate_comparison ~ ' ' ~ acl_data.sc_bytes_out_rate) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
-{% elif acl_data.expression == 'cust_hdr_sub' %}
-{% if acl_data.cust_hdr_sub|default("") != "" and acl_data.cust_hdr_sub_name|default("") != "" %}
-{% do acl_options.append('hdr_sub(' ~ acl_data.cust_hdr_sub_name ~ ')') %}
-{% if acl_data.caseSensitive|default('0') == '0' %}
-{% do acl_options.append('-i') %}
+{% elif acl_data.expression == 'sc_clr_gpc' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.gpc_number|default("") != "" and acl_data.sc_clr_gpc|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
{% endif %}
-{% do acl_options.append(acl_data.cust_hdr_sub) %}
+{% do acl_options.append('sc_clr_gpc(' ~ acl_data.gpc_number ~ ',' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_clr_gpc_comparison ~ ' ' ~ acl_data.sc_clr_gpc) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_clr_gpc0' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.sc_clr_gpc0|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_clr_gpc0(' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_clr_gpc0_comparison ~ ' ' ~ acl_data.sc_clr_gpc0) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_clr_gpc1' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.sc_clr_gpc1|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_clr_gpc1(' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_clr_gpc1_comparison ~ ' ' ~ acl_data.sc_clr_gpc1) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc0_clr_gpc0' %}
+{% if acl_data.sc0_clr_gpc0|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc0_clr_gpc0' ~ table_data ~ ' ' ~ acl_data.sc0_clr_gpc0_comparison ~ ' ' ~ acl_data.sc0_clr_gpc0) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc0_clr_gpc1' %}
+{% if acl_data.sc0_clr_gpc1|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc0_clr_gpc1' ~ table_data ~ ' ' ~ acl_data.sc0_clr_gpc1_comparison ~ ' ' ~ acl_data.sc0_clr_gpc1) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc1_clr_gpc' %}
+{% if acl_data.sc1_clr_gpc|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc1_clr_gpc' ~ table_data ~ ' ' ~ acl_data.sc1_clr_gpc_comparison ~ ' ' ~ acl_data.sc1_clr_gpc) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc1_clr_gpc0' %}
+{% if acl_data.sc1_clr_gpc0|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc1_clr_gpc0' ~ table_data ~ ' ' ~ acl_data.sc1_clr_gpc0_comparison ~ ' ' ~ acl_data.sc1_clr_gpc0) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc1_clr_gpc1' %}
+{% if acl_data.sc1_clr_gpc1|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc1_clr_gpc1' ~ table_data ~ ' ' ~ acl_data.sc1_clr_gpc1_comparison ~ ' ' ~ acl_data.sc1_clr_gpc1) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc2_clr_gpc' %}
+{% if acl_data.sc2_clr_gpc|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc2_clr_gpc' ~ table_data ~ ' ' ~ acl_data.sc2_clr_gpc_comparison ~ ' ' ~ acl_data.sc2_clr_gpc) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc2_clr_gpc0' %}
+{% if acl_data.sc2_clr_gpc0|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc2_clr_gpc0' ~ table_data ~ ' ' ~ acl_data.sc2_clr_gpc0_comparison ~ ' ' ~ acl_data.sc2_clr_gpc0) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc2_clr_gpc1' %}
+{% if acl_data.sc2_clr_gpc1|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc2_clr_gpc1' ~ table_data ~ ' ' ~ acl_data.sc2_clr_gpc1_comparison ~ ' ' ~ acl_data.sc2_clr_gpc1) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_conn_cnt' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.sc_conn_cnt|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_conn_cnt(' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_conn_cnt_comparison ~ ' ' ~ acl_data.sc_conn_cnt) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_conn_cur' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.sc_conn_cur|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_conn_cur(' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_conn_cur_comparison ~ ' ' ~ acl_data.sc_conn_cur) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_conn_rate' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.sc_conn_rate|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_conn_rate(' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_conn_rate_comparison ~ ' ' ~ acl_data.sc_conn_rate) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_get_gpc' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.gpc_number|default("") != "" and acl_data.sc_get_gpc|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_get_gpc(' ~ acl_data.gpc_number ~ ',' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_get_gpc_comparison ~ ' ' ~ acl_data.sc_get_gpc) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_get_gpc0' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.sc_get_gpc0|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_get_gpc0(' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_get_gpc0_comparison ~ ' ' ~ acl_data.sc_get_gpc0) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_get_gpc1' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.sc_get_gpc1|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_get_gpc1(' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_get_gpc1_comparison ~ ' ' ~ acl_data.sc_get_gpc1) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc0_get_gpc0' %}
+{% if acl_data.sc0_get_gpc0|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc0_get_gpc0' ~ table_data ~ ' ' ~ acl_data.sc0_get_gpc0_comparison ~ ' ' ~ acl_data.sc0_get_gpc0) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
-{% elif acl_data.expression == 'url_param' %}
-{% if acl_data.url_param_value|default("") != "" and acl_data.url_param|default("") != "" %}
-{% do acl_options.append('url_param(' ~ acl_data.url_param ~ ')') %}
-{% if acl_data.caseSensitive|default('0') == '0' %}
-{% do acl_options.append('-i') %}
-{% endif %}
-{% do acl_options.append(acl_data.url_param_value) %}
+{% elif acl_data.expression == 'sc0_get_gpc1' %}
+{% if acl_data.sc0_get_gpc1|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc0_get_gpc1' ~ table_data ~ ' ' ~ acl_data.sc0_get_gpc1_comparison ~ ' ' ~ acl_data.sc0_get_gpc1) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc1_get_gpc0' %}
+{% if acl_data.sc1_get_gpc0|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc1_get_gpc0' ~ table_data ~ ' ' ~ acl_data.sc1_get_gpc0_comparison ~ ' ' ~ acl_data.sc1_get_gpc0) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc1_get_gpc1' %}
+{% if acl_data.sc1_get_gpc1|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc1_get_gpc1' ~ table_data ~ ' ' ~ acl_data.sc1_get_gpc1_comparison ~ ' ' ~ acl_data.sc1_get_gpc1) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc2_get_gpc0' %}
+{% if acl_data.sc2_get_gpc0|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc2_get_gpc0' ~ table_data ~ ' ' ~ acl_data.sc2_get_gpc0_comparison ~ ' ' ~ acl_data.sc2_get_gpc0) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc2_get_gpc1' %}
+{% if acl_data.sc2_get_gpc1|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc2_get_gpc1' ~ table_data ~ ' ' ~ acl_data.sc2_get_gpc1_comparison ~ ' ' ~ acl_data.sc2_get_gpc1) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_get_gpt' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.gpt_number|default("") != "" and acl_data.sc_get_gpt|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_get_gpt(' ~ acl_data.gpt_number ~ ',' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_get_gpt_comparison ~ ' ' ~ acl_data.sc_get_gpt) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_get_gpt0' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.sc_get_gpt0|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_get_gpt0(' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_get_gpt0_comparison ~ ' ' ~ acl_data.sc_get_gpt0) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc0_get_gpt0' %}
+{% if acl_data.sc0_get_gpt0|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc0_get_gpt0' ~ table_data ~ ' ' ~ acl_data.sc0_get_gpt0_comparison ~ ' ' ~ acl_data.sc0_get_gpt0) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc1_get_gpt0' %}
+{% if acl_data.sc1_get_gpt0|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc1_get_gpt0' ~ table_data ~ ' ' ~ acl_data.sc1_get_gpt0_comparison ~ ' ' ~ acl_data.sc1_get_gpt0) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc2_get_gpt0' %}
+{% if acl_data.sc2_get_gpt0|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc2_get_gpt0' ~ table_data ~ ' ' ~ acl_data.sc2_get_gpt0_comparison ~ ' ' ~ acl_data.sc2_get_gpt0) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_glitch_cnt' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.sc_glitch_cnt|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_glitch_cnt(' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_glitch_cnt_comparison ~ ' ' ~ acl_data.sc_glitch_cnt) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_glitch_rate' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.sc_glitch_rate|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_glitch_rate(' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_glitch_rate_comparison ~ ' ' ~ acl_data.sc_glitch_rate) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_gpc_rate' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.gpc_number|default("") != "" and acl_data.sc_gpc_rate|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_gpc_rate(' ~ acl_data.gpc_number ~ ',' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_gpc_rate_comparison ~ ' ' ~ acl_data.sc_gpc_rate) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_gpc0_rate' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.sc_gpc0_rate|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_gpc0_rate(' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_gpc0_rate_comparison ~ ' ' ~ acl_data.sc_gpc0_rate) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_gpc1_rate' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.sc_gpc1_rate|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_gpc1_rate(' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_gpc1_rate_comparison ~ ' ' ~ acl_data.sc_gpc1_rate) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc0_gpc0_rate' %}
+{% if acl_data.sc0_gpc0_rate|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc0_gpc0_rate' ~ table_data ~ ' ' ~ acl_data.sc0_gpc0_rate_comparison ~ ' ' ~ acl_data.sc0_gpc0_rate) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc0_gpc1_rate' %}
+{% if acl_data.sc0_gpc1_rate|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc0_gpc1_rate' ~ table_data ~ ' ' ~ acl_data.sc0_gpc1_rate_comparison ~ ' ' ~ acl_data.sc0_gpc1_rate) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc1_gpc0_rate' %}
+{% if acl_data.sc1_gpc0_rate|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc1_gpc0_rate' ~ table_data ~ ' ' ~ acl_data.sc1_gpc0_rate_comparison ~ ' ' ~ acl_data.sc1_gpc0_rate) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc1_gpc1_rate' %}
+{% if acl_data.sc1_gpc1_rate|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc1_gpc1_rate' ~ table_data ~ ' ' ~ acl_data.sc1_gpc1_rate_comparison ~ ' ' ~ acl_data.sc1_gpc1_rate) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc2_gpc0_rate' %}
+{% if acl_data.sc2_gpc0_rate|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc2_gpc0_rate' ~ table_data ~ ' ' ~ acl_data.sc2_gpc0_rate_comparison ~ ' ' ~ acl_data.sc2_gpc0_rate) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc2_gpc1_rate' %}
+{% if acl_data.sc2_gpc1_rate|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc2_gpc1_rate' ~ table_data ~ ' ' ~ acl_data.sc2_gpc1_rate_comparison ~ ' ' ~ acl_data.sc2_gpc1_rate) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_http_err_cnt' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.sc_http_err_cnt|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_http_err_cnt(' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_http_err_cnt_comparison ~ ' ' ~ acl_data.sc_http_err_cnt) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_http_err_rate' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.sc_http_err_rate|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_http_err_rate(' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_http_err_rate_comparison ~ ' ' ~ acl_data.sc_http_err_rate) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_http_fail_cnt' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.sc_http_fail_cnt|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_http_fail_cnt(' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_http_fail_cnt_comparison ~ ' ' ~ acl_data.sc_http_fail_cnt) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_http_fail_rate' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.sc_http_fail_rate|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_http_fail_rate(' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_http_fail_rate_comparison ~ ' ' ~ acl_data.sc_http_fail_rate) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_http_req_cnt' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.sc_http_req_cnt|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_http_req_cnt(' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_http_req_cnt_comparison ~ ' ' ~ acl_data.sc_http_req_cnt) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_http_req_rate' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.sc_http_req_rate|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_http_req_rate(' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_http_req_rate_comparison ~ ' ' ~ acl_data.sc_http_req_rate) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_inc_gpc' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.gpc_number|default("") != "" and acl_data.sc_inc_gpc|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_inc_gpc(' ~ acl_data.gpc_number ~ ',' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_inc_gpc_comparison ~ ' ' ~ acl_data.sc_inc_gpc) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_inc_gpc0' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.sc_inc_gpc0|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_inc_gpc0(' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_inc_gpc0_comparison ~ ' ' ~ acl_data.sc_inc_gpc0) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_inc_gpc1' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.sc_inc_gpc1|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_inc_gpc1(' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_inc_gpc1_comparison ~ ' ' ~ acl_data.sc_inc_gpc1) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc0_inc_gpc0' %}
+{% if acl_data.sc0_inc_gpc0|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc0_inc_gpc0' ~ table_data ~ ' ' ~ acl_data.sc0_inc_gpc0_comparison ~ ' ' ~ acl_data.sc0_inc_gpc0) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc0_inc_gpc1' %}
+{% if acl_data.sc0_inc_gpc1|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc0_inc_gpc1' ~ table_data ~ ' ' ~ acl_data.sc0_inc_gpc1_comparison ~ ' ' ~ acl_data.sc0_inc_gpc1) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc1_inc_gpc0' %}
+{% if acl_data.sc1_inc_gpc0|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc1_inc_gpc0' ~ table_data ~ ' ' ~ acl_data.sc1_inc_gpc0_comparison ~ ' ' ~ acl_data.sc1_inc_gpc0) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc1_inc_gpc1' %}
+{% if acl_data.sc1_inc_gpc1|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc1_inc_gpc1' ~ table_data ~ ' ' ~ acl_data.sc1_inc_gpc1_comparison ~ ' ' ~ acl_data.sc1_inc_gpc1) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc2_inc_gpc0' %}
+{% if acl_data.sc2_inc_gpc0|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc2_inc_gpc0' ~ table_data ~ ' ' ~ acl_data.sc2_inc_gpc0_comparison ~ ' ' ~ acl_data.sc2_inc_gpc0) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc2_inc_gpc1' %}
+{% if acl_data.sc2_inc_gpc1|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc2_inc_gpc1' ~ table_data ~ ' ' ~ acl_data.sc2_inc_gpc1_comparison ~ ' ' ~ acl_data.sc2_inc_gpc1) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_sess_cnt' %}
+{% if acl_data.sc_number|default("") != "" %}
+{% if acl_data.table_name|default("") != "" and acl_data.sc_sess_cnt|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_sess_cnt(' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_sess_cnt_comparison ~ ' ' ~ acl_data.sc_sess_cnt) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'sc_sess_rate' %}
+{% if acl_data.sc_number|default("") != "" and acl_data.sc_sess_rate|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('sc_sess_rate(' ~ acl_data.sc_number ~ table_data ~ ') ' ~ acl_data.sc_sess_rate_comparison ~ ' ' ~ acl_data.sc_sess_rate) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'src' %}
+{% do acl_options.append('src') %}
+{# # optional source IP #}
+{% if acl_data.src|default("") != "" %}
+{% do acl_options.append(acl_data.src) %}
+{% endif %}
+{% elif acl_data.expression == 'src_bytes_in_rate' %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('src_bytes_in_rate' ~ table_data ~ ' ' ~ acl_data.src_bytes_in_rate_comparison ~ ' ' ~ acl_data.src_bytes_in_rate) %}
+{% elif acl_data.expression == 'src_bytes_out_rate' %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('src_bytes_out_rate' ~ table_data ~ ' ' ~ acl_data.src_bytes_out_rate_comparison ~ ' ' ~ acl_data.src_bytes_out_rate) %}
+{% elif acl_data.expression == 'src_clr_gpc' %}
+{% if acl_data.gpc_number|default("") != "" and acl_data.src_clr_gpc|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('src_clr_gpc(' ~ acl_data.gpc_number ~ table_data ~ ') ' ~ acl_data.src_clr_gpc_comparison ~ ' ' ~ acl_data.src_clr_gpc) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'src_clr_gpc0' %}
+{% if acl_data.src_clr_gpc0|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('src_clr_gpc0' ~ table_data ~ ' ' ~ acl_data.src_clr_gpc0_comparison ~ ' ' ~ acl_data.src_clr_gpc0) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'src_clr_gpc1' %}
+{% if acl_data.src_clr_gpc1|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('src_clr_gpc1' ~ table_data ~ ' ' ~ acl_data.src_clr_gpc1_comparison ~ ' ' ~ acl_data.src_clr_gpc1) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'src_conn_cnt' %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ') ' %}
+{% else %}
+{% set table_data = ' ' %}
+{% endif %}
+{% do acl_options.append('src_conn_cnt' ~ table_data ~ acl_data.src_conn_cnt_comparison ~ ' ' ~ acl_data.src_conn_cnt) %}
+{% elif acl_data.expression == 'src_conn_cur' %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ') ' %}
+{% else %}
+{% set table_data = ' ' %}
+{% endif %}
+{% do acl_options.append('src_conn_cur' ~ table_data ~ acl_data.src_conn_cur_comparison ~ ' ' ~ acl_data.src_conn_cur) %}
+{% elif acl_data.expression == 'src_conn_rate' %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ') ' %}
+{% else %}
+{% set table_data = ' ' %}
+{% endif %}
+{% do acl_options.append('src_conn_rate' ~ table_data ~ acl_data.src_conn_rate_comparison ~ ' ' ~ acl_data.src_conn_rate) %}
+{% elif acl_data.expression == 'src_get_gpc' %}
+{% if acl_data.gpc_number|default("") != "" and acl_data.src_get_gpc|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('src_get_gpc(' ~ acl_data.gpc_number ~ table_data ~ ') ' ~ acl_data.src_get_gpc_comparison ~ ' ' ~ acl_data.src_get_gpc) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'src_get_gpc0' %}
+{% if acl_data.src_get_gpc0|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('src_get_gpc0' ~ table_data ~ ' ' ~ acl_data.src_get_gpc0_comparison ~ ' ' ~ acl_data.src_get_gpc0) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'src_get_gpc1' %}
+{% if acl_data.src_get_gpc1|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('src_get_gpc1' ~ table_data ~ ' ' ~ acl_data.src_get_gpc1_comparison ~ ' ' ~ acl_data.src_get_gpc1) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'src_get_gpt' %}
+{% if acl_data.gpt_number|default("") != "" and acl_data.src_get_gpt|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('src_get_gpt(' ~ acl_data.gpt_number ~ table_data ~ ') ' ~ acl_data.src_get_gpt_comparison ~ ' ' ~ acl_data.src_get_gpt) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'src_glitch_cnt' %}
+{% if acl_data.src_glitch_cnt|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('src_glitch_cnt' ~ table_data ~ ' ' ~ acl_data.src_glitch_cnt_comparison ~ ' ' ~ acl_data.src_glitch_cnt) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'src_glitch_rate' %}
+{% if acl_data.src_glitch_rate|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('src_glitch_rate' ~ table_data ~ ' ' ~ acl_data.src_glitch_rate_comparison ~ ' ' ~ acl_data.src_glitch_rate) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'src_gpc_rate' %}
+{% if acl_data.gpc_number|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('src_gpc_rate(' ~ acl_data.gpc_number ~ table_data ~ ') ' ~ acl_data.src_gpc_rate_comparison ~ ' ' ~ acl_data.src_gpc_rate) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'src_gpc0_rate' %}
+{% if acl_data.src_gpc0_rate|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('src_gpc0_rate' ~ table_data ~ ' ' ~ acl_data.src_gpc0_rate_comparison ~ ' ' ~ acl_data.src_gpc0_rate) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'src_gpc1_rate' %}
+{% if acl_data.src_gpc1_rate|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('src_gpc1_rate' ~ table_data ~ ' ' ~ acl_data.src_gpc1_rate_comparison ~ ' ' ~ acl_data.src_gpc1_rate) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'src_http_err_cnt' %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('src_http_err_cnt' ~ table_data ~ ' ' ~ acl_data.src_http_err_cnt_comparison ~ ' ' ~ acl_data.src_http_err_cnt) %}
+{% elif acl_data.expression == 'src_http_err_rate' %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = ' ' %}
+{% endif %}
+{% do acl_options.append('src_http_err_rate' ~ tabel_data ~ ' ' ~ acl_data.src_http_err_rate_comparison ~ ' ' ~ acl_data.src_http_err_rate) %}
+{% elif acl_data.expression == 'src_http_fail_cnt' %}
+{% if acl_data.src_http_fail_cnt|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('src_http_fail_cnt' ~ table_data ~ ' ' ~ acl_data.src_http_fail_cnt_comparison ~ ' ' ~ acl_data.src_http_fail_cnt) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'src_http_fail_rate' %}
+{% if acl_data.src_http_fail_rate|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('src_http_fail_rate' ~ table_data ~ ' ' ~ acl_data.src_http_fail_rate_comparison ~ ' ' ~ acl_data.src_http_fail_rate) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'src_http_req_cnt' %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = ' ' %}
+{% endif %}
+{% do acl_options.append('src_http_req_cnt' ~ table_data ~ ' ' ~ acl_data.src_http_req_cnt_comparison ~ ' ' ~ acl_data.src_http_req_cnt) %}
+{% elif acl_data.expression == 'src_http_req_rate' %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = ' ' %}
+{% endif %}
+{% do acl_options.append('src_http_req_rate' ~ table_data ~ ' ' ~ acl_data.src_http_req_rate_comparison ~ ' ' ~ acl_data.src_http_req_rate) %}
+{% elif acl_data.expression == 'src_inc_gpc' %}
+{% if acl_data.gpc_number|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = ',' ~ acl_data.table_name %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('src_inc_gpc(' ~ acl_data.gpc_number ~ table_data ~ ') ' ~ acl_data.src_inc_gpc_comparison ~ ' ' ~ acl_data.src_inc_gpc ) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'src_inc_gpc0' %}
+{% if acl_data.src_inc_gpc0|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('src_inc_gpc0' ~ table_data ~ ' ' ~ acl_data.src_inc_gpc0_comparison ~ ' ' ~ acl_data.src_inc_gpc0) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'src_inc_gpc1' %}
+{% if acl_data.src_inc_gpc1|default("") != "" %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = '' %}
+{% endif %}
+{% do acl_options.append('src_inc_gpc1' ~ table_data ~ ' ' ~ acl_data.src_inc_gpc1_comparison ~ ' ' ~ acl_data.src_inc_gpc1) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{% elif acl_data.expression == 'src_kbytes_in' %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = ' ' %}
+{% endif %}
+{% do acl_options.append('src_kbytes_in' ~ table_data ~ ' ' ~ acl_data.src_kbytes_in_comparison ~ ' ' ~ acl_data.src_kbytes_in) %}
+{% elif acl_data.expression == 'src_kbytes_out' %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = ' ' %}
+{% endif %}
+{% do acl_options.append('src_kbytes_out' ~ table_data ~ ' ' ~ acl_data.src_kbytes_out_comparison ~ ' ' ~ acl_data.src_kbytes_out) %}
+{% elif acl_data.expression == 'src_port' %}
+{% do acl_options.append('src_port ' ~ acl_data.src_port_comparison ~ ' ' ~ acl_data.src_port) %}
+{% elif acl_data.expression == 'src_sess_cnt' %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
+{% else %}
+{% set table_data = ' ' %}
+{% endif %}
+{% do acl_options.append('src_sess_cnt' ~ table_data ~ ' ' ~ acl_data.src_sess_cnt_comparison ~ ' ' ~ acl_data.src_sess_cnt) %}
+{% elif acl_data.expression == 'src_sess_rate' %}
+{% if acl_data.table_name|default("") != "" %}
+{% set table_data = '(' ~ acl_data.table_name ~ ')' %}
{% else %}
-{% set acl_enabled = '0' %}
- # ERROR: missing parameters
+{% set table_data = ' ' %}
{% endif %}
+{% do acl_options.append('src_sess_rate' ~ table_data ~ ' ' ~ acl_data.src_sess_rate_comparison ~ ' ' ~ acl_data.src_sess_rate) %}
{% elif acl_data.expression == 'ssl_c_verify_code' %}
{% if acl_data.ssl_c_verify_code|default("") != "" %}
{% do acl_options.append('ssl_c_verify ' ~ acl_data.ssl_c_verify_code) %}
@@ -284,62 +1333,6 @@
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
-{% elif acl_data.expression == 'ssl_hello_type' %}
-{% do acl_options.append('req.ssl_hello_type ' ~ acl_data.ssl_hello_type|replace('x', '')) %}
-{% elif acl_data.expression == 'src' %}
-{% if acl_data.src|default("") != "" %}
-{% do acl_options.append('src ' ~ acl_data.src) %}
-{% else %}
-{% set acl_enabled = '0' %}
- # ERROR: missing parameters
-{% endif %}
-{% elif acl_data.expression == 'src_is_local' %}
-{% do acl_options.append('src_is_local') %}
-{% elif acl_data.expression == 'src_bytes_in_rate' %}
-{% do acl_options.append('src_bytes_in_rate ' ~ acl_data.src_bytes_in_rate_comparison ~ ' ' ~ acl_data.src_bytes_in_rate) %}
-{% elif acl_data.expression == 'src_bytes_out_rate' %}
-{% do acl_options.append('src_bytes_out_rate ' ~ acl_data.src_bytes_out_rate_comparison ~ ' ' ~ acl_data.src_bytes_out_rate) %}
-{% elif acl_data.expression == 'src_conn_cnt' %}
-{% do acl_options.append('src_conn_cnt ' ~ acl_data.src_conn_cnt_comparison ~ ' ' ~ acl_data.src_conn_cnt) %}
-{% elif acl_data.expression == 'src_conn_cur' %}
-{% do acl_options.append('src_conn_cur ' ~ acl_data.src_conn_cur_comparison ~ ' ' ~ acl_data.src_conn_cur) %}
-{% elif acl_data.expression == 'src_conn_rate' %}
-{% do acl_options.append('src_conn_rate ' ~ acl_data.src_conn_rate_comparison ~ ' ' ~ acl_data.src_conn_rate) %}
-{% elif acl_data.expression == 'src_http_err_cnt' %}
-{% do acl_options.append('src_http_err_cnt ' ~ acl_data.src_http_err_cnt_comparison ~ ' ' ~ acl_data.src_http_err_cnt) %}
-{% elif acl_data.expression == 'src_http_err_rate' %}
-{% do acl_options.append('src_http_err_rate ' ~ acl_data.src_http_err_rate_comparison ~ ' ' ~ acl_data.src_http_err_rate) %}
-{% elif acl_data.expression == 'src_http_req_cnt' %}
-{% do acl_options.append('src_http_req_cnt ' ~ acl_data.src_http_req_cnt_comparison ~ ' ' ~ acl_data.src_http_req_cnt) %}
-{% elif acl_data.expression == 'src_http_req_rate' %}
-{% do acl_options.append('src_http_req_rate ' ~ acl_data.src_http_req_rate_comparison ~ ' ' ~ acl_data.src_http_req_rate) %}
-{% elif acl_data.expression == 'src_kbytes_in' %}
-{% do acl_options.append('src_kbytes_in ' ~ acl_data.src_kbytes_in_comparison ~ ' ' ~ acl_data.src_kbytes_in) %}
-{% elif acl_data.expression == 'src_kbytes_out' %}
-{% do acl_options.append('src_kbytes_out ' ~ acl_data.src_kbytes_out_comparison ~ ' ' ~ acl_data.src_kbytes_out) %}
-{% elif acl_data.expression == 'src_port' %}
-{% do acl_options.append('src_port ' ~ acl_data.src_port_comparison ~ ' ' ~ acl_data.src_port) %}
-{% elif acl_data.expression == 'src_sess_cnt' %}
-{% do acl_options.append('src_sess_cnt' ~ acl_data.src_sess_cnt_comparison ~ ' ' ~ acl_data.src_sess_cnt) %}
-{% elif acl_data.expression == 'src_sess_rate' %}
-{% do acl_options.append('src_sess_rate ' ~ acl_data.src_sess_rate_comparison ~ ' ' ~ acl_data.src_sess_rate) %}
-{% elif acl_data.expression == 'nbsrv' %}
-{% do acl_options.append('') %}
-{% if acl_data.nbsrv|default("") != "" %}
-{% if acl_data.nbsrv_backend|default("") != "" %}
-{% set nbsrv_backend_data = helpers.getUUID(acl_data.nbsrv_backend) %}
-{% do acl_options.append('nbsrv(' ~ nbsrv_backend_data.name ~ ') ge ' ~ acl_data.nbsrv) %}
-{% else %}
-{% do acl_options.append('nbsrv ge ' ~ acl_data.nbsrv) %}
-{% endif %}
-{% else %}
-{% set acl_enabled = '0' %}
- # ERROR: missing parameters
-{% endif %}
-{% elif acl_data.expression == 'traffic_is_http' %}
-{% do acl_options.append('req.proto_http') %}
-{% elif acl_data.expression == 'traffic_is_ssl' %}
-{% do acl_options.append('req.ssl_ver gt 0') %}
{% elif acl_data.expression == 'ssl_fc' %}
{% do acl_options.append('ssl_fc') %}
{% elif acl_data.expression == 'ssl_fc_sni' %}
@@ -349,6 +1342,8 @@
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
+{% elif acl_data.expression == 'ssl_hello_type' %}
+{% do acl_options.append('req.ssl_hello_type ' ~ acl_data.ssl_hello_type|replace('x', '')) %}
{% elif acl_data.expression == 'ssl_sni' %}
{% if acl_data.ssl_sni|default("") != "" %}
{% do acl_options.append('req.ssl_sni') %}
@@ -404,6 +1399,25 @@
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
+{% elif acl_data.expression == 'traffic_is_http' %}
+{% do acl_options.append('req.proto_http') %}
+{% elif acl_data.expression == 'traffic_is_ssl' %}
+{% do acl_options.append('req.ssl_ver gt 0') %}
+{% elif acl_data.expression == 'url_param' %}
+{% if acl_data.url_param_value|default("") != "" and acl_data.url_param|default("") != "" %}
+{% do acl_options.append('url_param(' ~ acl_data.url_param ~ ')') %}
+{% if acl_data.caseSensitive|default('0') == '0' %}
+{% do acl_options.append('-i') %}
+{% endif %}
+{% do acl_options.append(acl_data.url_param_value) %}
+{% else %}
+{% set acl_enabled = '0' %}
+ # ERROR: missing parameters
+{% endif %}
+{# # handle boolean ACL types that do not require any input #}
+{% elif acl_data.expression in acl_boolean_types %}
+{% do acl_options.append(acl_data.expression) %}
+{# # handle custom ACL types #}
{% elif acl_data.expression == 'custom_acl' %}
{% if acl_data.custom_acl|default("") != "" %}
{% do acl_options.append(acl_data.custom_acl) %}
@@ -413,16 +1427,22 @@
{% endif %}
{% else %}
{% set acl_enabled = '0' %}
- # ERROR: unsupported ACL expression
+ # ERROR: unsupported expression in condition
+{% endif %}
+{# # load ACL pattern from mapfile #}
+{% if acl_data.mapfile|default("") != "" %}
+{% set mapfile_data = helpers.getUUID(acl_data.mapfile) %}
+{% set mapfile_path = '/tmp/haproxy/mapfiles/' ~ mapfile_data.id ~ '.txt' %}
+{% do acl_options.append('-f ' ~ mapfile_path) %}
{% endif %}
{% endif %}
{# # check if ACL is valid #}
{% if acl_enabled == '1' %}
- # ACL: {{acl_data.name}}
+ # CONDITION: {{acl_data.name}}
acl acl_{{acl_data.id}} {{acl_options|join(' ')}}
{% else %}
{% set acl_errors = acl_errors + 1 %}
- # ACL INVALID: {{acl_data.name}} ({{acl}})
+ # CONDITION INVALID: {{acl_data.name}} ({{acl}})
{% endif %}
{% endfor %}
{% endif %}
@@ -430,201 +1450,155 @@
{# # because doing otherwise would lead to unpredictable behaviour. #}
{% if acl_errors|int == 0 %}
{% set action_enabled = '1' %}
+{% set action_multiline = '0' %}
{% set action_options = [] %}
-{% if action_data.type == 'use_backend' %}
-{% if action_data.use_backend|default("") != "" %}
-{% set acl_backend_data = helpers.getUUID(action_data.use_backend) %}
-{% do action_options.append('use_backend ' ~ acl_backend_data.name) %}
-{% else %}
-{% set action_enabled = '0' %}
- # ERROR: missing parameters
-{% endif %}
-{% elif action_data.type == 'use_server' %}
-{% if action_data.use_server|default("") != "" %}
-{% set server_data = helpers.getUUID(action_data.use_server) %}
-{% do action_options.append('use-server ' ~ server_data.name) %}
+{% if action_data.type == 'compression' %}
+{% set action_multiline = '1' %}
+{% if action_data.compression_mime_resp|default("") != "" or action_data.compression_mime_req|default("") != "" %}
+{% do action_options.append('filter compression') %}
+{% do action_options.append('compression direction ' ~ action_data.compression_direction) %}
+{% if action_data.compression_direction|default("") == "response" or action_data.compression_direction|default("") == "both" %}
+{% do action_options.append('compression algo-res ' ~ action_data.compression_algo_res) %}
+{% if action_data.compression_mime_res|default("") != "" %}
+{% do action_options.append('compression type-res ' ~ action_data.compression_mime_res|replace(",", " ")) %}
+{% endif %}
+{% if action_data.compression_minsize_res|default("") != "0" %}
+{% do action_options.append('compression minsize-res ' ~ action_data.compression_minsize_res) %}
+{% endif %}
+{% endif %}
+{% if action_data.compression_direction|default("") == "request" or action_data.compression_direction|default("") == "both" %}
+{% do action_options.append('compression algo-req ' ~ action_data.compression_algo_req) %}
+{% if action_data.compression_mime_req|default("") != "" %}
+{% do action_options.append('compression type-req ' ~ action_data.compression_mime_req|replace(",", " ")) %}
+{% endif %}
+{% if action_data.compression_minsize_req|default("") != "0" %}
+{% do action_options.append('compression minsize-req ' ~ action_data.compression_minsize_req) %}
+{% endif %}
+{% endif %}
+{% if action_data.compression_offloading|default("") == "1" %}
+{% do action_options.append('compression offload') %}
+{% endif %}
{% else %}
{% set action_enabled = '0' %}
- # ERROR: missing parameters
+{% do global_action_options.append('# ERROR: missing parameters') %}
{% endif %}
-{% elif action_data.type == 'map_use_backend' %}
-{# # First get the map file path #}
-{% if action_data.map_use_backend_file|default("") != "" %}
-{% set mapfile_data = helpers.getUUID(action_data.map_use_backend_file) %}
-{% set mapfile_path = '/tmp/haproxy/mapfiles/' ~ mapfile_data.id ~ '.txt' %}
-{# # Check if a default backend is specified #}
-{% if action_data.map_use_backend_default|default("") != "" %}
-{% set defaultbackend_data = helpers.getUUID(action_data.map_use_backend_default) %}
-{% set defaultbackend_option = ',' ~ defaultbackend_data.name %}
-{% else %}
-{% set defaultbackend_option = '' %}
-{% endif %}
-{# # Finally add map file to config #}
-{% do action_options.append('use_backend %[req.hdr(host),lower,map_dom(' ~ mapfile_path ~ defaultbackend_option ~ ')]') %}
+{% elif action_data.type == 'custom' %}
+{% if action_data.custom|default("") != "" %}
+{% do action_options.append(action_data.custom) %}
{% else %}
{% set action_enabled = '0' %}
- # ERROR: missing parameters
+{% do global_action_options.append('# ERROR: missing parameters') %}
{% endif %}
{% elif action_data.type == 'fcgi_pass_header' %}
{% if action_data.fcgi_pass_header|default('') != '' %}
{% do action_options.append('pass-header ' ~ action_data.fcgi_pass_header) %}
{% else %}
{% set action_enabled = '0' %}
- # ERROR: missing parameters
+{% do global_action_options.append('# ERROR: missing parameters') %}
{% endif %}
{% elif action_data.type == 'fcgi_set_param' %}
{% if action_data.fcgi_set_param|default('') != '' %}
{% do action_options.append('set-param ' ~ action_data.fcgi_set_param) %}
{% else %}
{% set action_enabled = '0' %}
- # ERROR: missing parameters
-{% endif %}
-{% elif action_data.type == 'http-request_allow' %}
-{% do action_options.append('http-request allow') %}
-{% elif action_data.type == 'http-request_deny' %}
-{% do action_options.append('http-request deny') %}
-{% elif action_data.type == 'http-request_tarpit' %}
-{% do action_options.append('http-request tarpit') %}
-{% elif action_data.type == 'http-request_auth' %}
-{% if action_data.http_request_auth|default("") != "" %}
-{% do action_options.append('http-request auth realm ' ~ action_data.http_request_auth) %}
-{% else %}
-{% do action_options.append('http-request auth') %}
-{% endif %}
-{% elif action_data.type == 'http-request_redirect' %}
-{% if action_data.http_request_redirect|default("") != "" %}
-{% do action_options.append('http-request redirect ' ~ action_data.http_request_redirect) %}
-{% else %}
-{% set action_enabled = '0' %}
- # ERROR: missing parameters
-{% endif %}
-{% elif action_data.type == 'http-request_lua' %}
-{% if action_data.http_request_lua|default("") != "" %}
-{% do action_options.append('http-request lua.' ~ action_data.http_request_lua) %}
-{% else %}
-{% set action_enabled = '0' %}
- # ERROR: missing parameters
-{% endif %}
-{% elif action_data.type == 'http-request_use-service' %}
-{% if action_data.http_request_use_service|default("") != "" %}
-{% do action_options.append('http-request use-service lua.' ~ action_data.http_request_use_service) %}
-{% else %}
-{% set action_enabled = '0' %}
- # ERROR: missing parameters
-{% endif %}
-{% elif action_data.type == 'http-request_add-header' %}
-{% if action_data.http_request_add_header_name|default("") != "" and action_data.http_request_add_header_content|default("") != "" %}
-{% do action_options.append('http-request add-header ' ~ action_data.http_request_add_header_name ~ ' ' ~ action_data.http_request_add_header_content) %}
-{% else %}
-{% set action_enabled = '0' %}
- # ERROR: missing parameters
-{% endif %}
-{% elif action_data.type == 'http-request_set-header' %}
-{% if action_data.http_request_set_header_name|default("") != "" and action_data.http_request_set_header_content|default("") != "" %}
-{% do action_options.append('http-request set-header ' ~ action_data.http_request_set_header_name ~ ' ' ~ action_data.http_request_set_header_content) %}
-{% else %}
-{% set action_enabled = '0' %}
- # ERROR: missing parameters
-{% endif %}
-{% elif action_data.type == 'http-request_del-header' %}
-{% if action_data.http_request_del_header_name|default("") != "" %}
-{% do action_options.append('http-request del-header ' ~ action_data.http_request_del_header_name) %}
-{% else %}
-{% set action_enabled = '0' %}
- # ERROR: missing parameters
-{% endif %}
-{% elif action_data.type == 'http-request_replace-header' %}
-{% if action_data.http_request_replace_header_name|default("") != "" and action_data.http_request_replace_header_regex|default("") != "" %}
-{% do action_options.append('http-request replace-header ' ~ action_data.http_request_replace_header_name ~ ' ' ~ action_data.http_request_replace_header_regex) %}
-{% else %}
-{% set action_enabled = '0' %}
- # ERROR: missing parameters
-{% endif %}
-{% elif action_data.type == 'http-request_replace-value' %}
-{% if action_data.http_request_replace_value_name|default("") != "" and action_data.http_request_replace_value_regex|default("") != "" %}
-{% do action_options.append('http-request replace-value ' ~ action_data.http_request_replace_value_name ~ ' ' ~ action_data.http_request_replace_value_regex) %}
-{% else %}
-{% set action_enabled = '0' %}
- # ERROR: missing parameters
-{% endif %}
-{% elif action_data.type == 'http-request_set-path' %}
-{% if action_data.http_request_set_path|default("") != "" %}
-{% do action_options.append('http-request set-path ' ~ action_data.http_request_set_path) %}
-{% else %}
-{% set action_enabled = '0' %}
- # ERROR: missing parameters
-{% endif %}
-{% elif action_data.type == 'http-request_set-var' %}
-{% if action_data.http_request_set_var_scope|default("") != "" and action_data.http_request_set_var_name|default("") != "" and action_data.http_request_set_var_expr|default("") != "" %}
-{% do action_options.append('http-request set-var(' ~ action_data.http_request_set_var_scope ~ '.' ~ action_data.http_request_set_var_name ~ ') ' ~ action_data.http_request_set_var_expr) %}
-{% else %}
-{% set action_enabled = '0' %}
- # ERROR: missing parameters
-{% endif %}
-{% elif action_data.type == 'http-response_allow' %}
-{% do action_options.append('http-response allow') %}
-{% elif action_data.type == 'http-response_deny' %}
-{% do action_options.append('http-response deny') %}
-{% elif action_data.type == 'http-response_lua' %}
-{% if action_data.http_response_lua|default("") != "" %}
-{% do action_options.append('http-response lua.' ~ action_data.http_response_lua) %}
-{% else %}
-{% set action_enabled = '0' %}
- # ERROR: missing parameters
-{% endif %}
-{% elif action_data.type == 'http-response_add-header' %}
-{% if action_data.http_response_add_header_name|default("") != "" and action_data.http_response_add_header_content|default("") != "" %}
-{% do action_options.append('http-response add-header ' ~ action_data.http_response_add_header_name ~ ' ' ~ action_data.http_response_add_header_content) %}
-{% else %}
-{% set action_enabled = '0' %}
- # ERROR: missing parameters
-{% endif %}
-{% elif action_data.type == 'http-response_set-header' %}
-{% if action_data.http_response_set_header_name|default("") != "" and action_data.http_response_set_header_content|default("") != "" %}
-{% do action_options.append('http-response set-header ' ~ action_data.http_response_set_header_name ~ ' ' ~ action_data.http_response_set_header_content) %}
-{% else %}
-{% set action_enabled = '0' %}
- # ERROR: missing parameters
+{% do global_action_options.append('# ERROR: missing parameters') %}
{% endif %}
-{% elif action_data.type == 'http-response_del-header' %}
-{% if action_data.http_response_del_header_name|default("") != "" %}
-{% do action_options.append('http-response del-header ' ~ action_data.http_response_del_header_name) %}
+{% elif action_data.type == 'http-after-response' %}
+{% if action_data.http_after_response_action|default('') != '' %}
+{% do action_options.append('http-after-response ' ~ action_data.http_after_response_action) %}
+{% if action_data.http_after_response_option|default('') != '' %}
+{% do action_options.append(action_data.http_after_response_option) %}
+{% endif %}
{% else %}
{% set action_enabled = '0' %}
- # ERROR: missing parameters
+{% do global_action_options.append('# ERROR: missing parameters') %}
{% endif %}
-{% elif action_data.type == 'http-response_replace-header' %}
-{% if action_data.http_response_replace_header_name|default("") != "" and action_data.http_response_replace_header_regex|default("") != "" %}
-{% do action_options.append('http-response replace-header ' ~ action_data.http_response_replace_header_name ~ ' ' ~ action_data.http_response_replace_header_regex) %}
+{% elif action_data.type == 'http-request' %}
+{% if action_data.http_request_action|default('') != '' %}
+{# # Some action keywords require a different syntax. #}
+{% if action_data.http_request_action == 'lua' %}
+{% set action_keyword_data = 'lua.' ~ action_data.http_request_option %}
+{% elif action_data.http_request_action == 'set-var' %}
+{% set action_keyword_data = 'set-var' ~ action_data.http_request_option %}
+{% elif action_data.http_request_action == 'use-service' %}
+{% set action_keyword_data = 'use-service lua.' ~ action_data.http_request_option %}
+{% else %}
+{# # Setup conditional parameters. #}
+{% set action_keyword_args = ActionConditionalArgs(action_data,action_data.http_request_action) | trim %}
+{% set action_keyword_data = action_data.http_request_action ~ action_keyword_args %}
+{% if action_data.http_request_option|default('') != '' %}
+{% set action_keyword_data = action_keyword_data ~ ' ' ~ action_data.http_request_option %}
+{% endif %}
+{% endif %}
+{% do action_options.append('http-request ' ~ action_keyword_data) %}
{% else %}
{% set action_enabled = '0' %}
- # ERROR: missing parameters
+{% do global_action_options.append('# ERROR: missing parameters') %}
{% endif %}
-{% elif action_data.type == 'http-response_replace-value' %}
-{% if action_data.http_response_replace_value_name|default("") != "" and action_data.http_response_replace_value_regex|default("") != "" %}
-{% do action_options.append('http-response replace-value ' ~ action_data.http_response_replace_value_name ~ ' ' ~ action_data.http_response_replace_value_regex) %}
+{% elif action_data.type == 'http-response' %}
+{% if action_data.http_response_action|default('') != '' %}
+{# # Some action keywords require a different syntax. #}
+{% if action_data.http_response_action == 'lua' %}
+{% set action_keyword_data = 'lua.' ~ action_data.http_response_option %}
+{% elif action_data.http_response_action == 'set-var' %}
+{% set action_keyword_data = 'set-var' ~ action_data.http_response_option %}
+{% else %}
+{# # Setup conditional parameters. #}
+{% set action_keyword_args = ActionConditionalArgs(action_data,action_data.http_response_action) | trim %}
+{% set action_keyword_data = action_data.http_response_action ~ action_keyword_args %}
+{% if action_data.http_response_option|default('') != '' %}
+{% set action_keyword_data = action_keyword_data ~ ' ' ~ action_data.http_response_option %}
+{% endif %}
+{% endif %}
+{% do action_options.append('http-response ' ~ action_keyword_data) %}
{% else %}
{% set action_enabled = '0' %}
- # ERROR: missing parameters
+{% do global_action_options.append('# ERROR: missing parameters') %}
{% endif %}
-{% elif action_data.type == 'http-response_set-status' %}
-{% if action_data.http_response_set_status_code|default("") != "" %}
-{% if action_data.http_response_set_status_reason|default("") != "" %}
-{% set status_reason = ' reason "' ~ action_data.http_response_set_status_reason ~ '"' %}
+{% elif action_data.type == 'map_data_use_backend' %}
+{% if action_data.map_data_use_backend_file|default("") != "" and action_data.map_data_use_backend_input|default("") != "" %}
+{# # Get the mapfile data #}
+{% set mapfile_data = helpers.getUUID(action_data.map_data_use_backend_file) %}
+{% set mapfile_path = '/tmp/haproxy/mapfiles/' ~ mapfile_data.id ~ '.txt' %}
+{% set mapfile_config = 'map_' ~ mapfile_data.type %}
+{# # Check if a default backend is specified #}
+{% if action_data.map_data_use_backend_default|default("") != "" %}
+{% set defaultbackend_data = helpers.getUUID(action_data.map_data_use_backend_default) %}
+{% set defaultbackend_option = ',' ~ defaultbackend_data.name %}
{% else %}
-{% set status_reason = '' %}
+{% set defaultbackend_option = '' %}
{% endif %}
-{% do action_options.append('http-response set-status ' ~ action_data.http_response_set_status_code ~ status_reason) %}
+{# # Finally add map file to config #}
+{% do action_options.append('use_backend %[' ~ action_data.map_data_use_backend_input ~ ',' ~ mapfile_config ~ '(' ~ mapfile_path ~ defaultbackend_option ~ ')]') %}
{% else %}
{% set action_enabled = '0' %}
- # ERROR: missing parameters
+{% do global_action_options.append('# ERROR: missing parameters') %}
{% endif %}
-{% elif action_data.type == 'http-response_set-var' %}
-{% if action_data.http_response_set_var_scope|default("") != "" and action_data.http_response_set_var_name|default("") != "" and action_data.http_response_set_var_expr|default("") != "" %}
-{% do action_options.append('http-response set-var(' ~ action_data.http_response_set_var_scope ~ '.' ~ action_data.http_response_set_var_name ~ ') ' ~ action_data.http_response_set_var_expr) %}
+{% elif action_data.type == 'map_use_backend' %}
+{# # First get the map file path #}
+{% if action_data.map_use_backend_file|default("") != "" %}
+{% set mapfile_data = helpers.getUUID(action_data.map_use_backend_file) %}
+{% set mapfile_path = '/tmp/haproxy/mapfiles/' ~ mapfile_data.id ~ '.txt' %}
+{# # Determine map type #}
+{% set mapfile_type = mapfile_data.type %}
+{% if mapfile_data.type|default("") == "dom" %}
+{# # retain the original behaviour for map_dom #}
+{% set mapfile_config = 'lower,map_dom' %}
+{% else %}
+{% set mapfile_config = 'map_' ~ mapfile_type %}
+{% endif %}
+{# # Check if a default backend is specified #}
+{% if action_data.map_use_backend_default|default("") != "" %}
+{% set defaultbackend_data = helpers.getUUID(action_data.map_use_backend_default) %}
+{% set defaultbackend_option = ',' ~ defaultbackend_data.name %}
+{% else %}
+{% set defaultbackend_option = '' %}
+{% endif %}
+{# # Finally add map file to config #}
+{% do action_options.append('use_backend %[req.hdr(host),' ~ mapfile_config ~ '(' ~ mapfile_path ~ defaultbackend_option ~ ')]') %}
{% else %}
{% set action_enabled = '0' %}
- # ERROR: missing parameters
+{% do global_action_options.append('# ERROR: missing parameters') %}
{% endif %}
{% elif action_data.type == 'monitor_fail' %}
{% if action_data.monitor_fail_uri|default("") != "" %}
@@ -632,93 +1606,107 @@
{% do action_options.append('monitor fail') %}
{% else %}
{% set action_enabled = '0' %}
- # ERROR: missing parameters
-{% endif %}
-{% elif action_data.type == 'tcp-request_connection_accept' %}
-{% do action_options.append('tcp-request connection accept') %}
-{% elif action_data.type == 'tcp-request_connection_reject' %}
-{% do action_options.append('tcp-request connection reject') %}
-{% elif action_data.type == 'tcp-request_content_accept' %}
-{% do action_options.append('tcp-request content accept') %}
-{% elif action_data.type == 'tcp-request_content_reject' %}
-{% do action_options.append('tcp-request content reject') %}
-{% elif action_data.type == 'tcp-request_content_lua' %}
-{% if action_data.tcp_request_content_lua|default("") != "" %}
-{% do action_options.append('tcp-request content lua.' ~ action_data.tcp_request_content_lua) %}
-{% else %}
-{% set action_enabled = '0' %}
- # ERROR: missing parameters
-{% endif %}
-{% elif action_data.type == 'tcp-request_content_use-service' %}
-{% if action_data.tcp_request_content_use_service|default("") != "" %}
-{% do action_options.append('tcp-request content use-service lua.' ~ action_data.tcp_request_content_use_service) %}
-{% else %}
-{% set action_enabled = '0' %}
- # ERROR: missing parameters
+{% do global_action_options.append('# ERROR: missing parameters') %}
{% endif %}
-{% elif action_data.type == 'tcp-request_inspect-delay' %}
-{% if action_data.tcp_request_inspect_delay|default("") != "" %}
-{% do action_options.append('tcp-request inspect-delay ' ~ action_data.tcp_request_inspect_delay) %}
+{% elif action_data.type == 'tcp-request' %}
+{% if action_data.tcp_request_action|default('') != '' %}
+{# # Convert back to HAProxy-compatible format. #}
+{% set action_name = action_data.tcp_request_action|replace("_", " ") %}
+{# # Some action keywords require a different syntax. #}
+{% if action_data.tcp_request_action == 'content_lua' %}
+{% set action_keyword_data = action_name ~ '.' ~ action_data.tcp_request_option %}
+{% elif action_data.tcp_request_action == 'content_use-service' %}
+{% set action_keyword_data = action_name ~ ' lua.' ~ action_data.tcp_request_option %}
+{% else %}
+{# # Setup conditional parameters. #}
+{% set action_keyword_args = ActionConditionalArgs(action_data,action_name) | trim %}
+{% set action_keyword_data = action_name ~ action_keyword_args %}
+{% if action_data.tcp_request_option|default('') != '' %}
+{% set action_keyword_data = action_keyword_data ~ ' ' ~ action_data.tcp_request_option %}
+{% endif %}
+{% endif %}
+{% do action_options.append('tcp-request ' ~ action_keyword_data) %}
{% else %}
{% set action_enabled = '0' %}
- # ERROR: missing parameters
+{% do global_action_options.append('# ERROR: missing parameters') %}
{% endif %}
-{% elif action_data.type == 'tcp-response_content_accept' %}
-{% do action_options.append('tcp-response content accept') %}
-{% elif action_data.type == 'tcp-response_content_close' %}
-{% do action_options.append('tcp-response content close') %}
-{% elif action_data.type == 'tcp-response_content_reject' %}
-{% do action_options.append('tcp-response content reject') %}
-{% elif action_data.type == 'tcp-response_content_lua' %}
-{% if action_data.tcp_response_content_lua|default("") != "" %}
-{% do action_options.append('tcp-response content lua.' ~ action_data.tcp_response_content_lua) %}
+{% elif action_data.type == 'tcp-response' %}
+{% if action_data.tcp_response_action|default('') != '' %}
+{# # Convert back to HAProxy-compatible format. #}
+{% set action_name = action_data.tcp_response_action|replace("_", " ") %}
+{# # Some action keywords require a different syntax. #}
+{% if action_data.tcp_response_action == 'content_lua' %}
+{% set action_keyword_data = action_name ~ '.' ~ action_data.tcp_response_option %}
+{% else %}
+{# # Setup conditional parameters. #}
+{% set action_keyword_args = ActionConditionalArgs(action_data,action_name) | trim %}
+{% set action_keyword_data = action_name ~ action_keyword_args %}
+{% if action_data.tcp_response_option|default('') != '' %}
+{% set action_keyword_data = action_keyword_data ~ ' ' ~ action_data.tcp_response_option %}
+{% endif %}
+{% endif %}
+{% do action_options.append('tcp-response ' ~ action_keyword_data) %}
{% else %}
{% set action_enabled = '0' %}
- # ERROR: missing parameters
+{% do global_action_options.append('# ERROR: missing parameters') %}
{% endif %}
-{% elif action_data.type == 'tcp-response_inspect-delay' %}
-{% if action_data.tcp_response_inspect_delay|default("") != "" %}
-{% do action_options.append('tcp-response inspect-delay ' ~ action_data.tcp_response_inspect_delay) %}
+{% elif action_data.type == 'use_backend' %}
+{% if action_data.use_backend|default("") != "" %}
+{% set acl_backend_data = helpers.getUUID(action_data.use_backend) %}
+{% do action_options.append('use_backend ' ~ acl_backend_data.name) %}
{% else %}
{% set action_enabled = '0' %}
- # ERROR: missing parameters
+{% do global_action_options.append('# ERROR: missing parameters') %}
{% endif %}
-{% elif action_data.type == 'custom' %}
-{% if action_data.custom|default("") != "" %}
-{% do action_options.append(action_data.custom) %}
+{% elif action_data.type == 'use_server' %}
+{% if action_data.use_server|default("") != "" %}
+{% set server_data = helpers.getUUID(action_data.use_server) %}
+{% do action_options.append('use-server ' ~ server_data.name) %}
{% else %}
{% set action_enabled = '0' %}
- # ERROR: missing parameters
+{% do global_action_options.append('# ERROR: missing parameters') %}
{% endif %}
{% else %}
{% set action_enabled = '0' %}
- # ERROR: unsupported action type
+{% do global_action_options.append('# ERROR: unsupported rule type ' ~ action_data.type) %}
{% endif %}
-{# # check if action is valid #}
-{% if action_enabled == '1' %}
-{% if action_data.operator == 'or' %}
-{% set join_operator = ' || ' %}
-{% else %}
-{% set join_operator = ' ' %}
-{% endif %}
-{# # check if action depends on ACLs #}
-{% set comment_lines = ['# ACTION: ' + action_data.name] %}
-{% if action_acls|length > 0 %}
-{% set acl_line = [action_data.testType, action_acls|join(join_operator)]|join(' ') %}
+{# # Is this rule enabled in the GUI? #}
+{% if action_data.enabled|default('') == '1' %}
+{# # check if action is valid #}
+{% if action_enabled == '1' %}
+{% if action_data.operator == 'or' %}
+{% set join_operator = ' || ' %}
+{% else %}
+{% set join_operator = ' ' %}
+{% endif %}
+{# # check if action depends on ACLs #}
+{% set comment_lines = ['# RULE: ' + action_data.name] %}
+{% if action_acls|length > 0 %}
+{% set acl_line = [action_data.testType, action_acls|join(join_operator)]|join(' ') %}
+{% else %}
+{% set acl_line = '' %}
+{% endif %}
+{% if action_options|length > 0 %}
+{# # handle multiline options #}
+{% if action_multiline == '1' %}
+{% set join_char = '\n ' %}
+{# # ACLs are unsupported in multiline options, remove them #}
+{% set acl_line = '' %}
+{% else %}
+{% set join_char = ' ' %}
+{% endif %}
+{% do global_action_options.append(comment_lines|join('\n')) -%}
+{% do global_action_options.append(([action_options|join(join_char), acl_line]|join(' '))) %}
+{% endif %}
{% else %}
-{% set acl_line = '' %}
-{% set comment_lines = comment_lines + [' # NOTE: actions with no ACLs/conditions will always match'] %}
-{% endif %}
-{% if action_options|length > 0 %}
-{% do global_action_options.append(comment_lines|join('\n')) -%}
-{% do global_action_options.append(([action_options|join(' '), acl_line]|join(' '))) %}
+{% do global_action_options.append('# RULE INVALID: ' + action_data.name) %}
{% endif %}
{% else %}
- # ACTION INVALID: {{action_data.name}}
+{% do global_action_options.append('# RULE DISABLED: ' + action_data.name) %}
{% endif %}
{% else %}
- # ACTION INVALID: {{action_data.name}}
- # ACL ERROR COUNT: {{acl_errors}}
+{% do global_action_options.append('# RULE INVALID: ' + action_data.name) %}
+{% do global_action_options.append('# CONDITIONS WITH ERRORS: ' + acl_errors) %}
{% endif %}
{% endfor %}
@@ -741,18 +1729,28 @@
{% set stickiness_datatypes = [] %}
{% for datatype in proxy.stickiness_dataTypes.split(",") %}
{# # add time period to all types where this is required #}
-{% if datatype == 'conn_rate' %}
-{% do stickiness_datatypes.append(datatype ~ '(' ~ proxy.stickiness_connRatePeriod ~ ')') %}
-{% elif datatype == 'sess_rate' %}
-{% do stickiness_datatypes.append(datatype ~ '(' ~ proxy.stickiness_sessRatePeriod ~ ')') %}
-{% elif datatype == 'http_req_rate' %}
-{% do stickiness_datatypes.append(datatype ~ '(' ~ proxy.stickiness_httpReqRatePeriod ~ ')') %}
-{% elif datatype == 'http_err_rate' %}
-{% do stickiness_datatypes.append(datatype ~ '(' ~ proxy.stickiness_httpErrRatePeriod ~ ')') %}
-{% elif datatype == 'bytes_in_rate' %}
+{% if datatype == 'bytes_in_rate' %}
{% do stickiness_datatypes.append(datatype ~ '(' ~ proxy.stickiness_bytesInRatePeriod ~ ')') %}
{% elif datatype == 'bytes_out_rate' %}
{% do stickiness_datatypes.append(datatype ~ '(' ~ proxy.stickiness_bytesOutRatePeriod ~ ')') %}
+{% elif datatype == 'conn_rate' %}
+{% do stickiness_datatypes.append(datatype ~ '(' ~ proxy.stickiness_connRatePeriod ~ ')') %}
+{% elif datatype == 'glitch_rate' %}
+{% do stickiness_datatypes.append(datatype ~ '(' ~ proxy.stickiness_glitchRatePeriod ~ ')') %}
+{% elif datatype == 'gpc_rate' %}
+{% do stickiness_datatypes.append(datatype ~ '(' ~ proxy.stickiness_gpcElements ~ ',' ~ proxy.stickiness_gpcRatePeriod ~ ')') %}
+{% elif datatype == 'gpc0_rate' %}
+{% do stickiness_datatypes.append(datatype ~ '(' ~ proxy.stickiness_gpcRatePeriod ~ ')') %}
+{% elif datatype == 'gpc1_rate' %}
+{% do stickiness_datatypes.append(datatype ~ '(' ~ proxy.stickiness_gpcRatePeriod ~ ')') %}
+{% elif datatype == 'http_err_rate' %}
+{% do stickiness_datatypes.append(datatype ~ '(' ~ proxy.stickiness_httpErrRatePeriod ~ ')') %}
+{% elif datatype == 'http_fail_rate' %}
+{% do stickiness_datatypes.append(datatype ~ '(' ~ proxy.stickiness_httpFailRatePeriod ~ ')') %}
+{% elif datatype == 'http_req_rate' %}
+{% do stickiness_datatypes.append(datatype ~ '(' ~ proxy.stickiness_httpReqRatePeriod ~ ')') %}
+{% elif datatype == 'sess_rate' %}
+{% do stickiness_datatypes.append(datatype ~ '(' ~ proxy.stickiness_sessRatePeriod ~ ')') %}
{% else %}
{% do stickiness_datatypes.append(datatype) %}
{% endif %}
@@ -761,7 +1759,7 @@
{% endif %}
{# # check stick-table type #}
{% if proxy.stickiness_pattern == "sourceipv4" or proxy.stickiness_pattern == "ipv4" %}
-{% set table_type = 'ip' %}
+{% set table_type = 'ipv4' %}
{% elif proxy.stickiness_pattern == "sourceipv6" or proxy.stickiness_pattern == "ipv6" %}
{% set table_type = 'ipv6' %}
{% elif proxy.stickiness_pattern == "cookievalue" or proxy.stickiness_pattern == "string" %}
@@ -987,6 +1985,8 @@ global
{% if helpers.exists('OPNsense.HAProxy.general.tuning.maxConnections') %}
maxconn {{OPNsense.HAProxy.general.tuning.maxConnections}}
{% endif %}
+{# # TODO: remove this option when OpenSSL 3.5 is available on OPNsense #}
+ limited-quic
{# # check if OCSP is enabled #}
{% if OPNsense.HAProxy.general.tuning.ocspUpdateEnabled|default('') == '1' %}
{% if helpers.exists('OPNsense.HAProxy.general.tuning.ocspUpdateMinDelay') %}
@@ -1018,6 +2018,7 @@ global
{% if OPNsense.HAProxy.general.tuning.bufferSize|default("") != "" %}
tune.bufsize {{OPNsense.HAProxy.general.tuning.bufferSize}}
{% endif %}
+ tune.lua.bool-sample-conversion normal
{% if OPNsense.HAProxy.general.tuning.luaMaxMem|default("") != "" %}
tune.lua.maxmem {{OPNsense.HAProxy.general.tuning.luaMaxMem}}
{% endif %}
@@ -1328,7 +2329,7 @@ mailers {{mailer.id}}
{% if helpers.exists('OPNsense.HAProxy.frontends') %}
{% for frontend in helpers.toList('OPNsense.HAProxy.frontends.frontend') %}
{% if frontend.enabled == '1' %}
-# Frontend: {{frontend.name}} ({{frontend.description}})
+# Public Service: {{frontend.name}} ({{frontend.description}})
frontend {{frontend.name}}
{% set ssl_certs = [] %}
{% set ssl_options = [] %}
@@ -1392,15 +2393,6 @@ frontend {{frontend.name}}
{% endif %}
{% endif %}
{% endif %}
-{# # HTTP/2 with TLS enabled #}
-{% if frontend.http2Enabled|default("") == '1' and frontend.advertised_protocols|default("") != "" %}
-{# # convert protocols to HAProxy-compatible format #}
-{% set alpn_options = frontend.advertised_protocols|replace('http10', 'http/1.0')|replace('http11', 'http/1.1') %}
-{% do ssl_options.append('alpn ' ~ alpn_options) %}
-{% else %}
-{# # disable ALPN to enforce the GUI settings #}
-{% do ssl_options.append('no-alpn') %}
-{% endif %}
{# # HTTP/2 without TLS #}
{% elif frontend.http2Enabled|default("") == '1' and frontend.http2Enabled_nontls|default("") == '1' %}
{% do adv_options.append('proto h2') %}
@@ -1422,6 +2414,8 @@ frontend {{frontend.name}}
{# # bind/listen configuration #}
{% if frontend.bind|default("") != "" %}
{% for bind in frontend.bind.split(",") %}
+{# # alpn advertisements are specific to each bind line #}
+{% set alpn_options = [] %}
{# # check if this is a unix socket #}
{% set unix_bind = bind | regex_replace ("^unix@.*","TRUE") %}
{% if unix_bind == "TRUE" %}
@@ -1433,7 +2427,29 @@ frontend {{frontend.name}}
{% set bind_address = bind %}
{% set bind_name = bind %}
{% endif %}
- bind {{bind_address}} name {{bind_name}} {% if frontend.bindOptions|default("") != "" %}{{ frontend.bindOptions }} {% endif %}{% if frontend.ssl_enabled == '1' and ssl_certs|default("") != "" %}ssl {{ ssl_options|join(' ') }} {{ ssl_certs|join(' ') }} {% endif %}{% if adv_options|length > 0 %} {{ adv_options|join(' ') }} {% endif %}
+{# # Check if TLS ALPN support is enabled #}
+{% if frontend.http2Enabled|default("") == '1' and frontend.advertised_protocols|default("") != "" %}
+{# # handle incompatible alpn advertisements #}
+{% if bind.startswith('quic4@') or bind.startswith('quic6@') %}
+{# # strip incompatible advertisement for QUIC bind lines #}
+{% set alpn_incompatible = ['h2', 'http11', 'http10'] %}
+{% set alpn_filtered = frontend.advertised_protocols.split(',') | reject('in', alpn_incompatible) | join(',') %}
+{% else %}
+{# # strip incompatible advertisement for non-QUIC bind lines #}
+{% set alpn_incompatible = ['h3'] %}
+{% set alpn_filtered = frontend.advertised_protocols.split(',') | reject('in', alpn_incompatible) | join(',') %}
+{% endif %}
+{# # add alpn advertisements #}
+{% if alpn_filtered|default("") != "" %}
+{# # convert alpn protocols to HAProxy-compatible format #}
+{% set alpn_conv = alpn_filtered|replace('http10', 'http/1.0')|replace('http11', 'http/1.1') %}
+{% do alpn_options.append('alpn ' ~ alpn_conv) %}
+{% endif %}
+{% else %}
+{# # disable ALPN to enforce the GUI settings #}
+{% do ssl_options.append('no-alpn') %}
+{% endif %}
+ bind {{bind_address}} name {{bind_name}} {% if frontend.bindOptions|default("") != "" %}{{ frontend.bindOptions }} {% endif %}{% if frontend.ssl_enabled == '1' and ssl_certs|default("") != "" %}ssl {{ ssl_options|join(' ') }} {{ alpn_options|join(' ') }} {{ ssl_certs|join(' ') }} {% endif %}{% if adv_options|length > 0 %} {{ adv_options|join(' ') }} {% endif %}
{% endfor %}
{% endif %}
@@ -1517,7 +2533,7 @@ frontend {{frontend.name}}
{% endif %}
{% else %}
-# Frontend (DISABLED): {{frontend.name}} ({{frontend.description}})
+# Public Service (DISABLED): {{frontend.name}} ({{frontend.description}})
{% endif %}
{% endfor %}
@@ -1531,10 +2547,10 @@ frontend {{frontend.name}}
{% for backend in helpers.toList('OPNsense.HAProxy.backends.backend') %}
{# # ignore disabled backends #}
{% if backend.enabled == '1' %}
-# Backend: {{backend.name}} ({{backend.description}})
+# Backend Pool: {{backend.name}} ({{backend.description}})
backend {{backend.name}}
{% if backend.linkedServers|default("") == "" %}
- # HINT: no servers configured for this backend.
+ # HINT: no servers configured for this backend pool.
{% endif %}
{# # store additional parameters for the "server" entries #}
{% set healthcheck_additions = [] %}
@@ -1844,6 +2860,8 @@ backend {{backend.name}}
{# # SNI #}
{% if server_data.sslSNI|default('') != '' %}
{% do server_options.append('sni str(' ~ server_data.sslSNI ~ ')') %}
+{% elif server_data.sslSNIExpr|default('') != '' %}
+{% do server_options.append('sni ' ~ server_data.sslSNIExpr) %}
{% endif %}
{# # HTTP/2 #}
{% if backend.http2Enabled|default("") == '1' and backend.ba_advertised_protocols|default("") != "" %}
@@ -1931,12 +2949,19 @@ backend {{backend.name}}
{% elif server_data.source|default("") != "" %}
{% do server_options.append('source ' ~ server_data.source) %}
{% endif %}
-{# # PROXY protocol #}
+{# # PROXY protocol for server connections #}
{% if backend.proxyProtocol|default("") == "v1" %}
{% do server_options.append('send-proxy') %}
-{% do server_options.append('check-send-proxy') %}
{% elif backend.proxyProtocol|default("") == "v2" %}
{% do server_options.append('send-proxy-v2') %}
+{% endif %}
+{# # PROXY protocol for health checks #}
+{% if backend.healthCheckProxyProto|default("") == "" or backend.healthCheckProxyProto|default("") == "backend" %}
+{% if backend.proxyProtocol|default("") != "" %}
+{# # enable PROXY protocol if activated in backend #}
+{% do server_options.append('check-send-proxy') %}
+{% endif %}
+{% elif backend.healthCheckProxyProto|default("") == "enable" %}
{% do server_options.append('check-send-proxy') %}
{% endif %}
{# # cookie-based persistence #}
@@ -1957,7 +2982,7 @@ backend {{backend.name}}
{% endif %}
{% else %}
-# Backend (DISABLED): {{backend.name}} ({{backend.description}})
+# Backend Pool (DISABLED): {{backend.name}} ({{backend.description}})
{% endif %}
{% endfor %}
diff --git a/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/sslCerts.yaml b/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/sslCerts.yaml
index 2f7d7a4eec..b805cb1c81 100644
--- a/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/sslCerts.yaml
+++ b/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/sslCerts.yaml
@@ -8,14 +8,14 @@
{# ################## #}
{% macro getCA(refId) -%}
{% set result = '{}' %}
-{% for data in helpers.getNodeByTag('ca') if data.refid == refId %}
+{% for data in helpers.toList('ca') if data.refid == refId %}
{{ data.crt -}}
{% else %}
{{ "{}" }}
{% endfor %}
{%- endmacro %}
{% macro getCert(refId, indent=4) -%}
-{% for data in helpers.getNodeByTag('cert') if data.refid == refId %}
+{% for data in helpers.toList('cert') if data.refid == refId %}
{% if data.caref %}
{% do data.update({'ca': getCA(data.caref)}) %}
{% else %}