From 0f7893d20726dde6d5e3dbf39514e4808973a549 Mon Sep 17 00:00:00 2001 From: Frank Wall Date: Sun, 22 Oct 2017 15:47:04 +0200 Subject: [PATCH 01/10] net/haproxy: extensive model refactoring, refs #208 --- .../OPNsense/HAProxy/forms/dialogAcl.xml | 253 +++++++++++- .../OPNsense/HAProxy/forms/dialogAction.xml | 291 ++++++++++++-- .../HAProxy/forms/dialogHealthcheck.xml | 54 ++- .../OPNsense/HAProxy/forms/main.xml | 2 +- .../app/models/OPNsense/HAProxy/HAProxy.xml | 359 ++++++++++++++++-- .../OPNsense/HAProxy/Migrations/M2_0_0.php | 292 ++++++++++++++ .../mvc/app/views/OPNsense/HAProxy/index.volt | 36 ++ .../templates/OPNsense/HAProxy/haproxy.conf | 242 ++++++------ 8 files changed, 1331 insertions(+), 198 deletions(-) create mode 100644 net/haproxy/src/opnsense/mvc/app/models/OPNsense/HAProxy/Migrations/M2_0_0.php 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 34579e572..dc61d00ef 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 @@ -12,14 +12,14 @@ Description for this ACL. - + header acl.expression - + dropdown - Select ACL expression. + Select condition type. acl.negate @@ -28,25 +28,246 @@ - acl.value - - text - - - - + header + - acl.urlparam - + acl.hdr_beg + text - Not used for any other expression.]]> + - acl.queryBackend - + + header + + + + acl.hdr_end + + text + + + + + header + + + + acl.hdr + + text + + + + + header + + + + acl.hdr_reg + + text + + + + + header + + + + acl.hdr_sub + + text + + + + + header + + + + acl.path_beg + + text + + + + + header + + + + acl.path_end + + text + + + + + header + + + + acl.path + + text + + + + + header + + + + acl.path_reg + + text + + + + + header + + + + acl.path_dir + + text + + + + + header + + + + acl.path_sub + + text + + + + + header + + + + acl.url_param + + text + + + + acl.url_param_value + + text + + + + + header + + + + acl.ssl_c_verify_code + + text + + + + + header + + + + acl.ssl_c_ca_commonname + + text + + + + + header + + + + acl.src + + text + + + + + header + + + + acl.nbsrv + + text + + + + acl.nbsrv_backend + dropdown - Not used for any other expression.]]> + + + + + header + + + + acl.ssl_sni + + text + + + + + header + + + + acl.ssl_sni_sub + + text + + + + + header + + + + acl.ssl_sni_beg + + text + + + + + header + + + + acl.ssl_sni_end + + text + + + + + header + + + + acl.custom_acl + + text + 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 96e7f306b..ff3ef59dc 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 @@ -12,7 +12,7 @@ Description for this action. - + header @@ -35,47 +35,292 @@ - action.type - - dropdown - - - - + header - action.useBackend + action.type + + dropdown + + + + + header + + + + action.use_backend dropdown - Not used for any other action.]]> + - action.useServer + + header + + + + action.use_server dropdown - Not used for any other action.]]> + - + header + - action.actionName - + action.http-request_auth + text - + - action.actionFind - - text - + + header + - action.actionValue - + action.http-request_redirect + text - + HAProxy's documentation for further details and examples.]]> + + + + header + + + + action.http-request_lua + + text + + + + + header + + + + action.http-request_use-service + + text + + + + + header + + + + action.http-request_add-header_name + + text + + + + action.http-request_add-header_content + + text + HAProxy's documentation for further details and examples.]]> + + + + header + + + + action.http-request_set-header_name + + text + + + + action.http-request_set-header_content + + text + HAProxy's documentation for further details and examples.]]> + + + + header + + + + action.http-request_del-header_name + + text + + + + + header + + + + action.http-request_replace-header_name + + text + + + + action.http-request_replace-header_regex + + text + + + + + header + + + + action.http-request_replace-value_name + + text + + + + action.http-request_replace-value_regex + + text + + + + + header + + + + action.http-response_lua + + text + + + + + header + + + + action.http-response_add-header_name + + text + + + + action.http-response_add-header_content + + text + HAProxy's documentation for further details and examples.]]> + + + + header + + + + action.http-response_set-header_name + + text + + + + action.http-response_set-header_content + + text + HAProxy's documentation for further details and examples.]]> + + + + header + + + + action.http-response_del-header_name + + text + + + + + header + + + + action.http-response_replace-header_name + + text + + + + action.http-response_replace-header_regex + + text + + + + + header + + + + action.http-response_replace-value_name + + text + + + + action.http-response_replace-value_regex + + text + + + + + header + + + + action.tcp-request_content_lua + + text + + + + + header + + + + action.tcp-request_content_use-service + + text + + + + + header + + + + action.tcp-response_content_lua + + text + + + + + header + + + + action.custom + + text + diff --git a/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/forms/dialogHealthcheck.xml b/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/forms/dialogHealthcheck.xml index e81ef4540..e93267ed5 100644 --- a/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/forms/dialogHealthcheck.xml +++ b/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/forms/dialogHealthcheck.xml @@ -33,6 +33,7 @@ header + healthcheck.http_method @@ -61,6 +62,7 @@ header + healthcheck.http_expressionEnabled @@ -88,6 +90,7 @@ header + healthcheck.tcp_enabled @@ -119,25 +122,64 @@ - + header + - healthcheck.agentPort + healthcheck.agent_port text - healthcheck.dbUser - + + header + + + + healthcheck.mysql_user + text - healthcheck.smtpDomain + healthcheck.mysql_post41 + + checkbox + + + + + header + + + + healthcheck.pgsql_user + + text + + + + + header + + + + healthcheck.smtp_domain text - + + + + + header + + + + healthcheck.esmtp_domain + + text + diff --git a/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/forms/main.xml b/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/forms/main.xml index 66a0b4b57..171e5c507 100644 --- a/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/forms/main.xml +++ b/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/forms/main.xml @@ -1,5 +1,5 @@
- + 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 e33063dea..cc61831f4 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 @@ -1,6 +1,6 @@ //OPNsense/HAProxy - 1.0.0 + 2.0.0 the HAProxy load balancer @@ -281,7 +281,6 @@ Related backend item not found N - 0 Y @@ -299,7 +298,6 @@ N - 1 500000 @@ -311,7 +309,6 @@ Should be a number between 1 and 8 characters, optionally followed by either "d", "h", "m", "s", "ms" or "us". N - 0 Y @@ -451,7 +448,6 @@ 0 N - N sourceipv4 @@ -487,7 +483,6 @@ Please specify a value between 1 and 10000. N - /^([0-9]{1,8}(?:us|ms|s|m|h|d)?)/u Should be a number between 1 and 8 characters, optionally followed by either "d", "h", "m", "s", "ms" or "us". @@ -675,7 +670,6 @@ Please specify a value between 1 and 65535. N - N options @@ -752,21 +746,45 @@ N - + 1 65535 Please specify a value between 1 and 65535. N - - + + /^([0-9a-zA-Z._\-]){1,255}$/u Should be a string between 1 and 255 characters. N - - + + + 0 + N + + /^([0-9a-zA-Z._\-]){1,255}$/u Should be a string between 1 and 255 characters. N + + + /^([0-9a-zA-Z._\-]){1,255}$/u + Should be a string between 1 and 255 characters. + N + + + /^([0-9a-zA-Z._\-]){1,255}$/u + Should be a string between 1 and 255 characters. + N + + + + N + + + N + + + N @@ -788,37 +806,160 @@ Y - Host starts with - Host ends with - Host matches - Host regex - Host contains - Path starts with - Path ends with - Path matches - Path regex - Path contains - URL parameter contains + Host starts with + Host ends with + Host matches + Host regex + Host contains + Path starts with + Path ends with + Path matches + Path regex + + Path contains subdir + Path contains string + URL parameter contains SSL/TLS connection established - SSL Client certificate verify error result SSL Client certificate is valid - SSL Client issued by CA common-name - Source IP matches IP or Alias - Minimum count usable servers - Traffic is http (no value needed) - Traffic is ssl (no value needed) - SNI TLS extension matches - SNI TLS extension contains - SNI TLS extension starts with - SNI TLS extension ends with - SNI TLS extension regex - Custom ACL + SSL Client certificate verify error result + SSL Client certificate issued by CA common-name + Source IP matches IP or Alias + Minimum number of usable servers in backend + Traffic is HTTP + Traffic is SSL + SNI TLS extension matches + SNI TLS extension contains + SNI TLS extension starts with + SNI TLS extension ends with + SNI TLS extension regex + Specify a custom ACL 0 Y + + /^.{1,255}$/u + Should be a string between 1 and 255 characters. + N + + + /^.{1,255}$/u + Should be a string between 1 and 255 characters. + N + + + /^.{1,1024}$/u + Should be a string between 1 and 1024 characters. + N + + + /^.{1,1024}$/u + Should be a string between 1 and 1024 characters. + N + + + /^.{1,255}$/u + Should be a string between 1 and 255 characters. + N + + + /^.{1,255}$/u + Should be a string between 1 and 255 characters. + N + + + /^.{1,255}$/u + Should be a string between 1 and 255 characters. + N + + + /^.{1,1024}$/u + Should be a string between 1 and 1024 characters. + N + + + /^.{1,1024}$/u + Should be a string between 1 and 1024 characters. + N + + + /^.{1,255}$/u + Should be a string between 1 and 255 characters. + N + + + /^.{1,255}$/u + Should be a string between 1 and 255 characters. + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + 0 + 500000 + Please specify a value between 0 and 500000. + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + 0 + 500000 + Please specify a value between 0 and 500000. + N + + + + + + Related backend item not found + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + N @@ -835,6 +976,7 @@ Related backend item not found N + N @@ -880,9 +1022,10 @@ Y + - Use Backend - Use Server + Use specified backend + Use specified server http-request allow http-request deny http-request tarpit @@ -913,9 +1056,143 @@ tcp-response content close tcp-response content reject tcp-response content lua script - Custom + Custom Action (HAProxy syntax) + + + + + Related backend item not found + Y + N + + + + + + Related server item not found + Y + N + + + /^.{1,4096}$/u + N + + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + + + /^.{1,4096}$/u + N + +