The installation and setup guide of Nemesida WAF Cabinet module, which is intended to visualise and classify the information about attacks and identified vulnerabilities.

Nemesida WAF Cabinet installation and setup guide

Before installing the Nemesida WAF Cabinet module, you must install and configure the Nemesida WAF API module and PostgreSQL.

Below is a brief guide to the commissioning of the local version of the Nemesida WAF Cabinet on servers running Linux. To install the module you must perform following steps:

DebianUbuntuCentOSDockerVirtual Appliance
# apt install apt-transport-https gnupg2
Debian 10
Connect the repository:

# echo "deb https://nemesida-security.com/repo/nw/debian buster non-free" > /etc/apt/sources.list.d/NemesidaWAF.list

Connect Nginx repository:

# echo "deb http://nginx.org/packages/debian/ buster nginx" > /etc/apt/sources.list.d/nginx.list
# wget -O- https://nginx.org/packages/keys/nginx_signing.key | apt-key add -
Debian 11
Connect the repository:

# echo "deb https://nemesida-security.com/repo/nw/debian bullseye non-free" > /etc/apt/sources.list.d/NemesidaWAF.list

Connect Nginx repository:

# echo "deb http://nginx.org/packages/debian/ bullseye nginx" > /etc/apt/sources.list.d/nginx.list
# wget -O- https://nginx.org/packages/keys/nginx_signing.key | apt-key add -

Install the module:

# wget -O- https://nemesida-security.com/repo/nw/gpg.key | apt-key add -
# apt update && apt upgrade
# apt install python3 python3-venv python3-dev python3-pip nginx memcached libmemcached-dev postgresql-server-dev-all gettext
# apt install nwaf-cabinet
# apt install apt-transport-https gnupg2
Ubuntu 20.04
Connect the Nemesida WAF repository:

# echo "deb [arch=amd64] https://nemesida-security.com/repo/nw/ubuntu focal non-free" > /etc/apt/sources.list.d/NemesidaWAF.list
# wget -O- https://nemesida-security.com/repo/nw/gpg.key | apt-key add -

Connect Nginx repository and install the packages:

# echo "deb http://nginx.org/packages/ubuntu/ focal nginx" > /etc/apt/sources.list.d/nginx.list
# wget -O- https://nginx.org/packages/keys/nginx_signing.key | apt-key add -
# apt update && apt upgrade
# apt install python3.8 python3.8-venv python3.8-dev python3-pip nginx memcached libmemcached-dev build-essential python3-reportbug libpq-dev gettext
Ubuntu 22.04
Connect the Nemesida WAF repository:

# echo "deb [arch=amd64] https://nemesida-security.com/repo/nw/ubuntu jammy non-free" > /etc/apt/sources.list.d/NemesidaWAF.list
# curl -s https://nemesida-security.com/repo/nw/gpg.key | gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/trusted.gpg --import
# chmod 644 /etc/apt/trusted.gpg.d/trusted.gpg 

Connect Nginx repository and install the packages:

# echo "deb http://nginx.org/packages/ubuntu/ jammy nginx" > /etc/apt/sources.list.d/nginx.list
# curl -s https://nginx.org/packages/keys/nginx_signing.key | gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/trusted.gpg --import
# chmod 644 /etc/apt/trusted.gpg.d/trusted.gpg 
# apt update && apt upgrade
# apt install python3 python3-venv python3-dev python3-pip nginx memcached libmemcached-dev build-essential python3-reportbug libpq-dev gettext
# apt install nwaf-cabinet
Configure the SELinux policy or deactivate it with the command:

# setenforce 0

then bring the file /etc/selinux/config to the form:

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
CentOS 8 Stream
1. Connect additional repositories and install the module:

# rpm -Uvh https://nemesida-security.com/repo/nw/centos/nwaf-release-centos-8-1-6.noarch.rpm
# dnf update
# dnf install nginx python39 memcached python39-pip python39-devel gcc postgresql-devel gettext
# dnf install nwaf-cabinet

For the correct operation of the Cabinet module, it is necessary to check the server section in the nginx.conf file and if it is not used, delete it to avoid redirects to the page specified in it.

CentOS 9 Stream
1. Connect additional repositories and install the module:

# rpm -Uvh https://nemesida-security.com/repo/nw/centos/nwaf-release-centos-9-1-6.noarch.rpm
# dnf update
# dnf install nginx python3 memcached python3-pip python3-devel gcc postgresql-devel gettext
# dnf install nwaf-cabinet

For the correct operation of the Cabinet module, it is necessary to check the server section in the nginx.conf file and if it is not used, delete it to avoid redirects to the page specified in it.

