Skip to content

Configuration options for the NGINX‑based Wallarm node

Learn fine-tuning options available for the Wallarm NGINX modules to get the most out of the Wallarm solution.

NGINX official documentation

The Wallarm configuration is very similar to the NGINX configuration. See the official NGINX documentation. Along with the Wallarm specific configuration options, you have the full capabilities of the NGINX configuration.

Wallarm directives

disable_acl

Allows disabling analysis of requests origins. If disabled (on), the filtering node does not download IP lists from the Wallarm Cloud and skips request source IPs analysis.

Info

This parameter can be set inside the http, server, and location blocks.

Default value is off.

wallarm_acl_access_phase

Setting wallarm_acl_access_phase on increases the Wallarm node performance by omitting the attack search stage during the analysis of requests from denylisted IPs. This configuration option is useful if there are many denylisted IPs (e.g. the whole countries) producing high traffic that heavily loads the working machine CPU.

By default, the filtering node blocks the requests from the denylisted IPs only after requests are analyzed for attack signs. Setting wallarm_acl_access_phase on changes the order of these stages forcing requests from denylisted IPs to be blocked immediately without attack sign search. This significantly reduces the load of the CPU of the node.

Default value and interaction with other directives

Default value: off

  • With disable_acl on, IP lists are not processed and enabling wallarm_acl_access_phase does not make sense.
  • The wallarm_acl_access_phase directive has priority over wallarm_mode which results in blocking requests from denylisted IPs even if the filtering node mode is off or monitoring.

wallarm_api_conf

A path to the node.yaml file, which contains access requirements for the Wallarm API.

Example:

wallarm_api_conf /etc/wallarm/node.yaml

Used to upload serialized requests from the filtering node directly to the Wallarm API (Cloud) instead of uploading into the postanalytics module (Tarantool).

Only requests with attacks are sent to the API. Requests without attacks are not saved.

Example of the node.yaml file content:

# API connection credentials

hostname: <some name>
uuid: <some uuid>
secret: <some secret>

# API connection parameters (the parameters below are used by default)

api:
  host: api.wallarm.com
  port: 444
  ca_verify: true

wallarm_application

Previous name of the directive

In Wallarm node 3.4 and lower, this directive is named wallarm_instance. If you use this name, we recommend to change it when upgrading the node modules. The wallarm_instance directive will be deprecated soon. The directive logic has not changed.

Unique identifier of the protected application to be used in the Wallarm Cloud. The value can be a positive integer except for 0.

Unique identifiers can be set for both the application domains and the domain paths, for example:

Configuration file for the domain example.com:

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;
    listen 443 ssl;

    ...

    wallarm_mode monitoring;
    wallarm_application 1;
    location / {
            proxy_pass http://example.com;
            include proxy_params;
    }
}

Configuration file for the domain test.com:

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;
    listen 443 ssl;

    ...

    wallarm_mode monitoring;
    wallarm_application 2;
    location / {
            proxy_pass http://test.com;
            include proxy_params;
    }
}
server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;
    listen 443 ssl;

    ...

    wallarm_mode monitoring;
    location /login {
            proxy_pass http://example.com/login;
            include proxy_params;
            wallarm_application 3;
    }

    location /users {
            proxy_pass http://example.com/users;
            include proxy_params;
            wallarm_application 4;
    }
}

More details on setting up applications →

Info

This parameter can be set inside the http, server, and location blocks.

Default value: -1.

wallarm_block_page

Lets you set up the response to the blocked request.

More details on the blocking page and error code configuration →

Info

This parameter can be set inside the http, server, and location blocks.

wallarm_block_page_add_dynamic_path

This directive is used to initialize the blocking page that has NGINX variables in its code and the path to this blocking page is also set using a variable. Otherwise, the directive is not used.

More details on the blocking page and error code configuration →

Info

The directive can be set inside the http block of the NGINX configuration file.

