In order to create a rule, you need to go to the “Rules” tab and click on the “Add Rule” button (see Figure 174).

Figure 174 – Creating a rule
After clicking on the “Add Rule” button, a window for creating a new rule appears (see Figure 175).

Figure 175 – Rule creation window
The rule creation window contains the following elements:
Rule name – field for entering the name of the rule.
Criticality – in this window the criticality of the rule from the proposed list is set (see Figure 176). The criticality of the rule is indicated for additional information to the user and does not affect the order in which the rules are triggered.

Figure 176 – Rule criticality selection menu
Revision – a window for selecting the version of a rule with the ability to switch to an older version.
This window indicates the number of times this rule is triggered.
Adding a tag – in this window you can add tags from existing ones (see Figure 177) or create new ones. This functionality allows the user to filter rules by category.

Figure 177 – Selecting an existing tag or creating a new one
Note
When you select a tag, a drop-down menu appears with already created tags (see Figure 178).
The menu contains only those tags for which general rules have been created. A tag that is used only for rules for a specific application will not be offered. However, if necessary, it can be entered into the tag input line manually.
Figure 178 – Tag selection menu
Goals – in this section, select a goal from the proposed list (see Figure 179). It is also possible to select the negation of the selected condition (see Figure 180). The available goals when creating a rule are described in Table 29.

Figure 179 – Target selection

Figure 180 – Possibility of using condition negation
Table 29 – Selecting a goal when creating a rule
Possible transaction specification classes |
Possible parameters |
Note |
|---|---|---|
Checking the HTTP response code |
Specify response codes |
The rule only works for the listed response codes |
Use condition negation |
The rule works for all response codes except those listed |
|
Finding a regular expression in the response body |
Regular expression |
The rule works for responses containing the specified regular expression |
Use condition negation |
The rule works for all responses that do not contain a regular expression |
|
Checking the web application |
Select an application |
The rule will only apply to application traffic |
Use condition negation |
The rule will apply to the traffic of all applications except the specified one |
|
Action check |
Select action |
Can only be used after the “Web application check” block. The rule applies only to application traffic that matches the selected action |
Use condition negation |
Can only be used after the “Web application check” block. The rule applies to all application traffic except that which corresponds to the selected action |
|
Checking the success of the action |
Select action success status |
The rule will only apply to the selected action success status |
Use condition negation |
The rule will apply to traffic of all success statuses except the specified one |
Sources – in this section, select a source from the proposed list (see Figure 181). It is also possible to select the negation of the selected condition. The available sources when creating a rule are described in Table 30.

Figure 181 – Source selection
Table 30 – Selecting a source when creating a rule
Possible transaction specification classes |
Possible parameters |
Note |
|---|---|---|
Checking the session ID |
Specify the session ID |
The rule works for all requests whose session identifier matches the given one |
Use condition negation |
The rule works for all requests whose session identifier does not match the specified one |
|
Request without session ID |
– |
The rule works for all requests without a session ID |
Use condition negation |
The rule does not work for all requests without a session ID |
|
Username verification |
Please enter your username |
The rule works for requests related to the specified user |
Use condition negation |
The rule works for requests related to all users except the specified one |
|
Request from an unauthorized entity |
– |
The rule works for requests from unauthorized users |
Use condition negation |
The rule works for all requests except requests from unauthorized users |
|
Checking the user’s IP address |
|
The rule works for requests coming from the specified IP address with the specified subnet mask |
Use condition negation |
The rule works for all requests except requests coming from the specified IP address with the specified subnet mask |
|
Checking the user’s country |
Please indicate your country |
The rule works for all requests coming from IP addresses belonging to a specific country |
Use condition negation |
The rule works for all requests except requests coming from IP addresses belonging to a specific country |
|
Checking user ASN |
Please provide ASN |
The rule works for requests coming from the specified ASN |
Use condition negation |
The rule works for requests other than requests coming from the specified ASN |
|
Source check (specific value) |
|
The rule works on requests coming from the specified source and with the specified value to find matches against that source |
Use condition negation |
The rule works for requests other than requests coming from the specified source and with the specified value to search for matches with this source |
|
Source check (any value) |
Please indicate your source |
The rule works for requests coming from the specified source |
Use condition negation |
The rule works for requests other than requests coming from the specified source |
Anomalies – in this section, select an anomaly from the proposed list (see Figure 182). It is also possible to select the negation of the selected condition. The available rule creation anomalies are described in Table 31.