Information about using Nemesida WAF in a Docker container is available in the corresponding section.
Information about using Nemesida WAF as a Virtual Appliance (virtual disk for KVM/VMware/VirtualBox) and Yandex VM is available in the corresponding section.

2. Make the necessary changes to the /var/www/app/cabinet/settings.py file.

settings.py parameters
Parameter
Description
ALLOWED_HOSTS
Parameters for security «Django». Specify the FQDN value («example.com») or the IP address of the server where the module is available.

HTTP_PROXY_CONF
Proxy address (optional). For example:
HTTP_PROXY_CONF = 'http://proxy.example.com:3128'

DB_NAME_CABINET
DB_USER_CABINET
DB_PASS_CABINET
DB_HOST_CABINET
DB_PORT_CABINET
Parameters for connecting to the database module Nemesida WAF Cabinet.

DB_NAME_CONF
DB_USER_CONF
DB_PASS_CONF
DB_HOST_CONF
DB_PORT_CONF
Parameters for connecting to the database of the Nemesida WAF API module.

VTS_SERVERS
VTS_URL
Parameters for collecting information from the VTS module (optional), where:
VTS_SERVERS – is the list of servers from which the module will take data.
Example: VTS_SERVERS = ['w1.example.com', 'w2.example.com'];

VTS_URL – is the address of the page where the information of the VTS module is available.

Access to servers is made via HTTP/HTTPS protocols. After setting the parameters, you need to restart the service:

systemctl enable cabinet_vts
service cabinet_vts restart

3. Allow access:
– to the server Memcached 127.0.0.1:11211;
– to the server with PostgreSQL;
– to servers from the VTS_SERVERS list via HTTP or HTTPS protocols.

4. In firewall settings allow the requests to 80 port (is set by default in the file /etc/nginx/conf.d/cabinet.conf).

5. Run the migration and set the administrator password:

# cd /var/www/app/ && . venv/bin/activate && python3 manage.py migrate && python3 manage.py createsuperuser && deactivate

6. Activate the virtual host:

# mv /etc/nginx/conf.d/cabinet.conf.disabled /etc/nginx/conf.d/cabinet.conf
# nginx -t && service nginx reload

7. Restart the server and test the module:

# systemctl status cabinet cabinet_ipinfo cabinet_attack_nottification cabinet_vts cabinet_cleaning_db

In case of redirection, when going to the Cabinet page in the CentOS 8 Stream distribution, it is necessary to check and delete the server section in the nginx.conf file.

For security reasons, it is recommended to restricted access to the web interface of the Nemesida WAF Cabinet module to a list of allowed IP addresses to prevent unauthorized users from managing the Nemesida WAF work processes.

Nemesida WAF Cabinet user guide

The Nemesida WAF Cabinet, available at YOUR_SERVER/waf/personal/, contains information on the work of the main (Nemesida WAF, Nemesida WAF Scanner, Nemesida WAF AI) and auxilary modules Nemesida WAF.

The table and schedules attack

The Summary page contains all summary information about anomalous requests to the protected web application: attacks related to attempts to search or exploit vulnerabilities, brute-force attacks, and attempts to transmit malicious code (depending on the mode of operation of the Nemesida WAF modules).

The table All attacks displays the quantitative indicators of anomalous requests for a specific period of time and by their categories.

The schedule Attacks intensity displays the intensity and dynamics in the context of a given period and selected categories of attacks.

The charts Last 24 h. and Top by IP display the Top-10 domains that were attacked and Top-10 IP addresses from which anomalous requests came.

Information on quantitative indicators, intensity and dynamics of anomalous requests arriving in a specific period

Top 15 IP addresses from which anomal requests came

Last 24 h.

On the Attacks page as the usage indicator of behavioral models following icons are used:

  • icon displays when machine learning module is not the reason of the request blocking (BT 2, 6, 7);
  • icon displays when behavioral models are in the process of being retrained;
  • icon displays when the reason of the request blocking is machine learning module (BT 3, 8).

More information about the reasons of the request blocking by Nemesida WAF module is available in corresponding section.

When you click on the icon a list of events is displayed.


Information about attacks in the form of a grouped list

The search area and event selection for a specific period are available at the top of the page. On the Summary and Attack pages, you can search both in the normal mode (without specifying special parameters) and in the advanced mode using the following directives:

Advanced search filters
  • h – virtual host, domain name;
  • t – type of attack (SQLi, XSS, LFI, MLA, ClamAV, BF, DDoS, MLC, etc);
  • ip – IP address of the attacker;
  • bt – lock ID;
  • waf_id – WAF ID;
  • group_id – ID of the group of requests identified by Nemesida AI MLC as brute-force or DDoS attack;
  • rule – signature ID;
  • body – request body;
  • mz – anomaly detection zone (URL, ARGS, BODY, HEADERS, Cookie, etc);
  • url – request URL address;
  • vuln – the filter is applied without parameters and is designed to display queries in which a vulnerability has been identified when using the recheck functionality. The use of the logical operator “!” is supported to exclude the output of information about potential attacks. For example, !vuln;
  • possible – The filter is used without parameters and is intended to display possible attacks BT 7 (brute force attacks), BT 9 (flood) and BT 10 (DDoS), that are not reliably identified as attacks. The use of the logical operator “!” is supported to exclude the output of information about potential attacks. Example: !possible

To limit the display of information in the search field, the logical operators «!» (exception) and «and» (association) are available.

Examples of possible requests

The request will display information on attacks in which a vulnerability was detected when using the recheck functionality

vuln

The request will display information on attacks of the brute-force type

t:bf

The request will display information on attacks of the DDoS attack type

t:ddos

The request will display information on attacks with blocking identifier BT 1

bt:1

The request will display information on requests with the ID dd8636c32d177c0c74416c19429a8c4d

waf_id:dd8636c32d177c0c74416c19429a8c4d

The request will display information on attacks with the specified Request ID

group_id:dd8636c32d177c0c74416c19429a8c4d

The request will display information on attacks with the rule number 1022

rule:1022

The request will display information on attacks containing test in the Body field

body:test

The request will display information on attacks detected in the Cookie zone

mz:сookie

The request will display information on attacks whose URL contains index.php

url:index.php

The request will display information about potential attacks on the domain example.com

h:example.com and possible

The request will display information on attacks on the example.com domain from any IP address except 1.2.3.4

h:example.com and !ip:1.2.3.4

The request will display information on attacks on the 1.example.com and 2.example.com domains, except for attacks identified by signature analysis as SQL injection

h:1.example.com and h:2.example.com !t:SQLi

The request will display information on attacks identified by signature analysis as SQL injection to the example.com domain from IP addresses 1.2.3.4 and 4.3.2.1

h:example.com t:SQLi ip:1.2.3.4 and ip:4.3.2.1

For requests, which were blocked by signature method, the field Rule ID is available. If you will click on this field, in the pop-up window following information will display:

  • the information about the signature structure;
  • the exception rule (WL) for adding in Nemesida WAF configuration file.

More information about signatures and exception rules is available in the relevant section of the guide.

Signature Information

Brute-force attacks Information

Recheck functionality

Except the main functionality Nemesida WAF Scanner allows to operate resending of the blocked request content and/or different various on the protected web application. Users are included in «Administrators» group are able to operate this check using button null, which becomes available when the grouping for detected attacks XSS, SQLI, LFI, RFI types, that have BT 1 or 2, is switched off. The verification status is displayed instead of the button null. In case the vulnerability detection the information will be available in the section «Scanner» in Cabinet. The administrator can exclude the request by clicking on null. Then information about this request will be available in the admin panel in the “Scanner” tab. To use Recheck functionality you should set up section [recheck] in file /opt/nws/main.conf.

Using Recheck can lead to the execution of arbitrary code from the request on the web application side. Use the functionality only if you are completely confident in your actions.

Possible meanings:

  • Validation — check is processing;
  • Confirmed — vulnerability is detected;
  • Not confirmed — vulnerability is not detected;
  • Error – an error occurred while processing the request by the vulnerability scanner.

Additional vulnerability check information

Unlock Request functionality

A user of Nemesida WAF Cabinet, who considers the blocking of the request to be erroneous, can send an application to unlock it to the administrator by pressing the button null. An email with a description of the order will be sent to the administrator. The list of all orders is located in the tab null in the admin panel. The request can be unlocked or left locked. To unlock the request, the administrator needs to create a appropriate rule for Nemesida WAF, after which the user will receive a notification.

Unlock Request Form

List of requests in the admin panel

Vulnerability Scanner Results

Information on the operation of the Nemesida WAF Scanner module is available in the tab . The administrator can exclude the request by clicking on null. Then information about this request will be available in the admin panel in the “Scanner” tab. Later, similar requests will not be displayed on this tab.


Vulnerability Scanner Statistics

You can search for events both in normal mode (without specifying special parameters) and in advanced mode, using the following directives:

Advanced search filters
  • h – virtual host, domain name;
  • t – type of attack (SQLi, XSS, LFI, etc);
  • ip – IP address of the attacker;
  • u – tested URL;
  • p – vulnerable parameter.

To limit the display of information in the search field, the logical operators «!» (exception) and «and» (association) are available.

Examples of possible requests

The request will display information about vulnerabilities found for the domain example.com

h:example.com

The request will display information about vulnerabilities of all type except SQLi

!t:SQLi

The request will display information about the vulnerabilities found for the tested URL /search.php