wallarm_cache_path

A directory in which the backup catalog for the proton.db and custom ruleset file copy storage is created when the server starts. This directory must be writable for the client that runs NGINX.

Info

This parameter is configured inside the http block only.

wallarm_custom_ruleset_path

A path to the custom ruleset file that contains information on the protected application and the filtering node settings.

Info

This parameter can be set inside the http, server, and location blocks.

Default value: /etc/wallarm/custom_ruleset (in Wallarm node 3.4 and lower, /etc/wallarm/lom)

Previous name of the directive

In Wallarm node 3.4 and lower, this directive is named wallarm_local_trainingset_path. If you use this name, we recommend to change it when upgrading the node modules. The wallarm_local_trainingset_path directive will be deprecated soon. The directive logic has not changed.

wallarm_enable_libdetection

Enables additional validation of the SQL Injection attacks via the libdetection library. Using libdetection ensures the double‑detection of attacks and reduces the number of false positives.

Analyzing of requests with the libdetection library is disabled by default in all deployment options except for the Wallarm CDN nodes. To reduce the number of false positives, we recommend to enable analysis (wallarm_enable_libdetection on).

More details on libdetection

To allow libdetection to analyze the request body, please ensure that buffering of a client request body is enabled (proxy_request_buffering on).

Example:

wallarm_enable_libdetection on;
proxy_request_buffering on;

Memory consumption increase

When analyzing attacks using the libdetection library, the amount of memory consumed by NGINX and Wallarm processes may increase by about 10%.

Info

This parameter can be set inside the http, server, and location blocks.

To enable libdetection in the Wallarm Ingress controller, it is required to apply the nginx.ingress.kubernetes.io/server-snippet annotation with this parameter to the Ingress resource.

Default value is:

wallarm_fallback

With the value set to on, NGINX has the ability to enter an emergency mode; if proton.db or custom ruleset cannot be downloaded, this setting disables the Wallarm module for the http, server, and location blocks, for which the data fails to download. NGINX keeps functioning.

Info

Default value is on.

This parameter can be set inside the http, server, and location blocks.

wallarm_force

Sets the requests' analysis and custom rules generation based on the NGINX mirrored traffic. See Analyzing mirrored traffic with NGINX.

wallarm_global_trainingset_path

The directive will be deprecated soon

Starting with Wallarm node 3.6, please use the wallarm_protondb_path directive instead.

The wallarm_global_trainingset_path directive is still supported but will be deprecated in future releases. If you use the directive, we recommend to rename it. The directive logic has not changed.

wallarm_file_check_interval

Defines an interval between checking new data in proton.db and custom ruleset file. The unit of measure is specified in the suffix as follows:

  • no suffix for minutes

  • s for seconds

  • ms for milliseconds

Info

This parameter is configured only inside the http block.

Default value: 1 (one minute)

wallarm_instance

The directive will be deprecated soon

Starting with Wallarm node 3.6, please use the wallarm_application directive instead.

The wallarm_instance directive is still supported but will be deprecated in future releases. If you use the directive, we recommend to rename it. The directive logic has not changed.

wallarm_key_path

A path to the Wallarm license key.

Info

Default value: /etc/wallarm/license.key

wallarm_local_trainingset_path

The directive will be deprecated soon

Starting with Wallarm node 3.6, please use the wallarm_custom_ruleset_path directive instead.

The wallarm_local_trainingset_path directive is still supported but will be deprecated in future releases. If you use the directive, we recommend to rename it. The directive logic has not changed.

wallarm_mode

Traffic processing mode:

  • off

  • monitoring

  • safe_blocking

  • block

