diff --git a/net/haproxy/Makefile b/net/haproxy/Makefile index 0e7ae42d4c..eea1ecd8b1 100644 --- a/net/haproxy/Makefile +++ b/net/haproxy/Makefile @@ -1,6 +1,5 @@ PLUGIN_NAME= haproxy -PLUGIN_VERSION= 4.6 -PLUGIN_REVISION= 1 +PLUGIN_VERSION= 4.7 PLUGIN_COMMENT= Reliable, high performance TCP/HTTP load balancer PLUGIN_DEPENDS= haproxy30 py${PLUGIN_PYTHON}-haproxy-cli PLUGIN_MAINTAINER= opnsense@moov.de diff --git a/net/haproxy/pkg-descr b/net/haproxy/pkg-descr index 13a4f948b6..d3c0881644 100644 --- a/net/haproxy/pkg-descr +++ b/net/haproxy/pkg-descr @@ -6,6 +6,13 @@ very high loads while needing persistence or Layer7 processing. Plugin Changelog ================ +4.7 + +Added: +* add new rule: http-request silent-drop +* add new condition: HTTP method +* support custom HTTP status code in "http-request deny" rules + 4.6 Changed: diff --git a/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/forms/dialogAcl.xml b/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/forms/dialogAcl.xml index 895bd6e4b2..849a44e850 100644 --- a/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/forms/dialogAcl.xml +++ b/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/forms/dialogAcl.xml @@ -88,6 +88,17 @@ text + + + + header + + + + acl.http_method + + select_multiple + header diff --git a/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/forms/dialogAction.xml b/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/forms/dialogAction.xml index 0386b9f1ae..cfc4cbf392 100644 --- a/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/forms/dialogAction.xml +++ b/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/forms/dialogAction.xml @@ -80,6 +80,17 @@ text + + + header + + + + action.http_request_deny_status + + text + + header diff --git a/net/haproxy/src/opnsense/mvc/app/models/OPNsense/HAProxy/HAProxy.xml b/net/haproxy/src/opnsense/mvc/app/models/OPNsense/HAProxy/HAProxy.xml index e1a40e1c57..59d863b431 100644 --- a/net/haproxy/src/opnsense/mvc/app/models/OPNsense/HAProxy/HAProxy.xml +++ b/net/haproxy/src/opnsense/mvc/app/models/OPNsense/HAProxy/HAProxy.xml @@ -1728,6 +1728,7 @@ HTTP Header matches HTTP Header regex HTTP Header contains + HTTP Method URL parameter contains SSL Client certificate is valid SSL Client certificate verify error result @@ -2195,6 +2196,21 @@ Y N + + N + Y + + CONNECT + DELETE + GET + HEAD + OPTIONS + PATCH + POST + PUT + TRACE + + @@ -2259,6 +2275,7 @@ http-request header replace value http-request set-path http-request set-var + http-request silent-drop http-response allow http-response deny http-response lua script @@ -2323,6 +2340,12 @@ /^.{1,4096}$/u N + + 100 + 999 + Please specify a value between 100 and 999. + N + /^.{1,4096}$/u 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..aa7fd84419 100644 --- a/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/haproxy.conf +++ b/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/haproxy.conf @@ -136,6 +136,13 @@ {% set acl_enabled = '0' %} # ERROR: missing parameters {% endif %} +{% 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 == 'path_beg' %} {% if acl_data.path_beg|default("") != "" %} {% do acl_options.append('path_beg') %} @@ -482,7 +489,11 @@ {% 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') %} +{% if action_data.http_request_deny_status|default("") != "" %} +{% do action_options.append('http-request deny deny_status ' ~ action_data.http_request_deny_status) %} +{% else %} +{% do action_options.append('http-request deny') %} +{% endif %} {% elif action_data.type == 'http-request_tarpit' %} {% do action_options.append('http-request tarpit') %} {% elif action_data.type == 'http-request_auth' %} @@ -561,6 +572,8 @@ {% set action_enabled = '0' %} # ERROR: missing parameters {% endif %} +{% elif action_data.type == 'http-request_silent-drop' %} +{% do action_options.append('http-request silent-drop') %} {% elif action_data.type == 'http-response_allow' %} {% do action_options.append('http-response allow') %} {% elif action_data.type == 'http-response_deny' %}