Detailed explanation of nginx-naxsi whitelist rules

Detailed explanation of nginx-naxsi whitelist rules

Whitelist rule syntax:

BasicRule wl:ID [negative] [mz:[$URL:target_url]|[match_zone]|[$ARGS_VAR:varname]|[$BODY_VARS:varname]|[$HEADERS_VAR:varname]|[NAME]]

wl:ID (White List ID) Which interception rules will be included in the whitelist
wl:0 Add all interception rules to the whitelist
wl:42 Add the interception rule with ID 42 to the whitelist
wl:42,41,43 Add interception rules with IDs 42, 41 and 43 to the whitelist
wl:-42 Add all interception rules to the whitelist, except for the interception rule with ID 42

mz:(Match Zones)

ARGS The entire GET parameter, such as: foo=bar&in=%20
$ARGS_VAR The parameter name of the GET parameter, such as foo and in in foo=bar&in=%20
$ARGS_VAR_X Parameter name of the GET parameter that matches the regular expression
HEADERS The entire HTTP protocol header
$HEADERS_VAR HTTP header name
$HEADERS_VAR_X The name of the HTTP protocol header that matches the regular expression
BODY The entire parameter content of POST
$BODY_VAR POST parameter name
$BODY_VAR_X Parameter name of the POST parameter that is matched by the regular expression
URL URL(before ?)
URL_X Regular matching URL (before?)
FILE_EXT File name (the file name uploaded when POST is used to upload a file)

Whitelist Configuration Example

Take rule #1000 as an example: Rule #1000 is a rule that filters SQL keywords such as select, update, delete, and insert.

rule illustrate
BasicRule wl:1000; Completely disable intercept rule #1000 in this subrule. Since no region is specified, all are added to the whitelist.
BasicRule wl:1000 "mz:$ARGS_VAR:foo";

Disable interception rule #1000 for all GET parameter values ​​named foo

Requests like http://mike.hi-linux.com/?foo=select * from demo will not be filtered.

BasicRule wl:1000 "mz:$URL:/bar|ARGS";

Disable interception rule #1000 for parameters in GET request with URL /bar

The following similar requests will not be filtered:

http://mike.hi-linux.com/bar?my=select * from demohttp://mike.hi-linux.com/bar?from=weibo

BasicRule wl:1000 "mz:ARGS|NAME";

Disable interception rule #1000 for all parameter names (just the name, not the parameter value) in all GET requests

The following requests are not filtered:

http://mike.hi-linux.com/bar?from=weibo

The following requests are filtered:

http://mike.hi-linux.com/bar?foo=select

Because select is a parameter value and is not within the whitelist.

BasicRule wl:0 "mz:$URL_X:^/upload/(.*).(.*)$|URL";

Disable all interception rules for URLs that match the ^/upload/(.*).(.*)$ regular rule in all requests

Requests like http://mike.hi-linux.com/upload/select.db will not be filtered (they would have triggered interception rule #1000).

Whitelist rules for actual combat# vi naxsi_BasicRule.conf
BasicRule wl:1010,1011 "mz:$ARGS_VAR:rd";
BasicRule wl:1015,1315 "mz:$HEADERS_VAR:cookie";

The above detailed explanation of the nginx-naxsi whitelist rules is all the content that the editor shares with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • Example of setting up a whitelist in Nginx using the geo module
  • How to set directory whitelist and IP whitelist in nginx
  • How to dynamically add access whitelist to nginx
  • Configure a firewall with blacklist or whitelist function for the Nginx server

<<:  Bootstrap realizes the effect of carousel

>>:  MySQL 5.7.21 winx64 green version installation and configuration method graphic tutorial

Recommend

Detailed explanation of how to use Teleport, a built-in component of Vue3

Table of contents 1. Teleport usage 2. Complete t...

Quickly solve the problem of slow startup after Tomcat reconfiguration

During the configuration of Jenkins+Tomcat server...

In-depth explanation of MySQL stored procedures (in, out, inout)

1. Introduction It has been supported since versi...

Example steps for using AntV X6 with Vue.js

Table of contents 0x0 Introduction 0x1 Installati...

Detailed process of compiling and installing Storm on Kylin V10 server

1 Introduction Apache Storm is a free, open sourc...

How to solve the problem of clicking tomcat9.exe crashing

A reader contacted me and asked why there were pr...

Div adaptive height automatically fills the remaining height

Scenario 1: Html: <div class="outer"...

A brief discussion on ifnull() function similar to nvl() function in MySQL

IFNULL(expr1,expr2) If expr1 is not NULL, IFNULL(...

Solve the problem of Syn Flooding in MySQL database

Syn attack is the most common and most easily exp...

Tips for writing concise React components

Table of contents Avoid using the spread operator...

Implementation code for infinite scrolling with n container elements

Scenario How to correctly render lists up to 1000...

Ant Design Blazor component library's routing reuse multi-tab function

Recently, there has been a growing demand for imp...

Native JS to achieve sliding button effect

The specific code of the sliding button made with...

MySQL 8.0.18 installation and configuration method graphic tutorial under MacOS

This article records the installation of MySQL 8....

HTML implements the function of detecting input completion

Use "onInput(event)" to detect whether ...