Wallarm node behavior off monitoring safe_blocking block
Analyzes whether incoming requests contain malicious payloads of the following types: input validation attacks, vpatch attacks, or attacks detected based on regular expressions - + + +
Uploads malicious requests to the Wallarm Cloud so that they are displayed in the event list - + + +
Blocks malicious requests - - Only those originated from graylisted IPs +
Blocks requests originated from denylisted IPssee exceptions Does not analyze the denylist - + +
Blocks requests originated from graylisted IPs Does not analyze the graylist - Only those containing malicious payloads Does not analyze the graylist
Allows requests originated from allowlisted IPs Does not analyze the allowlist + + +

Exceptions

If wallarm_acl_access_phase on, requests from denylisted IPs are blocked in any mode including off and monitoring

Usage of wallarm_mode can be restricted by the wallarm_mode_allow_override directive.

Detailed instructions on filtration mode configuration →

Info

This parameter can be set inside the http, server, and location blocks.

Default value depends on the filtering node deployment method (can be off or monitoring)

wallarm_mode_allow_override

Manages the ability to override the wallarm_mode values via filtering rules downloaded from the Wallarm Cloud (custom ruleset):

  • off - the custom rules are ignored.
  • strict - custom rules can only strengthen the operation mode.
  • on - it is possible to both strengthen and soften the operation mode.

For example, with wallarm_mode monitoring and wallarm_mode_allow_override strict set, Wallarm Console can be used to enable blocking of some requests, but the attack analysis cannot be fully disabled.

Detailed instructions on filtration mode configuration →

Info

This parameter can be set inside the http, server, and location blocks.

Default value: on

wallarm_parse_response

Whether to analyze the application responses. Response analysis is required for vulnerability detection during passive detection and active threat verification.

Possible values are on (response analysis is enabled) and off (response analysis is disabled).

Info

This parameter can be set inside http, server, and location blocks.

Default value: on

Improve performance

You are recommended to disable processing of static files through location to improve performance.

wallarm_parse_websocket

Wallarm provides full WebSockets support under the API Security subscription plan. By default, the WebSockets' messages are not analyzed for attacks.

To force the feature, activate the API Security subscription plan and use the wallarm_parse_websocket directive.

Possible values:

  • on: message analysis is enabled.
  • off: message analysis is disabled.

Info

This parameter can be set inside the http, server, and location blocks.

Default value: off

wallarm_parser_disable

Allows to disable parsers. The directive values corresponds to the name of the parser to be disabled:

  • cookie
  • zlib
  • htmljs
  • json
  • multipart
  • base64
  • percent
  • urlenc
  • xml

Example

wallarm_parser_disable base64;
wallarm_parser_disable xml;
location /ab {
    wallarm_parser_disable json;
    wallarm_parser_disable base64;
    proxy_pass http://example.com;
}
location /zy {
    wallarm_parser_disable json;
    proxy_pass http://example.com;
}

Info

This parameter can be set inside the http, server, and location blocks.

wallarm_parse_html_response

Whether to apply the HTML parsers to HTML code received in the application response. Possible values are on (HTML parser is applied) and off (HTML parser is not applied).

This parameter is effective only if wallarm_parse_response on.

Info

This parameter can be set inside the http, server, and location blocks.

Default value: on

wallarm_stalled_worker_timeout

Sets the time limit for processing a single request for an NGINX worker in seconds.

If the time exceeds the limit, data about NGINX workers is written to the stalled_workers_count and stalled_workers statistic parameters.

Info

This parameter can be set inside the http, server, and location blocks.

Default value: 5 (five seconds)

wallarm_process_time_limit

The directive has been deprecated

Starting from the version 3.6, it is recommended to fine-tune the overlimit_res attack detection using the rule Fine‑tune the overlimit_res attack detection.

The wallarm_process_time_limit directive is temporarily supported but will be removed in future releases.

Sets the time limit of a single request processing by the Wallarm node.

If the time exceeds the limit, an error is recorded into the log and the request is marked as the overlimit_res attack. Depending on the wallarm_process_time_limit_block value, the attack can be either blocked, monitored or ignored.

The value is specified in milliseconds without units, e.g.:

wallarm_process_time_limit 1200; # 1200 milliseconds
wallarm_process_time_limit 2000; # 2000 milliseconds

Info

This parameter can be set inside the http, server, and location blocks.

Default value: 1000ms (one second).

wallarm_process_time_limit_block

The directive has been deprecated

Starting from the version 3.6, it is recommended to fine-tune the overlimit_res attack detection using the rule Fine‑tune the overlimit_res attack detection.

The wallarm_process_time_limit_block directive is temporarily supported but will be removed in future releases.

The ability to manage the blocking of requests, which exceed the time limit set in the wallarm_process_time_limit directive:

  • on: the requests are always blocked unless wallarm_mode off
  • off: the requests are always ignored

    Protection bypass risk

    The off value should be used carefully as this value disables protection from the overlimit_res attacks.

    It is recommended to use the off value only in the strictly specific locations where it is really necessary, for example where the upload of the large files is performed, and where there is no risk of protection bypass and vulnerability exploit.

    It is strongly not recommended to set wallarm_process_time_limit_block to off globally for http or server blocks.

  • attack: depends on the attack blocking mode set in the wallarm_mode directive:

    • off: the requests are not processed.
    • monitoring: the requests are ignored but details on the overlimit_res attacks are uploaded to the Wallarm Cloud and displayed in Wallarm Console.
    • safe_blocking: only requests originated from graylisted IP addresses are blocked and details on all overlimit_res attacks are uploaded to the Wallarm Cloud and displayed in Wallarm Console.
    • block: the requests are blocked.

Regardless of the directive value, requests of the overlimit_res attack type are uploaded to the Wallarm Cloud except when wallarm_mode off;.

Info

This parameter can be set inside the http, server, and location blocks.

Default value: wallarm_process_time_limit_block attack

wallarm_request_memory_limit

Set a limit for the maximum amount of memory that can be used for processing of a single request.

If the limit is exceeded, the request processing will be interrupted and a user will get a 500 error.

The following suffixes can be used in this parameter:

  • k or K for kilobytes

  • m or M for megabytes

  • g or G for gigabytes

Value of 0 turns the limit off.

By default, limits are off.

Info

This parameter can be set inside the http, server, and/or location blocks.

wallarm_proton_log_mask_master

Settings for the debug logging of the NGINX master process.

Using the directive

You need to configure the directive only if you are told to do so by the Wallarm support team member. They will provide you with the value to use with the directive.

Info

The parameter can only be configured at the main level.

wallarm_proton_log_mask_worker

Settings of the debug logging for a NGINX worker process.

Using the directive

You need to configure the directive only if you are told to do so by the Wallarm support team member. They will provide you with the value to use with the directive.

Info

The parameter can only be configured at the main level.

wallarm_protondb_path

A path to the proton.db file that has the global settings for request filtering, which do not depend on the application structure.

Info

This parameter can be set inside the http, server, and location blocks.

Default value: /etc/wallarm/proton.db

Previous name of the directive

In Wallarm node 3.4 and lower, this directive is named wallarm_global_trainingset_path. If you use this name, we recommend to change it when upgrading the node modules. The wallarm_global_trainingset_path directive will be deprecated soon. The directive logic has not changed.

wallarm_request_chunk_size

Limits the size of the part of the request that is processed during one iteration. You can set up a custom value of the wallarm_request_chunk_size directive in bytes by assigning an integer to it. The directive also supports the following postfixes:

  • k or K for kilobytes

  • m or M for megabytes

  • g or G for gigabytes

Info

This parameter can be set inside the http, server, and location blocks.
Default value: 8k (8 kilobytes).

wallarm_tarantool_upstream

With the wallarm_tarantool_upstream, you can balance the requests between several postanalytics servers.

Example:

upstream wallarm_tarantool {
    server 127.0.0.1:3313 max_fails=0 fail_timeout=0 max_conns=1;
    keepalive 1;
}