Figure 182 – Selecting an anomaly
Table 31 – Selecting an anomaly when creating a rule
Possible transaction specification classes |
Possible parameters |
Note |
|---|---|---|
Presence of any anomaly |
– |
The rule works for any transaction with a detected anomaly |
Use condition negation |
The rule works for all traffic in which no anomalies are detected |
|
The presence of an anomaly with specified properties |
Select analysis module:
|
The rule works for a transaction with an anomaly detected by the selected module. Required field |
Specify types of anomalies |
The rule works for a transaction with the specified anomalies detected by the selected module |
|
Select anomaly location type:
|
The rule works for a transaction with an anomaly identified by the selected module, with the specified location |
|
Select an anomaly location name |
The rule works for a transaction with an anomaly identified by the selected module, with the specified location and the specified name of the location of the anomaly |
|
Use condition negation |
The rule works for all transactions except transactions that match the specified parameters |
In this section, select an action from the proposed list (see Figure 183) for the created rule. The available actions when creating a rule are described in Table 32.

Figure 183 – Selecting an action
Table 32 – Selecting an action when creating a rule
Action |
Possible parameters |
Note |
|---|---|---|
Mark transaction |
– |
A transaction that matches the Targets, Sources, and Anomalies specifications is flagged for further analysis. Used as default action |
Allow transaction |
– |
A transaction that matches the “Targets”, “Sources” and “Anomalies” specifications is passed as legitimate |
Block transaction |
– |
A transaction that matches the “Targets”, “Sources” and “Anomalies” specifications is blocked |
Add source value to list |
Break the chain of application of rules |
When a rule is triggered, the chain of rule application is interrupted |
Transaction Solution |
When the rule is triggered, the selected solution is installed |
|
Source |
When the rule is triggered, the value of the specified source is added to the list |
|
List |
When the rule is triggered, the source value is added to the specified list |
|
Description of the element being added to the list |
Additional information about the source value being added |
|
Lifetime of the added element (in seconds) |
The source value will be added to the list for the specified time |
After filling in all the required fields, you must click the “Save” button, as a result of which the created rule will appear in the list of all available rules.
Note
After creation, the rule is in disabled mode, do not forget to enable the rule if necessary.
21.1. Special response template
To configure the issuance of JavaScript verification with a redirect instead of blocking, you must select a special response template redirect.response.json in the control panel (see Figure 184).
Figure 184 – Redirect instead of blocking
The standard /etc/ibatyr-nginx/templates/redirect.response.json configuration looks like this:
{
"$apply": "challenge",
"type": "redirect",
"valid_for": 300
}
Parameters:
The valid_for parameter is responsible for the time in seconds during which the previously passed validation is valid.
If set to null, the validation expires indefinitely. The expiration date is checked for every request to which a soft response is applied, so that if the configuration changes, the new settings are immediately used.
The undocumented obfuscation parameter is responsible for setting the method for obfuscation of JavaScript code and has reasonable defaults, selected empirically.
The page template can be customized if desired by editing the file /etc/ibatyr-nginx/templates/redirect.html.
When blocked using this soft reaction, the following occurs:
It checks whether the user has previously passed this validation.
If the old validation is still valid and the user’s IP address has not changed, then the request is allowed.
In the iBatyr Nginx log this solution appears as “Pass: challenge passed: redirect”.
Otherwise, the response is a block with obfuscated JavaScript code that does the following:
If there are signs of a managed browser being used, the validation is considered unsuccessful.
In case of successful validation:
An encrypted JWE token is installed in the cookie, the name of which is determined by the SESSIONS_COOKIE_NAME setting (default is sw). The validation result is tied to the user’s IP address.
A redirect (GET request) occurs to the originally requested URL.