u:/search.php

The request will display information about vulnerabilities found in the idparameter

p:id

The request will display information about vulnerabilities of the SQL injection type for any domain except example.com

!h:example.com and t:SQLi

Statistics of the module «Nginx virtual host traffic status»

The tab contains information about traffic when interacting with upstream servers Nginx, the number of 5xx errors, response time, speed in and speed out presented in three formats (now, week, month).

VTS module statistics

Formation of a detailed report in PDF and CSV formats

When you go to the tab and a detailed report will be generated on the work of Nemesida WAF and its components. The report can be generated in PDF and CSV formats.

Admin panel

Users who are members of the “Administrators” group, when they go to the tab have access to a special section where they can manage other users and their parameters, as well as process incoming requests.

List of the users

The tab contains a list of all users. When you click on the icon the user is being deleted. When you click on the icon the user editing window opens.

Admin panel

Vulnerability Scanner

In the admin panel, the tab displays requests that the administrator has excluded from the list of vulnerabilities.

Vulnerabilities information

List of all applications for unlocking requests

The tab displays a list of applications for unlocking requests. When you click on , the request is deleted.

Information about applications for unlocking requests

Administrator can edit the request by clicking on .

The edit form of the application for unlocking request

Add new user

The tab contains window for adding a new user.

Add new user

To add a new user, fill in the following fields:

Field
Description

E-mail

E-mail address

WAF ID

Module ID of Nemesida WAF. You can set multiple WAF IDS separated by a comma. The «*» value means that all possible WAF IDS are specified.

To group license keys into a single WAF ID, send a request to support@nemesida-security.com

Password

Password

Confirmation

Confirm password

Role

User role: User or Administrator (with rights to create and edit other users).

Status

User status: enabled (Active) or disabled (Inactive).

WAF domains

Filtering attacks by domain. You can set multiple domains separated by comma. The «*» value means that all domains will be used.

If you set a specific domain, the user will only see the attacks that came to this domain in their personal account.

In this field one can set wildcard values similar to Nginx. For example, the domain name .example.com includes the main domain and its subdomains. Domain name *.example.com includes subdomains, but does not include the main domain example.com.

Access restricted by IP

The IP address which the user can use to log in to the personal account on the admin panel. You can set multiple addresses separated by comma.

Report CSV
Report PDF
Activate the ability for the user to generate reports in CSV and PDF formats.

Configuring the mail server

In the tab the administrator can configure the connection to the mail server to send email attack alerts.

Information about mail server settings

When clicking on the icon the administrator can edit the settings.

Editing mail server settings

To configure the mail server, you need to fill in the following fields:

Parameter
Description

Email Server

Activate/deactivate the sending of attack alerts using the mail server.

SMTP host

The address of the mail server.

SMTP port

The port of the mail server.

SMTP username
SMTP password

The username and password on behalf of which notifications will be sent.

Encryption

Encryption method. The following methods are available: No, SSL, TLS.

Removing attacks

In the tab the administrator can configure automatic removal of attacks from the personal account. When deleting attacks from your personal account, information about them will also be deleted from the database.

List of tasks for automatic removal of attacks

When clicking on the icon the administrator can add a new task to the list.

Adding a new task to remove attacks

To add a task, you need to fill in the following fields:

Parameter
Description

[Required parameters]
Enable
Activation/deactivation of the task.
Time interval

The period (in days) during which attack records older than this period will be deleted.

If you set the time interval 0 days, then the task will be deleted all attacks, if you do not set additional options: BT, IP, Domain, URL.


[Additional parameters]
BT
Deleting information about attacks based on their identifier locks. Multiple comma-separated values are allowed.
IP
Deleting information about attacks based on the IP address of the request source.
Domain
Deleting information about attacks based on the Domain. It is allowed to use strict compliance and wildcard values: *, example.com , .example.com , *.example.com .
URL
Deleting information about attacks based on the URL. For example, with the value /index.php attacks will be removed if the exact match of the string /index.php .

When clicking on the icon the administrator can edit the task settings, and when clicking on null it is being deleted.

Editing a task

Tasks created by the administrator will be triggered according to the schedule every 60 minutes. When clicking on the icon active tasks will be forced to run outside the schedule.

Conclusion of additional information about the operation of the module

If there is a problem with the module you will change the file: /var/www/app/cabinet/settings_extra.py:

...
LOGGING = {
...
   'level': 'INFO'
...
   'level': 'INFO'
...

and restart the service:

# service cabinet restart

During the Nemesida WAF Cabinet operation the information about errors is contained in the run-time journals of the module /var/log/uwsgi/cabinet/*.log and the diagnostic information is in the /var/log/uwsgi/cabinet/debug.log.