# omitted

wallarm_tarantool_upstream wallarm_tarantool;

See also Module ngx_http_upstream_module.

Required conditions

It is required that the following conditions are satisfied for the max_conns and the keepalive parameters:

  • The value of the keepalive parameter must not be lower than the number of the Tarantool servers.
  • The value of the max_conns parameter must be specified for each of the upstream Tarantool servers to prevent the creation of excessive connections.

Info

The parameter is configured inside the http block only.

wallarm_timeslice

A limit on the time that a filtering node spends on one iteration of processing a request before it switches to the next request. Upon reaching the time limit, the filtering node proceeds to process the next request in the queue. After performing one iteration on each of the requests in the queue, the node performs the second iteration of processing on the first request in the queue.

You can use time intervals suffixes that are described in the NGINX documentation to assign different time unit values to the directive.

Info

This parameter can be set inside the http, server, and location blocks.
Default value: 0 (time limit for single iteration is disabled).


Warning

Due to NGINX server limitations, it is necessary to disable the buffering request by assigning the off value to the proxy_request_buffering NGINX directive for the wallarm_timeslice directive to work.

wallarm_ts_request_memory_limit

Set a limit for the maximum amount of memory that can be used by one instance of proton.db and custom ruleset.

If the memory limit is exceeded while processing some request, the user will get a 500 error.

The following suffixes can be used in this parameter:

  • k or K for kilobytes

  • m or M for megabytes

  • g or G for gigabyte

Value of 0 turns the limit off.

Info

This parameter can be set inside the http, server, and/or location blocks.

Default value: 1 GB

wallarm_unpack_response

Whether to decompress compressed data returned in the application response. Possible values are on (decompression is enabled) and off (decompression is disabled).

This parameter is effective only if wallarm_parse_response on.

Info

Default value: on.

wallarm_upstream_backend

A method for sending serialized requests. Requests can be sent either to Tarantool or to the API.

Possible values of the directive:

  • tarantool

  • api

Depending on the other directives, the default value will be assigned as follows:

  • tarantool - if there is no wallarm_api_conf directive in the configuration.

  • api - if there is a wallarm_api_conf directive, but there is no wallarm_tarantool_upstream directive in the configuration.

    Note

    If the wallarm_api_conf and wallarm_tarantool_upstream directives are present simultaneously in the configuration, a configuration error of the directive ambiguous wallarm upstream backend form will occur.

Info

This parameter can be set inside the http block only.

wallarm_upstream_connect_attempts

Defines the number of immediate reconnects to the Tarantool or Wallarm API.
If a connection to the Tarantool or API is terminated, then the attempt to reconnect will not occur. However, this is not the case when there aren't anymore connections and the serialized request queue is not empty.

Note

Reconnection may occur through another server, because the “upstream” subsystem is responsible for choosing the server.

This parameter can be set inside the http block only.

wallarm_upstream_reconnect_interval

Defines the interval between attempts to reconnect to the Tarantool or Wallarm API after the number of unsuccessful attempts has exceeded the wallarm_upstream_connect_attempts threshold.

Info

This parameter can be set inside the http block only.

wallarm_upstream_connect_timeout

Defines a timeout for connecting to the Tarantool or Wallarm API.

Info

This parameter can be set inside the http block only.

wallarm_upstream_queue_limit

Defines a limit to the number of serialized requests.
Simultaneously setting the wallarm_upstream_queue_limit parameter and not setting the wallarm_upstream_queue_memory_limit parameter means that there will be no limit on the latter.

Info

This parameter can be set inside the http block only.

wallarm_upstream_queue_memory_limit

Defines a limit to the total volume of serialized requests.
Simultaneously setting the wallarm_upstream_queue_memory_limit parameter and not setting the wallarm_upstream_queue_limit parameter means that there will be no limit on the latter.

Info

Default value: 100m.

This parameter can be set inside the http block only.