net/haproxy: extensive model refactoring, refs #208

This commit is contained in:
Frank Wall
2017-10-22 15:47:04 +02:00
parent c552fdbf10
commit 0f7893d207
8 changed files with 1331 additions and 198 deletions
@@ -12,14 +12,14 @@
<help>Description for this ACL.</help>
</field>
<field>
<label>Compose expression</label>
<label>Condition</label>
<type>header</type>
</field>
<field>
<id>acl.expression</id>
<label>Expression</label>
<label>Condition type</label>
<type>dropdown</type>
<hint>Select ACL expression.</hint>
<hint>Select condition type.</hint>
</field>
<field>
<id>acl.negate</id>
@@ -28,25 +28,246 @@
<help><![CDATA[Use this to invert the meaning of the expression.]]></help>
</field>
<field>
<id>acl.value</id>
<label>Value</label>
<type>text</type>
<help><![CDATA[Specify a value to match with the expression.]]></help>
</field>
<field>
<label>Optional parameters</label>
<label>Parameters</label>
<type>header</type>
<style>expression_table table_hdr_beg</style>
</field>
<field>
<id>acl.urlparam</id>
<label>URL parameter</label>
<id>acl.hdr_beg</id>
<label>Host Prefix</label>
<type>text</type>
<help><![CDATA[Specify the URL parameter to be checked for the value specified below.<br/><b>Not used for any other expression.</b>]]></help>
<help><![CDATA[HTTP host header starts with string (prefix match)]]></help>
</field>
<field>
<id>acl.queryBackend</id>
<label>Query Backend</label>
<label>Parameters</label>
<type>header</type>
<style>expression_table table_hdr_end</style>
</field>
<field>
<id>acl.hdr_end</id>
<label>Host Suffix</label>
<type>text</type>
<help><![CDATA[HTTP host header ends with string (suffix match)]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>expression_table table_hdr</style>
</field>
<field>
<id>acl.hdr</id>
<label>Host String</label>
<type>text</type>
<help><![CDATA[HTTP host header matches exact string]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>expression_table table_hdr_reg</style>
</field>
<field>
<id>acl.hdr_reg</id>
<label>Host Regex</label>
<type>text</type>
<help><![CDATA[HTTP host header matches regular expression]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>expression_table table_hdr_sub</style>
</field>
<field>
<id>acl.hdr_sub</id>
<label>Host Contains</label>
<type>text</type>
<help><![CDATA[HTTP host header contains string (substring match)]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>expression_table table_path_beg</style>
</field>
<field>
<id>acl.path_beg</id>
<label>Path Prefix</label>
<type>text</type>
<help><![CDATA[HTTP request URL path starts with string (prefix match)]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>expression_table table_path_end</style>
</field>
<field>
<id>acl.path_end</id>
<label>Path Suffix</label>
<type>text</type>
<help><![CDATA[HTTP request URL path ends with string (suffix match)]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>expression_table table_path</style>
</field>
<field>
<id>acl.path</id>
<label>Path Matches</label>
<type>text</type>
<help><![CDATA[HTTP request URL path matches exact string]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>expression_table table_path_reg</style>
</field>
<field>
<id>acl.path_reg</id>
<label>Path Regex</label>
<type>text</type>
<help><![CDATA[HTTP request URL path matches regular expression]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>expression_table table_path_dir</style>
</field>
<field>
<id>acl.path_dir</id>
<label>Subdir matches</label>
<type>text</type>
<help><![CDATA[HTTP request URL path contains directory (subdir match)]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>expression_table table_path_sub</style>
</field>
<field>
<id>acl.path_sub</id>
<label>Path Contains</label>
<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_url_param</style>
</field>
<field>
<id>acl.url_param</id>
<label>URL Parameter</label>
<type>text</type>
<help><![CDATA[Specify the URL parameter to be checked for the value specified below.]]></help>
</field>
<field>
<id>acl.url_param_value</id>
<label>Parameter Value</label>
<type>text</type>
<help><![CDATA[Specify the value for the URL parameter.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>expression_table table_ssl_c_verify_code</style>
</field>
<field>
<id>acl.ssl_c_verify_code</id>
<label>SSL Error ID</label>
<type>text</type>
<help><![CDATA[Specify the SSL/TLS error ID that should be checked for the incoming connection. Please refer to your SSL library's documentation for an exhaustive list of error codes.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>expression_table table_ssl_c_ca_commonname</style>
</field>
<field>
<id>acl.ssl_c_ca_commonname</id>
<label>CA Common-Name</label>
<type>text</type>
<help><![CDATA[Verify the CA Common-Name of the certificate presented by the client against the specified string.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>expression_table table_src</style>
</field>
<field>
<id>acl.src</id>
<label>Source IP</label>
<type>text</type>
<help><![CDATA[Verify the source IPv4 address of the client of the session matches the specified IPv4 or IPv6 address.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>expression_table table_nbsrv</style>
</field>
<field>
<id>acl.nbsrv</id>
<label>Usable Servers</label>
<type>text</type>
<help><![CDATA[Verify the minimum number of usable servers in the named backend matches the specified value.]]></help>
</field>
<field>
<id>acl.nbsrv_backend</id>
<label>Backend</label>
<type>dropdown</type>
<help><![CDATA[Use this backend to count usable servers.<br/><b>Not used for any other expression.</b>]]></help>
<help><![CDATA[Use the specified backend to count usable servers. Leave empty to use the current backend.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>expression_table table_ssl_sni</style>
</field>
<field>
<id>acl.ssl_sni</id>
<label>SNI Matches</label>
<type>text</type>
<help><![CDATA[The value of the Server Name TLS extension sent by a client matches the exact string.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>expression_table table_ssl_sni_sub</style>
</field>
<field>
<id>acl.ssl_sni_sub</id>
<label>SNI Contains</label>
<type>text</type>
<help><![CDATA[The value of the Server Name TLS extension sent by a client contains the specified string (substring match).]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>expression_table table_ssl_sni_beg</style>
</field>
<field>
<id>acl.ssl_sni_beg</id>
<label>SNI Prefix</label>
<type>text</type>
<help><![CDATA[The value of the Server Name TLS extension sent by a client starts with the specified string (prefix match).]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>expression_table table_ssl_sni_end</style>
</field>
<field>
<id>acl.ssl_sni_end</id>
<label>SNI Suffix</label>
<type>text</type>
<help><![CDATA[The value of the Server Name TLS extension sent by a client ends with the specified string (suffix match).]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>expression_table table_custom_acl</style>
</field>
<field>
<id>acl.custom_acl</id>
<label>Custom ACL</label>
<type>text</type>
<help><![CDATA[Specify a HAProxy ACL that is currently not supported by the GUI. Note that the syntax is not verified.]]></help>
</field>
</form>
@@ -12,7 +12,7 @@
<help>Description for this action.</help>
</field>
<field>
<label>Form condition</label>
<label>Optional condition</label>
<type>header</type>
</field>
<field>
@@ -35,47 +35,292 @@
<help><![CDATA[Choose an logical operator to be used to form a condition.]]></help>
</field>
<field>
<id>action.type</id>
<label>Choose action</label>
<type>dropdown</type>
<help><![CDATA[Choose an action that should be executed if the condition is true.]]></help>
</field>
<field>
<label>Optional parameters</label>
<label>HAProxy function</label>
<type>header</type>
</field>
<field>
<id>action.useBackend</id>
<id>action.type</id>
<label>Run function</label>
<type>dropdown</type>
<help><![CDATA[Choose an action that should be executed if the condition evaluates to true.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>type_table table_use_backend</style>
</field>
<field>
<id>action.use_backend</id>
<label>Use backend</label>
<type>dropdown</type>
<help><![CDATA[Use this backend if the condition is true.<br/><b>Not used for any other action.</b>]]></help>
<help><![CDATA[HAProxy will use this backend if the condition evaluates to true.]]></help>
</field>
<field>
<id>action.useServer</id>
<label>Parameters</label>
<type>header</type>
<style>type_table table_use_server</style>
</field>
<field>
<id>action.use_server</id>
<label>Use server</label>
<type>dropdown</type>
<help><![CDATA[Use this server if the condition is true.<br/><b>Not used for any other action.</b>]]></help>
<help><![CDATA[HAProxy will use this server if the condition evaluates to true.]]></help>
</field>
<field>
<label>Conditional parameters</label>
<label>Parameters</label>
<type>header</type>
<style>type_table table_http-request_auth</style>
</field>
<field>
<id>action.actionName</id>
<label>Name/Identifier</label>
<id>action.http-request_auth</id>
<label>Auth Realm</label>
<type>text</type>
<help><![CDATA[Specify a value to match with the action.]]></help>
<help><![CDATA[When HAProxy requests user name and password from the user, this optiomal authentication realm is returned with the response (typically the application's name).]]></help>
</field>
<field>
<id>action.actionFind</id>
<label>Find value</label>
<type>text</type>
<help><![CDATA[Specify a value to match with the action.]]></help>
<label>Parameters</label>
<type>header</type>
<style>type_table table_http-request_redirect</style>
</field>
<field>
<id>action.actionValue</id>
<label>Set value</label>
<id>action.http-request_redirect</id>
<label>HTTP Redirect</label>
<type>text</type>
<help><![CDATA[Specify a value to match with the action.]]></help>
<help><![CDATA[Use HAProxy's powerful redirect function to return a HTTP redirection. See <a href="http://cbonte.github.io/haproxy-dconv/1.7/configuration.html#redirect">HAProxy's documentation</a> for further details and examples.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>type_table table_http-request_lua</style>
</field>
<field>
<id>action.http-request_lua</id>
<label>Lua function</label>
<type>text</type>
<help><![CDATA[Run the specified Lua function. You will most likely need to include/load your Lua code first.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>type_table table_http-request_use-service</style>
</field>
<field>
<id>action.http-request_use-service</id>
<label>Lua service</label>
<type>text</type>
<help><![CDATA[Register the specified Lua service. You will most likely need to include/load your Lua code first.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>type_table table_http-request_add-header</style>
</field>
<field>
<id>action.http-request_add-header_name</id>
<label>HTTP Header</label>
<type>text</type>
<help><![CDATA[Append a HTTP header field with the specified name.]]></help>
</field>
<field>
<id>action.http-request_add-header_content</id>
<label>Header Content</label>
<type>text</type>
<help><![CDATA[The value that should be set for the specified HTTP header. Note that it's possible to use pre-defined variables, see <a href="http://cbonte.github.io/haproxy-dconv/1.7/configuration.html#8.2.4">HAProxy's documentation</a> for further details and examples.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>type_table table_http-request_set-header</style>
</field>
<field>
<id>action.http-request_set-header_name</id>
<label>HTTP Header</label>
<type>text</type>
<help><![CDATA[Remove the HTTP header field with the specified name and add a new one with the same name. This is useful when passing security information to the server, where the header must not be manipulated by external users.]]></help>
</field>
<field>
<id>action.http-request_set-header_content</id>
<label>Header Content</label>
<type>text</type>
<help><![CDATA[The value that should be set for the specified HTTP header. Note that it's possible to use pre-defined variables, see <a href="http://cbonte.github.io/haproxy-dconv/1.7/configuration.html#8.2.4">HAProxy's documentation</a> for further details and examples.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>type_table table_http-request_del-header</style>
</field>
<field>
<id>action.http-request_del-header_name</id>
<label>HTTP Header</label>
<type>text</type>
<help><![CDATA[Remove the HTTP header field with the specified name.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>type_table table_http-request_replace-header</style>
</field>
<field>
<id>action.http-request_replace-header_name</id>
<label>HTTP Header</label>
<type>text</type>
<help><![CDATA[The name of the HTTP header field.]]></help>
</field>
<field>
<id>action.http-request_replace-header_regex</id>
<label>Regular Expression</label>
<type>text</type>
<help><![CDATA[Matches the specified regular expression in all occurrences of header field.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>type_table table_http-request_replace-value</style>
</field>
<field>
<id>action.http-request_replace-value_name</id>
<label>HTTP Header</label>
<type>text</type>
<help><![CDATA[The name of the HTTP header field.]]></help>
</field>
<field>
<id>action.http-request_replace-value_regex</id>
<label>Regular Expression</label>
<type>text</type>
<help><![CDATA[This is suited for all header fields which are allowed to carry more than one value: Matches the specified regular expression against every comma-delimited value of the header field.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>type_table table_http-response_lua</style>
</field>
<field>
<id>action.http-response_lua</id>
<label>Lua function</label>
<type>text</type>
<help><![CDATA[Run the specified Lua function. You will most likely need to include/load your Lua code first.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>type_table table_http-response_add-header</style>
</field>
<field>
<id>action.http-response_add-header_name</id>
<label>HTTP Header</label>
<type>text</type>
<help><![CDATA[Append a HTTP header field with the specified name.]]></help>
</field>
<field>
<id>action.http-response_add-header_content</id>
<label>Header Content</label>
<type>text</type>
<help><![CDATA[The value that should be set for the specified HTTP header. Note that it's possible to use pre-defined variables, see <a href="http://cbonte.github.io/haproxy-dconv/1.7/configuration.html#8.2.4">HAProxy's documentation</a> for further details and examples.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>type_table table_http-response_set-header</style>
</field>
<field>
<id>action.http-response_set-header_name</id>
<label>HTTP Header</label>
<type>text</type>
<help><![CDATA[Remove the HTTP header field with the specified name and add a new one with the same name. This is useful when passing security information to the server, where the header must not be manipulated by external users.]]></help>
</field>
<field>
<id>action.http-response_set-header_content</id>
<label>Header Content</label>
<type>text</type>
<help><![CDATA[The value that should be set for the specified HTTP header. Note that it's possible to use pre-defined variables, see <a href="http://cbonte.github.io/haproxy-dconv/1.7/configuration.html#8.2.4">HAProxy's documentation</a> for further details and examples.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>type_table table_http-response_del-header</style>
</field>
<field>
<id>action.http-response_del-header_name</id>
<label>HTTP Header</label>
<type>text</type>
<help><![CDATA[Remove the HTTP header field with the specified name.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>type_table table_http-response_replace-header</style>
</field>
<field>
<id>action.http-response_replace-header_name</id>
<label>HTTP Header</label>
<type>text</type>
<help><![CDATA[The name of the HTTP header field.]]></help>
</field>
<field>
<id>action.http-response_replace-header_regex</id>
<label>Regular Expression</label>
<type>text</type>
<help><![CDATA[Matches the specified regular expression in all occurrences of header field.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>type_table table_http-response_replace-value</style>
</field>
<field>
<id>action.http-response_replace-value_name</id>
<label>HTTP Header</label>
<type>text</type>
<help><![CDATA[The name of the HTTP header field.]]></help>
</field>
<field>
<id>action.http-response_replace-value_regex</id>
<label>Regular Expression</label>
<type>text</type>
<help><![CDATA[This is suited for all header fields which are allowed to carry more than one value: Matches the specified regular expression against every comma-delimited value of the header field.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>type_table table_tcp-request_content_lua</style>
</field>
<field>
<id>action.tcp-request_content_lua</id>
<label>Lua function</label>
<type>text</type>
<help><![CDATA[Run the specified Lua function. You will most likely need to include/load your Lua code first.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>type_table table_tcp-request_content_use-service</style>
</field>
<field>
<id>action.tcp-request_content_use-service</id>
<label>Lua service</label>
<type>text</type>
<help><![CDATA[Register the specified Lua service. You will most likely need to include/load your Lua code first.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>type_table table_tcp-response_content_lua</style>
</field>
<field>
<id>action.tcp-response_content_lua</id>
<label>Lua function</label>
<type>text</type>
<help><![CDATA[Run the specified Lua function. You will most likely need to include/load your Lua code first.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>type_table table_custom</style>
</field>
<field>
<id>action.custom</id>
<label>Custom Action</label>
<type>text</type>
<help><![CDATA[Specify a HAProxy Action that is currently not supported by the GUI. Note that the syntax is not verified.]]></help>
</field>
</form>
@@ -33,6 +33,7 @@
<field>
<label>HTTP check options</label>
<type>header</type>
<style>type_table table_http</style>
</field>
<field>
<id>healthcheck.http_method</id>
@@ -61,6 +62,7 @@
<field>
<label>Custom HTTP check</label>
<type>header</type>
<style>type_table table_http</style>
</field>
<field>
<id>healthcheck.http_expressionEnabled</id>
@@ -88,6 +90,7 @@
<field>
<label>Custom TCP check</label>
<type>header</type>
<style>type_table table_tcp</style>
</field>
<field>
<id>healthcheck.tcp_enabled</id>
@@ -119,25 +122,64 @@
<help><![CDATA[Specify the pattern to look for in the response buffer. If the match is set to binary, then the pattern must be passed as a serie of hexadecimal digits in an even number.]]></help>
</field>
<field>
<label>Other check options</label>
<label>Agent check</label>
<type>header</type>
<style>type_table table_agent</style>
</field>
<field>
<id>healthcheck.agentPort</id>
<id>healthcheck.agent_port</id>
<label>Agent port</label>
<type>text</type>
<help><![CDATA[Specify the TCP port used for agent checks.]]></help>
</field>
<field>
<id>healthcheck.dbUser</id>
<label>DB user</label>
<label>MySQL check</label>
<type>header</type>
<style>type_table table_mysql</style>
</field>
<field>
<id>healthcheck.mysql_user</id>
<label>MySQL user</label>
<type>text</type>
<help><![CDATA[Specify the username to be used for database health checks.]]></help>
</field>
<field>
<id>healthcheck.smtpDomain</id>
<id>healthcheck.mysql_post41</id>
<label>MySQL 4.1+</label>
<type>checkbox</type>
<help><![CDATA[Send checks compatible with MySQL server 4.1 and later.]]></help>
</field>
<field>
<label>PostgreSQL check</label>
<type>header</type>
<style>type_table table_pgsql</style>
</field>
<field>
<id>healthcheck.pgsql_user</id>
<label>PostgreSQL user</label>
<type>text</type>
<help><![CDATA[Specify the username to be used for database health checks.]]></help>
</field>
<field>
<label>SMTP check</label>
<type>header</type>
<style>type_table table_smtp</style>
</field>
<field>
<id>healthcheck.smtp_domain</id>
<label>SMTP domain</label>
<type>text</type>
<help><![CDATA[Specify the domain name to present to the server for SMTP/ESMTP health checks.]]></help>
<help><![CDATA[Specify the domain name to present to the server for SMTP health checks.]]></help>
</field>
<field>
<label>ESMTP check</label>
<type>header</type>
<style>type_table table_esmtp</style>
</field>
<field>
<id>healthcheck.esmtp_domain</id>
<label>ESMTP domain</label>
<type>text</type>
<help><![CDATA[Specify the domain name to present to the server for ESMTP health checks.]]></help>
</field>
</form>
@@ -1,5 +1,5 @@
<form>
<tab id="haproxy-general" description="General Settings">
<tab id="haproxy-general" description="Settings">
<subtab id="haproxy-general-settings" description="Service Settings">
<field>
<label>NOTE: You need to configure frontends, backends and servers before enabling HAProxy.</label>
@@ -1,6 +1,6 @@
<model>
<mount>//OPNsense/HAProxy</mount>
<version>1.0.0</version>
<version>2.0.0</version>
<description>
the HAProxy load balancer
</description>
@@ -281,7 +281,6 @@
<ValidationMessage>Related backend item not found</ValidationMessage>
<Required>N</Required>
</defaultBackend>
<!-- XXX: add tag <ssl> once nesting is supported by our framework -->
<ssl_enabled type="BooleanField">
<default>0</default>
<Required>Y</Required>
@@ -299,7 +298,6 @@
<ssl_customOptions type="TextField">
<Required>N</Required>
</ssl_customOptions>
<!-- XXX: add tag <tuning> once nesting is supported by our framework -->
<tuning_maxConnections type="IntegerField">
<MinimumValue>1</MinimumValue>
<MaximumValue>500000</MaximumValue>
@@ -311,7 +309,6 @@
<ValidationMessage>Should be a number between 1 and 8 characters, optionally followed by either "d", "h", "m", "s", "ms" or "us".</ValidationMessage>
<Required>N</Required>
</tuning_timeoutClient>
<!-- XXX: add tag <logging> once nesting is supported by our framework -->
<logging_dontLogNull type="BooleanField">
<default>0</default>
<Required>Y</Required>
@@ -451,7 +448,6 @@
<default>0</default>
<Required>N</Required>
</healthCheckLogStatus>
<!-- XXX: add tag <stickiness> once nesting is supported by our framework -->
<stickiness_pattern type="OptionField">
<Required>N</Required>
<default>sourceipv4</default>
@@ -487,7 +483,6 @@
<ValidationMessage>Please specify a value between 1 and 10000.</ValidationMessage>
<Required>N</Required>
</stickiness_cookielength>
<!-- XXX: add tag <tuning> once nesting is supported by our framework -->
<tuning_timeoutConnect type="TextField">
<mask>/^([0-9]{1,8}(?:us|ms|s|m|h|d)?)/u</mask>
<ValidationMessage>Should be a number between 1 and 8 characters, optionally followed by either "d", "h", "m", "s", "ms" or "us".</ValidationMessage>
@@ -675,7 +670,6 @@
<ValidationMessage>Please specify a value between 1 and 65535.</ValidationMessage>
<Required>N</Required>
</checkport>
<!-- XXX: add tag <http> once nesting is supported by our framework -->
<http_method type="OptionField">
<Required>N</Required>
<default>options</default>
@@ -752,21 +746,45 @@
<tcp_matchValue type="TextField">
<Required>N</Required>
</tcp_matchValue>
<agentPort type="IntegerField">
<agent_port type="IntegerField">
<MinimumValue>1</MinimumValue>
<MaximumValue>65535</MaximumValue>
<ValidationMessage>Please specify a value between 1 and 65535.</ValidationMessage>
<Required>N</Required>
</agentPort>
<dbUser type="TextField">
</agent_port>
<mysql_user type="TextField">
<mask>/^([0-9a-zA-Z._\-]){1,255}$/u</mask>
<ValidationMessage>Should be a string between 1 and 255 characters.</ValidationMessage>
<Required>N</Required>
</dbUser>
<smtpDomain type="TextField">
</mysql_user>
<mysql_post41 type="BooleanField">
<default>0</default>
<Required>N</Required>
</mysql_post41>
<pgsql_user type="TextField">
<mask>/^([0-9a-zA-Z._\-]){1,255}$/u</mask>
<ValidationMessage>Should be a string between 1 and 255 characters.</ValidationMessage>
<Required>N</Required>
</pgsql_user>
<smtp_domain type="TextField">
<mask>/^([0-9a-zA-Z._\-]){1,255}$/u</mask>
<ValidationMessage>Should be a string between 1 and 255 characters.</ValidationMessage>
<Required>N</Required>
</smtp_domain>
<esmtp_domain type="TextField">
<mask>/^([0-9a-zA-Z._\-]){1,255}$/u</mask>
<ValidationMessage>Should be a string between 1 and 255 characters.</ValidationMessage>
<Required>N</Required>
</esmtp_domain>
<!-- XXX old values, required for migration to model 2.0.0 -->
<agentPort type="IntegerField">
<Required>N</Required>
</agentPort>
<dbUser type="TextField">
<Required>N</Required>
</dbUser>
<smtpDomain type="TextField">
<Required>N</Required>
</smtpDomain>
</healthcheck>
</healthchecks>
@@ -788,37 +806,160 @@
<expression type="OptionField">
<Required>Y</Required>
<OptionValues>
<host_starts_with>Host starts with</host_starts_with>
<host_ends_with>Host ends with</host_ends_with>
<host_matches>Host matches</host_matches>
<host_regex>Host regex</host_regex>
<host_contains>Host contains</host_contains>
<path_starts_with>Path starts with</path_starts_with>
<path_ends_with>Path ends with</path_ends_with>
<path_matches>Path matches</path_matches>
<path_regex>Path regex</path_regex>
<path_contains>Path contains</path_contains>
<url_parameter>URL parameter contains</url_parameter>
<hdr_beg>Host starts with</hdr_beg>
<hdr_end>Host ends with</hdr_end>
<hdr>Host matches</hdr>
<hdr_reg>Host regex</hdr_reg>
<hdr_sub>Host contains</hdr_sub>
<path_beg>Path starts with</path_beg>
<path_end>Path ends with</path_end>
<path>Path matches</path>
<path_reg>Path regex</path_reg>
<!-- XXX: Notes for migration (added a new similar option):
path_contains = path_dir (Path contains subdir)
NEW: path_sub (Path contains string) -->
<path_dir>Path contains subdir</path_dir>
<path_sub>Path contains string</path_sub>
<url_param>URL parameter contains</url_param>
<ssl_fc>SSL/TLS connection established</ssl_fc>
<ssl_c_verify_code>SSL Client certificate verify error result</ssl_c_verify_code>
<ssl_c_verify>SSL Client certificate is valid</ssl_c_verify>
<ssl_c_ca_commonname>SSL Client issued by CA common-name</ssl_c_ca_commonname>
<source_ip>Source IP matches IP or Alias</source_ip>
<backendservercount>Minimum count usable servers</backendservercount>
<traffic_is_http>Traffic is http (no value needed)</traffic_is_http>
<traffic_is_ssl>Traffic is ssl (no value needed)</traffic_is_ssl>
<ssl_sni_matches>SNI TLS extension matches</ssl_sni_matches>
<ssl_sni_contains>SNI TLS extension contains</ssl_sni_contains>
<ssl_sni_starts_with>SNI TLS extension starts with</ssl_sni_starts_with>
<ssl_sni_ends_with>SNI TLS extension ends with</ssl_sni_ends_with>
<ssl_sni_regex>SNI TLS extension regex</ssl_sni_regex>
<custom_acl>Custom ACL</custom_acl>
<ssl_c_verify_code>SSL Client certificate verify error result</ssl_c_verify_code>
<ssl_c_ca_commonname>SSL Client certificate issued by CA common-name</ssl_c_ca_commonname>
<src>Source IP matches IP or Alias</src>
<nbsrv>Minimum number of usable servers in backend</nbsrv>
<traffic_is_http>Traffic is HTTP</traffic_is_http>
<traffic_is_ssl>Traffic is SSL</traffic_is_ssl>
<ssl_sni>SNI TLS extension matches</ssl_sni>
<ssl_sni_sub>SNI TLS extension contains</ssl_sni_sub>
<ssl_sni_beg>SNI TLS extension starts with</ssl_sni_beg>
<ssl_sni_end>SNI TLS extension ends with</ssl_sni_end>
<ssl_sni_reg>SNI TLS extension regex</ssl_sni_reg>
<custom_acl>Specify a custom ACL</custom_acl>
</OptionValues>
</expression>
<negate type="BooleanField">
<default>0</default>
<Required>Y</Required>
</negate>
<hdr_beg type="TextField">
<mask>/^.{1,255}$/u</mask>
<ValidationMessage>Should be a string between 1 and 255 characters.</ValidationMessage>
<Required>N</Required>
</hdr_beg>
<hdr_end type="TextField">
<mask>/^.{1,255}$/u</mask>
<ValidationMessage>Should be a string between 1 and 255 characters.</ValidationMessage>
<Required>N</Required>
</hdr_end>
<hdr type="TextField">
<mask>/^.{1,1024}$/u</mask>
<ValidationMessage>Should be a string between 1 and 1024 characters.</ValidationMessage>
<Required>N</Required>
</hdr>
<hdr_reg type="TextField">
<mask>/^.{1,1024}$/u</mask>
<ValidationMessage>Should be a string between 1 and 1024 characters.</ValidationMessage>
<Required>N</Required>
</hdr_reg>
<hdr_sub type="TextField">
<mask>/^.{1,255}$/u</mask>
<ValidationMessage>Should be a string between 1 and 255 characters.</ValidationMessage>
<Required>N</Required>
</hdr_sub>
<path_beg type="TextField">
<mask>/^.{1,255}$/u</mask>
<ValidationMessage>Should be a string between 1 and 255 characters.</ValidationMessage>
<Required>N</Required>
</path_beg>
<path_end type="TextField">
<mask>/^.{1,255}$/u</mask>
<ValidationMessage>Should be a string between 1 and 255 characters.</ValidationMessage>
<Required>N</Required>
</path_end>
<path type="TextField">
<mask>/^.{1,1024}$/u</mask>
<ValidationMessage>Should be a string between 1 and 1024 characters.</ValidationMessage>
<Required>N</Required>
</path>
<path_reg type="TextField">
<mask>/^.{1,1024}$/u</mask>
<ValidationMessage>Should be a string between 1 and 1024 characters.</ValidationMessage>
<Required>N</Required>
</path_reg>
<path_dir type="TextField">
<mask>/^.{1,255}$/u</mask>
<ValidationMessage>Should be a string between 1 and 255 characters.</ValidationMessage>
<Required>N</Required>
</path_dir>
<path_sub type="TextField">
<mask>/^.{1,255}$/u</mask>
<ValidationMessage>Should be a string between 1 and 255 characters.</ValidationMessage>
<Required>N</Required>
</path_sub>
<url_param type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</url_param>
<url_param_value type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</url_param_value>
<ssl_c_verify_code type="IntegerField">
<MinimumValue>0</MinimumValue>
<MaximumValue>500000</MaximumValue>
<ValidationMessage>Please specify a value between 0 and 500000.</ValidationMessage>
<Required>N</Required>
</ssl_c_verify_code>
<ssl_c_ca_commonname type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</ssl_c_ca_commonname>
<src type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</src>
<nbsrv type="IntegerField">
<MinimumValue>0</MinimumValue>
<MaximumValue>500000</MaximumValue>
<ValidationMessage>Please specify a value between 0 and 500000.</ValidationMessage>
<Required>N</Required>
</nbsrv>
<nbsrv_backend type="ModelRelationField">
<Model>
<template>
<source>OPNsense.HAProxy.HAProxy</source>
<items>backends.backend</items>
<display>name</display>
</template>
</Model>
<ValidationMessage>Related backend item not found</ValidationMessage>
<Required>N</Required>
</nbsrv_backend>
<ssl_sni type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</ssl_sni>
<ssl_sni_sub type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</ssl_sni_sub>
<ssl_sni_beg type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</ssl_sni_beg>
<ssl_sni_end type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</ssl_sni_end>
<ssl_sni_reg type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</ssl_sni_reg>
<custom_acl type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</custom_acl>
<!-- XXX old values, required for migration to model 2.0.0 -->
<value type="TextField">
<Required>N</Required>
</value>
@@ -835,6 +976,7 @@
</Model>
<ValidationMessage>Related backend item not found</ValidationMessage>
<Required>N</Required>
<Required>N</Required>
</queryBackend>
</acl>
</acls>
@@ -880,9 +1022,10 @@
</operator>
<type type="OptionField">
<Required>Y</Required>
<!-- XXX TODO: use more user-friendly names instead of HAProxys option names -->
<OptionValues>
<use_backend>Use Backend</use_backend>
<use_server>Use Server</use_server>
<use_backend>Use specified backend</use_backend>
<use_server>Use specified server</use_server>
<http-request_allow>http-request allow</http-request_allow>
<http-request_deny>http-request deny</http-request_deny>
<http-request_tarpit>http-request tarpit</http-request_tarpit>
@@ -913,9 +1056,143 @@
<tcp-response_content_close>tcp-response content close</tcp-response_content_close>
<tcp-response_content_reject>tcp-response content reject</tcp-response_content_reject>
<tcp-response_content_lua>tcp-response content lua script</tcp-response_content_lua>
<custom>Custom</custom>
<custom>Custom Action (HAProxy syntax)</custom>
</OptionValues>
</type>
<use_backend type="ModelRelationField">
<Model>
<template>
<source>OPNsense.HAProxy.HAProxy</source>
<items>backends.backend</items>
<display>name</display>
</template>
</Model>
<ValidationMessage>Related backend item not found</ValidationMessage>
<Multiple>Y</Multiple>
<Required>N</Required>
</use_backend>
<use_server type="ModelRelationField">
<Model>
<template>
<source>OPNsense.HAProxy.HAProxy</source>
<items>servers.server</items>
<display>name</display>
</template>
</Model>
<ValidationMessage>Related server item not found</ValidationMessage>
<Multiple>Y</Multiple>
<Required>N</Required>
</use_server>
<http_request_auth type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</http_request_auth>
<!-- XXX: add support for all "redirect" parameters as separate fields -->
<http_request_redirect type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</http_request_redirect>
<http_request_lua type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</http_request_lua>
<http_request_use_service type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</http_request_use_service>
<http_request_add_header_name type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</http_request_add_header_name>
<http_request_add_header_content type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</http_request_add_header_content>
<http_request_set_header_name type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</http_request_set_header_name>
<http_request_set_header_content type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</http_request_set_header_content>
<http_request_del_header_name type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</http_request_del_header_name>
<http_request_replace_header_name type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</http_request_replace_header_name>
<http_request_replace_header_regex type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</http_request_replace_header_regex>
<http_request_replace_value_name type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</http_request_replace_value_name>
<http_request_replace_value_regex type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</http_request_replace_value_regex>
<http_response_lua type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</http_response_lua>
<http_response_add_header_name type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</http_response_add_header_name>
<http_response_add_header_content type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</http_response_add_header_content>
<http_response_set_header_name type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</http_response_set_header_name>
<http_response_set_header_content type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</http_response_set_header_content>
<http_response_del_header_name type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</http_response_del_header_name>
<http_response_replace_header_name type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</http_response_replace_header_name>
<http_response_replace_header_regex type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</http_response_replace_header_regex>
<http_response_replace_value_name type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</http_response_replace_value_name>
<http_response_replace_value_regex type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</http_response_replace_value_regex>
<tcp_request_content_lua type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</tcp_request_content_lua>
<tcp_request_content_use_service type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</tcp_request_content_use_service>
<tcp_response_content_lua type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</tcp_response_content_lua>
<custom type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</custom>
<!-- XXX old values, required for migration to model 2.0.0 -->
<useBackend type="ModelRelationField">
<Model>
<template>
@@ -941,13 +1218,13 @@
<Required>N</Required>
</useServer>
<actionName type="TextField">
<Required>N</Required>
<Required>N</Required>
</actionName>
<actionFind type="TextField">
<Required>N</Required>
<Required>N</Required>
</actionFind>
<actionValue type="TextField">
<Required>N</Required>
<Required>N</Required>
</actionValue>
</action>
</actions>
@@ -0,0 +1,292 @@
<?php
/**
* Copyright (C) 2017 Frank Wall
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
namespace OPNsense\HAProxy\Migrations;
use OPNsense\Base\BaseModelMigration;
class M2_0_0 extends BaseModelMigration
{
public function run($model)
{
// Migrate ACLs
foreach ($model->getNodeByReference('acls.acl')->__items as $acl) {
switch ((string)$acl->expression) {
case 'host_starts_with':
$acl->expression = 'hdr_beg';
$acl->hdr_beg = (string)$acl->value;
$acl->value = NULL;
break;
case 'host_ends_with':
$acl->expression = 'hdr_end';
$acl->hdr_end = (string)$acl->value;
$acl->value = NULL;
break;
case 'host_matches':
$acl->expression = 'hdr';
$acl->hdr = (string)$acl->value;
$acl->value = NULL;
break;
case 'host_regex':
$acl->expression = 'hdr_reg';
$acl->hdr_reg = (string)$acl->value;
$acl->value = NULL;
break;
case 'host_contains':
$acl->expression = 'hdr_sub';
$acl->hdr_sub = (string)$acl->value;
$acl->value = NULL;
break;
case 'path_starts_with':
echo "DEBUG: migrating : " . (string)$acl->name . "\n";
echo " DEBUG: value: " . (string)$acl->value . "\n";
$acl->expression = 'path_beg';
$acl->path_beg = (string)$acl->value;
$acl->value = NULL;
break;
case 'path_ends_with':
$acl->expression = 'path_end';
$acl->path_end = (string)$acl->value;
$acl->value = NULL;
break;
case 'path_matches':
$acl->expression = 'path';
$acl->path = (string)$acl->value;
$acl->value = NULL;
break;
case 'path_regex':
$acl->expression = 'path_reg';
$acl->path_reg = (string)$acl->value;
$acl->value = NULL;
break;
case 'path_contains':
$acl->expression = 'path_dir';
$acl->path_dir = (string)$acl->value;
$acl->value = NULL;
break;
case 'url_parameter':
$acl->expression = 'url_param';
$acl->url_param_value = (string)$acl->value;
$acl->value = NULL;
break;
case 'ssl_c_verify_code':
$acl->ssl_c_verify_code = (string)$acl->value;
$acl->value = NULL;
break;
case 'ssl_c_ca_commonname':
$acl->ssl_c_ca_commonname = (string)$acl->value;
$acl->value = NULL;
break;
case 'source_ip':
$acl->expression = 'src';
$acl->src = (string)$acl->value;
$acl->value = NULL;
break;
case 'backendservercount':
$acl->expression = 'nbsrv';
$acl->nbsrv = (string)$acl->value;
$acl->nbsrv_backend = (string)$acl->queryBackend;
$acl->value = NULL;
$acl->queryBackend = NULL;
break;
case 'ssl_sni_matches':
$acl->expression = 'ssl_sni';
$acl->ssl_sni = (string)$acl->value;
$acl->value = NULL;
break;
case 'ssl_sni_contains':
$acl->expression = 'ssl_sni_sub';
$acl->ssl_sni_sub = (string)$acl->value;
$acl->value = NULL;
break;
case 'ssl_sni_starts_with':
$acl->expression = 'ssl_sni_beg';
$acl->ssl_sni_beg = (string)$acl->value;
$acl->value = NULL;
break;
case 'ssl_sni_ends_with':
$acl->expression = 'ssl_sni_end';
$acl->ssl_sni_end = (string)$acl->value;
$acl->value = NULL;
break;
case 'ssl_sni_regex':
$acl->expression = 'ssl_sni_reg';
$acl->ssl_sni_reg = (string)$acl->value;
$acl->value = NULL;
break;
case 'custom_acl':
$acl->custom_acl = (string)$acl->value;
$acl->value = NULL;
break;
default:
echo "DEBUG: no ACL migration required: " . (string)$acl->name . "\n";
}
}
// Migrate Actions
foreach ($model->getNodeByReference('actions.action')->__items as $action) {
switch ((string)$action->type) {
case 'use_backend':
$action->use_backend = (string)$action->useBackend;
$action->useBackend = NULL;
break;
case 'use_server':
$action->use_server = (string)$action->useServer;
$action->useServer = NULL;
break;
case 'http-request_auth':
$action->http_request_auth = (string)$action->actionValue;
$action->actionValue = NULL;
break;
case 'http-request_redirect':
$action->http_request_redirect = (string)$action->actionValue;
$action->actionValue = NULL;
break;
case 'http-request_lua':
$action->http_request_lua = (string)$action->actionValue;
$action->actionValue = NULL;
break;
case 'http-request_use-service':
$action->http_request_use_service = (string)$action->actionValue;
$action->actionValue = NULL;
break;
case 'http-request_add-header':
$action->http_request_add_header_name = (string)$action->actionName;
$action->http_request_add_header_content = (string)$action->actionValue;
$action->actionName = NULL;
$action->actionValue = NULL;
break;
case 'http-request_set-header':
$action->http_request_set_header_name = (string)$action->actionName;
$action->http_request_set_header_content = (string)$action->actionValue;
$action->actionName = NULL;
$action->actionValue = NULL;
break;
case 'http-request_del-header':
$action->http_request_del_header_name = (string)$action->actionName;
$action->actionName = NULL;
break;
case 'http-request_replace-header':
$action->http_request_replace_header_name = (string)$action->actionName;
$action->http_request_replace_header_regex = (string)$action->actionFind . ' ' . (string)$action->actionValue;
$action->actionName = NULL;
$action->actionFind = NULL;
$action->actionValue = NULL;
break;
case 'http-request_replace-value':
$action->http_request_replace_value_name = (string)$action->actionName;
$action->http_request_replace_value_regex = (string)$action->actionFind . ' ' . (string)$action->actionValue;
$action->actionName = NULL;
$action->actionFind = NULL;
$action->actionValue = NULL;
break;
case 'http-response_lua':
$action->http_response_lua = (string)$action->actionValue;
$action->actionValue = NULL;
break;
case 'http-response_add-header':
$action->http_response_add_header_name = (string)$action->actionName;
$action->http_response_add_header_content = (string)$action->actionValue;
$action->actionName = NULL;
$action->actionValue = NULL;
break;
case 'http-response_set-header':
$action->http_response_set_header_name = (string)$action->actionName;
$action->http_response_set_header_content = (string)$action->actionValue;
$action->actionName = NULL;
$action->actionValue = NULL;
break;
case 'http-response_del-header':
$action->http_response_del_header_name = (string)$action->actionName;
$action->actionName = NULL;
break;
case 'http-response_replace-header':
$action->http_response_replace_header_name = (string)$action->actionName;
$action->http_response_replace_header_regex = (string)$action->actionFind . ' ' . (string)$action->actionValue;
$action->actionName = NULL;
$action->actionFind = NULL;
$action->actionValue = NULL;
break;
case 'http-response_replace-value':
$action->http_response_replace_value_name = (string)$action->actionName;
$action->http_response_replace_value_regex = (string)$action->actionFind . ' ' . (string)$action->actionValue;
$action->actionName = NULL;
$action->actionFind = NULL;
$action->actionValue = NULL;
break;
case 'tcp-request_content_lua':
$action->tcp_request_content_lua = (string)$action->actionValue;
$action->actionValue = NULL;
break;
case 'tcp-request_content_use-service':
$action->tcp_request_content_use_service = (string)$action->actionValue;
$action->actionValue = NULL;
break;
case 'tcp-response_content_lua':
$action->tcp_response_content_lua = (string)$action->actionValue;
$action->actionValue = NULL;
break;
case 'custom':
$action->custom = (string)$action->actionValue;
$action->actionValue = NULL;
break;
default:
echo "DEBUG: no Action migration required: " . (string)$action->name . "\n";
}
}
// Migrate Healthchecks
foreach ($model->getNodeByReference('healthchecks.healthcheck')->__items as $hc) {
switch ((string)$hc->type) {
case 'agent':
$hc->agent_port = (string)$hc->agentPort;
$hc->agentPort = NULL;
break;
case 'mysql':
$hc->mysql_user = (string)$hc->dbUser;
$hc->dbUser = NULL;
break;
case 'pgsql':
$hc->pgsql_user = (string)$hc->dbUser;
$hc->dbUser = NULL;
break;
case 'smtp':
$hc->smtp_domain = (string)$hc->smtpDomain;
$hc->smtpDomain = NULL;
break;
case 'esmtp':
$hc->esmtp_domain = (string)$hc->smtpDomain;
$hc->smtpDomain = NULL;
break;
default:
echo "DEBUG: no Healthcheck migration required: " . (string)$hc->name . "\n";
}
}
}
}
@@ -146,6 +146,42 @@ POSSIBILITY OF SUCH DAMAGE.
}
);
// hook into on-show event for dialog to extend layout.
$('#DialogAcl').on('shown.bs.modal', function (e) {
$("#acl\\.expression").change(function(){
var service_id = 'table_' + $(this).val();
console.log("[debug_X] " + service_id + " | " + "\n")
$(".expression_table").hide();
// $(".table_"+$(this).val()).show();
$("."+service_id).show();
});
$("#acl\\.expression").change();
})
// hook into on-show event for dialog to extend layout.
$('#DialogAction').on('shown.bs.modal', function (e) {
$("#action\\.type").change(function(){
var service_id = 'table_' + $(this).val();
console.log("[debug_Y] " + service_id + " | " + "\n")
$(".type_table").hide();
// $(".table_"+$(this).val()).show();
$("."+service_id).show();
});
$("#action\\.type").change();
})
// hook into on-show event for dialog to extend layout.
$('#DialogHealthcheck').on('shown.bs.modal', function (e) {
$("#healthcheck\\.type").change(function(){
var service_id = 'table_' + $(this).val();
console.log("[debug_Z] " + service_id + " | " + "\n")
$(".type_table").hide();
// $(".table_"+$(this).val()).show();
$("."+service_id).show();
});
$("#healthcheck\\.type").change();
})
/***********************************************************************
* Commands
**********************************************************************/
@@ -63,86 +63,93 @@
{% endif %}
{% do acls_seen.append(acl_data.id) %}
{% set acl_options = [] %}
{% if acl_data.expression == 'host_starts_with' %}
{% if acl_data.value|default("") != "" %}
{% do acl_options.append('hdr_beg(host) -i ' ~ acl_data.value) %}
{% if acl_data.expression == 'hdr_beg' %}
{% if acl_data.hdr_beg|default("") != "" %}
{% do acl_options.append('hdr_beg(host) -i ' ~ acl_data.hdr_beg) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
{% elif acl_data.expression == 'host_ends_with' %}
{% if acl_data.value|default("") != "" %}
{% do acl_options.append('hdr_end(host) -i ' ~ acl_data.value) %}
{% elif acl_data.expression == 'hdr_end' %}
{% if acl_data.hdr_end|default("") != "" %}
{% do acl_options.append('hdr_end(host) -i ' ~ acl_data.hdr_end) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
{% elif acl_data.expression == 'host_matches' %}
{% if acl_data.value|default("") != "" %}
{% do acl_options.append('hdr(host) -i ' ~ acl_data.value) %}
{% elif acl_data.expression == 'hdr' %}
{% if acl_data.hdr|default("") != "" %}
{% do acl_options.append('hdr(host) -i ' ~ acl_data.hdr) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
{% elif acl_data.expression == 'host_regex' %}
{% if acl_data.value|default("") != "" %}
{% do acl_options.append('hdr_reg(host) -i ' ~ acl_data.value) %}
{% elif acl_data.expression == 'hdr_reg' %}
{% if acl_data.hdr_reg|default("") != "" %}
{% do acl_options.append('hdr_reg(host) -i ' ~ acl_data.hdr_reg) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
{% elif acl_data.expression == 'host_contains' %}
{% if acl_data.value|default("") != "" %}
{% do acl_options.append('hdr_sub(host) -i ' ~ acl_data.value) %}
{% elif acl_data.expression == 'hdr_sub' %}
{% if acl_data.hdr_sub|default("") != "" %}
{% do acl_options.append('hdr_sub(host) -i ' ~ acl_data.hdr_sub) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
{% elif acl_data.expression == 'path_starts_with' %}
{% if acl_data.value|default("") != "" %}
{% do acl_options.append('path_beg -i ' ~ acl_data.value) %}
{% elif acl_data.expression == 'path_beg' %}
{% if acl_data.path_beg|default("") != "" %}
{% do acl_options.append('path_beg -i ' ~ acl_data.path_beg) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
{% elif acl_data.expression == 'path_ends_with' %}
{% if acl_data.value|default("") != "" %}
{% do acl_options.append('path_end -i ' ~ acl_data.value) %}
{% elif acl_data.expression == 'path_end' %}
{% if acl_data.path_end|default("") != "" %}
{% do acl_options.append('path_end -i ' ~ acl_data.path_end) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
{% elif acl_data.expression == 'path_matches' %}
{% if acl_data.value|default("") != "" %}
{% do acl_options.append('path -i ' ~ acl_data.value) %}
{% elif acl_data.expression == 'path' %}
{% if acl_data.path|default("") != "" %}
{% do acl_options.append('path -i ' ~ acl_data.path) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
{% elif acl_data.expression == 'path_regex' %}
{% if acl_data.value|default("") != "" %}
{% do acl_options.append('path_reg -i ' ~ acl_data.value) %}
{% elif acl_data.expression == 'path_reg' %}
{% if acl_data.path_reg|default("") != "" %}
{% do acl_options.append('path_reg -i ' ~ acl_data.path_reg) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
{% elif acl_data.expression == 'path_contains' %}
{% if acl_data.value|default("") != "" %}
{% do acl_options.append('path_dir -i ' ~ acl_data.value) %}
{% elif acl_data.expression == 'path_dir' %}
{% if acl_data.path_dur|default("") != "" %}
{% do acl_options.append('path_dir -i ' ~ acl_data.path_dir) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
{% elif acl_data.expression == 'url_parameter' %}
{% if acl_data.value|default("") != "" and acl_data.urlparam|default("") != "" %}
{% do acl_options.append('url_param(' ~ acl_data.urlparam ~ ') -i ' ~ acl_data.value) %}
{% elif acl_data.expression == 'path_sub' %}
{% if acl_data.path_sub|default("") != "" %}
{% do acl_options.append('path_sub -i ' ~ acl_data.path_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) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
{% elif acl_data.expression == 'ssl_c_verify_code' %}
{% if acl_data.value|default("") != "" %}
{% do acl_options.append('ssl_c_verify ' ~ acl_data.value) %}
{% if acl_data.ssl_c_verify_code|default("") != "" %}
{% do acl_options.append('ssl_c_verify ' ~ acl_data.ssl_c_verify_code) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
@@ -150,25 +157,29 @@
{% elif acl_data.expression == 'ssl_c_verify' %}
{% do acl_options.append('ssl_c_verify 0') %}
{% elif acl_data.expression == 'ssl_c_ca_commonname' %}
{% if acl_data.value|default("") != "" %}
{% do acl_options.append('ssl_c_i_dn(CN) ' ~ acl_data.value) %}
{% if acl_data.ssl_c_ca_commonname|default("") != "" %}
{% do acl_options.append('ssl_c_i_dn(CN) ' ~ acl_data.ssl_c_ca_commonname) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
{% elif acl_data.expression == 'ssl_fc' %}
{% do acl_options.append('ssl_fc') %}
{% elif acl_data.expression == 'source_ip' %}
{% if acl_data.value|default("") != "" %}
{% do acl_options.append('src ' ~ acl_data.value) %}
{% 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 == 'backendservercount' %}
{% elif acl_data.expression == 'nbsrv' %}
{% do acl_options.append('') %}
{% if acl_data.value|default("") != "" and acl_data.queryBackend|default("") != "" %}
{% do acl_options.append('nbsrv(backend_' ~ acl_data.queryBackend ~ ') ge ' ~ acl_data.value) %}
{% if acl_data.nbsrv|default("") != "" %}
{% if acl_data.nbsrv_backend|default("") != "" %}
{% do acl_options.append('nbsrv(backend_' ~ acl_data.nbsrv_backend ~ ') ge ' ~ acl_data.nbsrv) %}
{% else %}
{% do acl_options.append('nbsrv ge ' ~ acl_data.nbsrv) %}
{% endif %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
@@ -177,44 +188,44 @@
{% 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_sni_matches' %}
{% if acl_data.value|default("") != "" %}
{% do acl_options.append('req.ssl_sni -i ' ~ acl_data.value) %}
{% elif acl_data.expression == 'ssl_sni' %}
{% if acl_data.ssl_sni|default("") != "" %}
{% do acl_options.append('req.ssl_sni -i ' ~ acl_data.ssl_sni) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
{% elif acl_data.expression == 'ssl_sni_contains' %}
{% if acl_data.value|default("") != "" %}
{% do acl_options.append('req.ssl_sni -m sub -i ' ~ acl_data.value) %}
{% 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) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
{% elif acl_data.expression == 'ssl_sni_starts_with' %}
{% if acl_data.value|default("") != "" %}
{% do acl_options.append('req.ssl_sni -m beg -i ' ~ acl_data.value) %}
{% 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) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
{% elif acl_data.expression == 'ssl_sni_ends_with' %}
{% if acl_data.value|default("") != "" %}
{% do acl_options.append('req.ssl_sni -m end -i ' ~ acl_data.value) %}
{% 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) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
{% elif acl_data.expression == 'ssl_sni_regex' %}
{% if acl_data.value|default("") != "" %}
{% do acl_options.append('req.ssl_sni -m reg -i ' ~ acl_data.value) %}
{% 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) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
{% elif acl_data.expression == 'custom_acl' %}
{% if acl_data.value|default("") != "" %}
{% do acl_options.append(acl_data.value) %}
{% if acl_data.custom_acl|default("") != "" %}
{% do acl_options.append(acl_data.custom_acl) %}
{% else %}
{% set acl_enabled = '0' %}
# ERROR: missing parameters
@@ -240,16 +251,16 @@
{% set action_enabled = '1' %}
{% set action_options = [] %}
{% if action_data.type == 'use_backend' %}
{% if action_data.useBackend|default("") != "" %}
{% set acl_backend_data = helpers.getUUID(action_data.useBackend) %}
{% 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.useServer|default("") != "" %}
{% set server_data = helpers.getUUID(action_data.useServer) %}
{% 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' %}
@@ -262,64 +273,63 @@
{% elif action_data.type == 'http-request_tarpit' %}
{% do action_options.append('http-request tarpit') %}
{% elif action_data.type == 'http-request_auth' %}
{% if action_data.actionValue|default("") != "" %}
{% do action_options.append('http-request auth ' ~ action_data.actionValue) %}
{% if action_data.http_request_auth|default("") != "" %}
{% do action_options.append('http-request auth realm ' ~ action_data.http_request_auth) %}
{% else %}
{% set action_enabled = '0' %}
# ERROR: missing parameters
{% do action_options.append('http-request auth') %}
{% endif %}
{% elif action_data.type == 'http-request_redirect' %}
{% if action_data.actionValue|default("") != "" %}
{% do action_options.append('http-request redirect ' ~ action_data.actionValue) %}
{% 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.actionValue|default("") != "" %}
{% do action_options.append('http-request lua.' ~ action_data.actionValue) %}
{% 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.actionValue|default("") != "" %}
{% do action_options.append('http-request use-service lua.' ~ action_data.actionValue) %}
{% 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.actionValue|default("") != "" and action_data.actionName|default("") != "" %}
{% do action_options.append('http-request add-header ' ~ action_data.actionName ~ ' ' ~ action_data.actionValue) %}
{% 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.actionValue|default("") != "" and action_data.actionName|default("") != "" %}
{% do action_options.append('http-request set-header ' ~ action_data.actionName ~ ' ' ~ action_data.actionValue) %}
{% 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.actionName|default("") != "" %}
{% do action_options.append('http-request del-header' ~ action_data.actionName) %}
{% 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.actionValue|default("") != "" and action_data.actionName|default("") != "" and action_data.actionFind|default("") != "" %}
{% do action_options.append('http-request replace-header ' ~ action_data.actionName ~ ' ' ~ action_data.actionFind ~ ' ' ~ action_data.actionValue) %}
{% 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.actionValue|default("") != "" and action_data.actionName|default("") != "" and action_data.actionFind|default("") != "" %}
{% do action_options.append('http-request replace-value ' ~ action_data.actionName ~ ' ' ~ action_data.actionFind ~ ' ' ~ action_data.actionValue) %}
{% 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
@@ -329,43 +339,43 @@
{% elif action_data.type == 'http-response_deny' %}
{% do action_options.append('http-response deny') %}
{% elif action_data.type == 'http-response_lua' %}
{% if action_data.actionValue|default("") != "" %}
{% do action_options.append('http-response lua.' ~ action_data.actionValue) %}
{% 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.actionValue|default("") != "" and action_data.actionName|default("") != "" %}
{% do action_options.append('http-response add-header ' ~ action_data.actionName ~ ' ' ~ action_data.actionValue) %}
{% 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.actionValue|default("") != "" and action_data.actionName|default("") != "" %}
{% do action_options.append('http-response set-header ' ~ action_data.actionName ~ ' ' ~ action_data.actionValue) %}
{% 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
{% endif %}
{% elif action_data.type == 'http-response_del-header' %}
{% if action_data.actionName|default("") != "" %}
{% do action_options.append('http-response del-header' ~ action_data.actionName) %}
{% if action_data.http_response_del_header_name|default("") != "" %}
{% do action_options.append('http-response del-header' ~ action_data.http_response_del_header_name) %}
{% else %}
{% set action_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
{% elif action_data.type == 'http-response_replace-header' %}
{% if action_data.actionValue|default("") != "" and action_data.actionName|default("") != "" and action_data.actionFind|default("") != "" %}
{% do action_options.append('http-response replace-header ' ~ action_data.actionName ~ ' ' ~ action_data.actionFind ~ ' ' ~ action_data.actionValue) %}
{% 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) %}
{% else %}
{% set action_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
{% elif action_data.type == 'http-response_replace-value' %}
{% if action_data.actionValue|default("") != "" and action_data.actionName|default("") != "" and action_data.actionFind|default("") != "" %}
{% do action_options.append('http-response replace-value ' ~ action_data.actionName ~ ' ' ~ action_data.actionFind ~ ' ' ~ action_data.actionValue) %}
{% 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) %}
{% else %}
{% set action_enabled = '0' %}
# ERROR: missing parameters
@@ -379,15 +389,15 @@
{% 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.actionValue|default("") != "" %}
{% do action_options.append('tcp-request content lua.' ~ action_data.actionValue) %}
{% 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.actionValue|default("") != "" %}
{% do action_options.append('tcp-request content use-service lua.' ~ action_data.actionValue) %}
{% 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
@@ -399,15 +409,15 @@
{% 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.actionValue|default("") != "" %}
{% do action_options.append('tcp-response content lua.' ~ action_data.actionValue) %}
{% if action_data.tcp_response_content_lua|default("") != "" %}
{% do action_options.append('tcp-response content lua.' ~ action_data.tcp_response_content_lua) %}
{% else %}
{% set action_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
{% elif action_data.type == 'custom' %}
{% if action_data.actionValue|default("") != "" %}
{% do action_options.append(action_data.actionValue) %}
{% if action_data.custom|default("") != "" %}
{% do action_options.append(action_data.custom) %}
{% else %}
{% set action_enabled = '0' %}
# ERROR: missing parameters
@@ -721,25 +731,35 @@ backend {{backend.name}}
{% endif %}
{% endif %}
{% elif healthcheck_data.type == 'agent' %}
{% if healthcheck_data.agentPort|default("") != "" %}
{% do healthcheck_additions.append('agent-check agent-port ' ~ healthcheck_data.agentPort) %}
{% if healthcheck_data.agent_port|default("") != "" %}
{% do healthcheck_additions.append('agent-check agent-port ' ~ healthcheck_data.agent_port) %}
{% else %}
# ERROR: agent-check configured, but agent-port was not specified
{% endif %}
{% elif healthcheck_data.type == 'ldap' %}
option ldap-check
{% elif healthcheck_data.type == 'mysql' or healthcheck_data.type == 'pgsql' %}
{% if healthcheck_data.dbUser|default("") != "" %}
option {{healthcheck_data.type}}-check user {{healthcheck_data.dbUser}}
{% elif healthcheck_data.type == 'mysql' %}
{% if healthcheck_data.mysql_user|default("") != "" %}
{% if healthcheck_data.mysql_post41|default("") == '1' %}
option mysql-check user {{healthcheck_data.mysql_user}} post-41
{% else %}
option mysql-check user {{healthcheck_data.mysql_user}}
{% endif %}
{% else %}
# ERROR: {{healthcheck_data.type}} check configured, but db user was not specified
{% endif %}
{% elif healthcheck_data.type == 'pgsql' %}
{% if healthcheck_data.pgsql_user|default("") != "" %}
option pgsql-check user {{healthcheck_data.pgsql_user}}
{% else %}
# ERROR: {{healthcheck_data.type}} check configured, but db user was not specified
{% endif %}
{% elif healthcheck_data.type == 'redis' %}
option redis-check
{% elif healthcheck_data.type == 'smtp' %}
option smtpchk HELO {{healthcheck_data.smtpDomain}}
option smtpchk HELO {{healthcheck_data.smtp_domain}}
{% elif healthcheck_data.type == 'esmtp' %}
option smtpchk EHLO {{healthcheck_data.smtpDomain}}
option smtpchk EHLO {{healthcheck_data.esmtp_domain}}
{% elif healthcheck_data.type == 'ssl' %}
option ssl-hello-chk
{% endif %}