mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
net/haproxy: add support for custom header checks, closes #1907
This commit is contained in:
@@ -18,6 +18,7 @@ Added:
|
||||
* guard against broken config by using a staging config file
|
||||
* add basic OCSP stapling support (#1430)
|
||||
* add support for e-mail alerts and mailers (#1669)
|
||||
* add support for custom header checks (#1907)
|
||||
|
||||
Fixed:
|
||||
* fix maintenance page (python error: 'list' object has no attribute 'strip')
|
||||
|
||||
@@ -148,6 +148,91 @@
|
||||
<type>text</type>
|
||||
<help><![CDATA[HTTP request URL path contains string (substring match)]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<label>Parameters</label>
|
||||
<type>header</type>
|
||||
<style>expression_table table_cust_hdr_beg</style>
|
||||
</field>
|
||||
<field>
|
||||
<id>acl.cust_hdr_beg_name</id>
|
||||
<label>Header Name</label>
|
||||
<type>text</type>
|
||||
<help><![CDATA[The name of the HTTP Header.]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<id>acl.cust_hdr_beg</id>
|
||||
<label>Header Prefix</label>
|
||||
<type>text</type>
|
||||
<help><![CDATA[HTTP Header starts with string (prefix match)]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<label>Parameters</label>
|
||||
<type>header</type>
|
||||
<style>expression_table table_cust_hdr_end</style>
|
||||
</field>
|
||||
<field>
|
||||
<id>acl.cust_hdr_end_name</id>
|
||||
<label>Header Name</label>
|
||||
<type>text</type>
|
||||
<help><![CDATA[The name of the HTTP Header.]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<id>acl.cust_hdr_end</id>
|
||||
<label>Header Suffix</label>
|
||||
<type>text</type>
|
||||
<help><![CDATA[HTTP Header ends with string (suffix match)]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<label>Parameters</label>
|
||||
<type>header</type>
|
||||
<style>expression_table table_cust_hdr</style>
|
||||
</field>
|
||||
<field>
|
||||
<id>acl.cust_hdr_name</id>
|
||||
<label>Header Name</label>
|
||||
<type>text</type>
|
||||
<help><![CDATA[The name of the HTTP Header.]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<id>acl.cust_hdr</id>
|
||||
<label>Header Matches</label>
|
||||
<type>text</type>
|
||||
<help><![CDATA[HTTP Header matches exact string]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<label>Parameters</label>
|
||||
<type>header</type>
|
||||
<style>expression_table table_cust_hdr_reg</style>
|
||||
</field>
|
||||
<field>
|
||||
<id>acl.cust_hdr_reg_name</id>
|
||||
<label>Header Name</label>
|
||||
<type>text</type>
|
||||
<help><![CDATA[The name of the HTTP Header.]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<id>acl.cust_hdr_reg</id>
|
||||
<label>Header Regex</label>
|
||||
<type>text</type>
|
||||
<help><![CDATA[HTTP Header matches regular expression]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<label>Parameters</label>
|
||||
<type>header</type>
|
||||
<style>expression_table table_cust_hdr_sub</style>
|
||||
</field>
|
||||
<field>
|
||||
<id>acl.cust_hdr_sub_name</id>
|
||||
<label>Header Name</label>
|
||||
<type>text</type>
|
||||
<help><![CDATA[The name of the HTTP Header.]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<id>acl.cust_hdr_sub</id>
|
||||
<label>Header Contains</label>
|
||||
<type>text</type>
|
||||
<help><![CDATA[HTTP Header contains string (substring match)]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<label>Parameters</label>
|
||||
<type>header</type>
|
||||
|
||||
@@ -1466,6 +1466,11 @@
|
||||
<path_reg>Path regex</path_reg>
|
||||
<path_dir>Path contains subdir</path_dir>
|
||||
<path_sub>Path contains string</path_sub>
|
||||
<cust_hdr_beg>HTTP Header starts with</cust_hdr_beg>
|
||||
<cust_hdr_end>HTTP Header ends with</cust_hdr_end>
|
||||
<cust_hdr>HTTP Header matches</cust_hdr>
|
||||
<cust_hdr_reg>HTTP Header regex</cust_hdr_reg>
|
||||
<cust_hdr_sub>HTTP Header contains</cust_hdr_sub>
|
||||
<url_param>URL parameter contains</url_param>
|
||||
<ssl_c_verify>SSL Client certificate is valid</ssl_c_verify>
|
||||
<ssl_c_verify_code>SSL Client certificate verify error result</ssl_c_verify_code>
|
||||
@@ -1563,6 +1568,56 @@
|
||||
<ValidationMessage>Should be a string between 1 and 255 characters.</ValidationMessage>
|
||||
<Required>N</Required>
|
||||
</path_sub>
|
||||
<cust_hdr_beg_name type="TextField">
|
||||
<mask>/^.{1,255}$/u</mask>
|
||||
<ValidationMessage>Should be a string between 1 and 255 characters.</ValidationMessage>
|
||||
<Required>N</Required>
|
||||
</cust_hdr_beg_name>
|
||||
<cust_hdr_beg type="TextField">
|
||||
<mask>/^.{1,255}$/u</mask>
|
||||
<ValidationMessage>Should be a string between 1 and 255 characters.</ValidationMessage>
|
||||
<Required>N</Required>
|
||||
</cust_hdr_beg>
|
||||
<cust_hdr_end_name type="TextField">
|
||||
<mask>/^.{1,255}$/u</mask>
|
||||
<ValidationMessage>Should be a string between 1 and 255 characters.</ValidationMessage>
|
||||
<Required>N</Required>
|
||||
</cust_hdr_end_name>
|
||||
<cust_hdr_end type="TextField">
|
||||
<mask>/^.{1,255}$/u</mask>
|
||||
<ValidationMessage>Should be a string between 1 and 255 characters.</ValidationMessage>
|
||||
<Required>N</Required>
|
||||
</cust_hdr_end>
|
||||
<cust_hdr_name type="TextField">
|
||||
<mask>/^.{1,1024}$/u</mask>
|
||||
<ValidationMessage>Should be a string between 1 and 1024 characters.</ValidationMessage>
|
||||
<Required>N</Required>
|
||||
</cust_hdr_name>
|
||||
<cust_hdr type="TextField">
|
||||
<mask>/^.{1,1024}$/u</mask>
|
||||
<ValidationMessage>Should be a string between 1 and 1024 characters.</ValidationMessage>
|
||||
<Required>N</Required>
|
||||
</cust_hdr>
|
||||
<cust_hdr_reg_name type="TextField">
|
||||
<mask>/^.{1,1024}$/u</mask>
|
||||
<ValidationMessage>Should be a string between 1 and 1024 characters.</ValidationMessage>
|
||||
<Required>N</Required>
|
||||
</cust_hdr_reg_name>
|
||||
<cust_hdr_reg type="TextField">
|
||||
<mask>/^.{1,1024}$/u</mask>
|
||||
<ValidationMessage>Should be a string between 1 and 1024 characters.</ValidationMessage>
|
||||
<Required>N</Required>
|
||||
</cust_hdr_reg>
|
||||
<cust_hdr_sub_name type="TextField">
|
||||
<mask>/^.{1,255}$/u</mask>
|
||||
<ValidationMessage>Should be a string between 1 and 255 characters.</ValidationMessage>
|
||||
<Required>N</Required>
|
||||
</cust_hdr_sub_name>
|
||||
<cust_hdr_sub type="TextField">
|
||||
<mask>/^.{1,255}$/u</mask>
|
||||
<ValidationMessage>Should be a string between 1 and 255 characters.</ValidationMessage>
|
||||
<Required>N</Required>
|
||||
</cust_hdr_sub>
|
||||
<url_param type="TextField">
|
||||
<mask>/^.{1,4096}$/u</mask>
|
||||
<Required>N</Required>
|
||||
|
||||
@@ -158,6 +158,41 @@
|
||||
{% 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) %}
|
||||
{% 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) %}
|
||||
{% 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) %}
|
||||
{% 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) %}
|
||||
{% 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) %}
|
||||
{% 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) %}
|
||||
|
||||
Reference in New Issue
Block a user