mirror of
https://github.com/opnsense/plugins.git
synced 2026-06-08 16:34:18 -04:00
net/haproxy: add new option "case-sensitive" to conditions, closes #2576
This commit is contained in:
parent
7a0aeeba68
commit
0c40837f1f
4 changed files with 121 additions and 22 deletions
|
|
@ -12,6 +12,7 @@ Added:
|
|||
* add support for advanced resolver properties (#2330)
|
||||
* add graceful stop timeout to service settings
|
||||
* support "monitor-uri" and "monitor fail" in rules (#2387)
|
||||
* add new option "case-sensitive" to conditions (#2576)
|
||||
|
||||
Fixed:
|
||||
* no haproxy.conf after restoring a config backup (#2474)
|
||||
|
|
|
|||
|
|
@ -27,6 +27,12 @@
|
|||
<type>checkbox</type>
|
||||
<help><![CDATA[Use this to invert the meaning of the expression.]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<id>acl.caseSensitive</id>
|
||||
<label>Case-sensitive</label>
|
||||
<type>checkbox</type>
|
||||
<help><![CDATA[Enable to make the condition case-sensitive (if applicable). By default all conditions are not case-sensitive.]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<label>Parameters</label>
|
||||
<type>header</type>
|
||||
|
|
|
|||
|
|
@ -1585,6 +1585,10 @@
|
|||
<default>0</default>
|
||||
<Required>Y</Required>
|
||||
</negate>
|
||||
<caseSensitive type="BooleanField">
|
||||
<default>0</default>
|
||||
<Required>N</Required>
|
||||
</caseSensitive>
|
||||
<hdr_beg type="TextField">
|
||||
<mask>/^.{1,255}$/u</mask>
|
||||
<ValidationMessage>Should be a string between 1 and 255 characters.</ValidationMessage>
|
||||
|
|
|
|||
|
|
@ -83,119 +83,187 @@
|
|||
{% endif %}
|
||||
{% elif acl_data.expression == 'hdr_beg' %}
|
||||
{% if acl_data.hdr_beg|default("") != "" %}
|
||||
{% do acl_options.append('hdr_beg(host) -i ' ~ acl_data.hdr_beg) %}
|
||||
{% 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) -i ' ~ acl_data.hdr_end) %}
|
||||
{% 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' %}
|
||||
{% if acl_data.hdr|default("") != "" %}
|
||||
{% do acl_options.append('hdr(host) -i ' ~ acl_data.hdr) %}
|
||||
{% do acl_options.append('hdr(host)') %}
|
||||
{% if acl_data.caseSensitive|default('0') == '0' %}
|
||||
{% do acl_options.append('-i') %}
|
||||
{% endif %}
|
||||
{% do acl_options.append(acl_data.hdr) %}
|
||||
{% 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) -i ' ~ acl_data.hdr_reg) %}
|
||||
{% do acl_options.append('hdr_reg(host)') %}
|
||||
{% if acl_data.caseSensitive|default('0') == '0' %}
|
||||
{% do acl_options.append('-i') %}
|
||||
{% endif %}
|
||||
{% do acl_options.append(acl_data.hdr_reg) %}
|
||||
{% else %}
|
||||
{% set acl_enabled = '0' %}
|
||||
# ERROR: missing parameters
|
||||
{% endif %}
|
||||
{% elif acl_data.expression == 'hdr_sub' %}
|
||||
{% if acl_data.hdr_sub|default("") != "" %}
|
||||
{% do acl_options.append('hdr_sub(host) -i ' ~ acl_data.hdr_sub) %}
|
||||
{% do acl_options.append('hdr_sub(host)') %}
|
||||
{% if acl_data.caseSensitive|default('0') == '0' %}
|
||||
{% do acl_options.append('-i') %}
|
||||
{% endif %}
|
||||
{% do acl_options.append('acl_data.hdr_sub) %}
|
||||
{% else %}
|
||||
{% 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 -i ' ~ acl_data.path_beg) %}
|
||||
{% 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) %}
|
||||
{% 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 -i ' ~ acl_data.path_end) %}
|
||||
{% 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_end) %}
|
||||
{% else %}
|
||||
{% set acl_enabled = '0' %}
|
||||
# ERROR: missing parameters
|
||||
{% endif %}
|
||||
{% elif acl_data.expression == 'path' %}
|
||||
{% if acl_data.path|default("") != "" %}
|
||||
{% do acl_options.append('path -i ' ~ acl_data.path) %}
|
||||
{% do acl_options.append('path') %}
|
||||
{% if acl_data.caseSensitive|default('0') == '0' %}
|
||||
{% do acl_options.append('-i') %}
|
||||
{% endif %}
|
||||
{% do acl_options.append(acl_data.path) %}
|
||||
{% else %}
|
||||
{% 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 -i ' ~ acl_data.path_reg) %}
|
||||
{% 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.path_reg) %}
|
||||
{% else %}
|
||||
{% set acl_enabled = '0' %}
|
||||
# ERROR: missing parameters
|
||||
{% endif %}
|
||||
{% elif acl_data.expression == 'path_dir' %}
|
||||
{% if acl_data.path_dur|default("") != "" %}
|
||||
{% do acl_options.append('path_dir -i ' ~ acl_data.path_dir) %}
|
||||
{% do acl_options.append('path_dir') %}
|
||||
{% if acl_data.caseSensitive|default('0') == '0' %}
|
||||
{% do acl_options.append('-i') %}
|
||||
{% endif %}
|
||||
{% do acl_options.append(acl_data.path_dir) %}
|
||||
{% else %}
|
||||
{% 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 -i ' ~ acl_data.path_sub) %}
|
||||
{% 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.path_sub) %}
|
||||
{% 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 ~ ') -i ' ~ acl_data.cust_hdr_beg) %}
|
||||
{% 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.cust_hdr_beg) %}
|
||||
{% 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 ~ ') -i ' ~ acl_data.cust_hdr_end) %}
|
||||
{% 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.cust_hdr_end) %}
|
||||
{% 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 ~ ') -i ' ~ acl_data.cust_hdr) %}
|
||||
{% 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 == '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 ~ ') -i ' ~ acl_data.cust_hdr_reg) %}
|
||||
{% 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 ~ ') -i ' ~ acl_data.cust_hdr_sub) %}
|
||||
{% 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
|
||||
{% 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 ~ ') -i ' ~ acl_data.url_param_value) %}
|
||||
{% 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
|
||||
|
|
@ -281,35 +349,55 @@
|
|||
{% endif %}
|
||||
{% elif acl_data.expression == 'ssl_sni' %}
|
||||
{% if acl_data.ssl_sni|default("") != "" %}
|
||||
{% do acl_options.append('req.ssl_sni -i ' ~ acl_data.ssl_sni) %}
|
||||
{% do acl_options.append('req.ssl_sni') %}
|
||||
{% if acl_data.caseSensitive|default('0') == '0' %}
|
||||
{% do acl_options.append('-i') %}
|
||||
{% endif %}
|
||||
{% do acl_options.append(acl_data.ssl_sni) %}
|
||||
{% else %}
|
||||
{% set acl_enabled = '0' %}
|
||||
# ERROR: missing parameters
|
||||
{% endif %}
|
||||
{% elif acl_data.expression == 'ssl_sni_sub' %}
|
||||
{% if acl_data.ssl_sni_sub|default("") != "" %}
|
||||
{% do acl_options.append('req.ssl_sni -m sub -i ' ~ acl_data.ssl_sni_sub) %}
|
||||
{% do acl_options.append('req.ssl_sni -m sub') %}
|
||||
{% if acl_data.caseSensitive|default('0') == '0' %}
|
||||
{% do acl_options.append('-i') %}
|
||||
{% endif %}
|
||||
{% do acl_options.append(acl_data.ssl_sni_sub) %}
|
||||
{% else %}
|
||||
{% set acl_enabled = '0' %}
|
||||
# ERROR: missing parameters
|
||||
{% endif %}
|
||||
{% elif acl_data.expression == 'ssl_sni_beg' %}
|
||||
{% if acl_data.ssl_sni_beg|default("") != "" %}
|
||||
{% do acl_options.append('req.ssl_sni -m beg -i ' ~ acl_data.ssl_sni_beg) %}
|
||||
{% do acl_options.append('req.ssl_sni -m beg') %}
|
||||
{% if acl_data.caseSensitive|default('0') == '0' %}
|
||||
{% do acl_options.append('-i') %}
|
||||
{% endif %}
|
||||
{% do acl_options.append(acl_data.ssl_sni_beg) %}
|
||||
{% else %}
|
||||
{% set acl_enabled = '0' %}
|
||||
# ERROR: missing parameters
|
||||
{% endif %}
|
||||
{% elif acl_data.expression == 'ssl_sni_end' %}
|
||||
{% if acl_data.ssl_sni_end|default("") != "" %}
|
||||
{% do acl_options.append('req.ssl_sni -m end -i ' ~ acl_data.ssl_sni_end) %}
|
||||
{% do acl_options.append('req.ssl_sni -m end') %}
|
||||
{% if acl_data.caseSensitive|default('0') == '0' %}
|
||||
{% do acl_options.append('-i') %}
|
||||
{% endif %}
|
||||
{% do acl_options.append(acl_data.ssl_sni_end) %}
|
||||
{% else %}
|
||||
{% set acl_enabled = '0' %}
|
||||
# ERROR: missing parameters
|
||||
{% endif %}
|
||||
{% elif acl_data.expression == 'ssl_sni_reg' %}
|
||||
{% if acl_data.ssl_sni_reg|default("") != "" %}
|
||||
{% do acl_options.append('req.ssl_sni -m reg -i ' ~ acl_data.ssl_sni_reg) %}
|
||||
{% do acl_options.append('req.ssl_sni -m reg') %}
|
||||
{% if acl_data.caseSensitive|default('0') == '0' %}
|
||||
{% do acl_options.append('-i') %}
|
||||
{% endif %}
|
||||
{% do acl_options.append(acl_data.ssl_sni_reg) %}
|
||||
{% else %}
|
||||
{% set acl_enabled = '0' %}
|
||||
# ERROR: missing parameters
|
||||
|
|
|
|||
Loading…
Reference in a new issue