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

Example of using JS to determine whether an element is an array

Here are the types of data that can be verified l...

Practical record of vue using echarts word cloud chart

echarts word cloud is an extension of echarts htt...

MySQL cursor principle and usage example analysis

This article uses examples to explain the princip...

Eight ways to implement communication in Vue

Table of contents 1. Component Communication 1. P...

CSS3 realizes the animation effect of lotus blooming

Let’s look at the effect first: This effect looks...

Repair solution for inconsistent MySQL GTID master and slave

Table of contents Solution 1: Rebuild Replicas Pr...

Implementation of multi-environment configuration (.env) of vue project

Table of contents What is multi-environment confi...

How to deploy tomcat in batches with ansible

1.1 Building the Directory Structure This operati...

Analysis of the difference between HTML relative path and absolute path

HTML beginners often encounter the problem of how ...

Nodejs global variables and global objects knowledge points and usage details

1. Global Object All modules can be called 1) glo...

Nginx proxy forwarding implementation code uploaded by Alibaba Cloud OSS

Preface Because the mini program upload requires ...

How to sort a row or column in mysql

method: By desc: Neither can be achieved: Method ...

Summary of commonly used SQL in MySQL operation tables

1. View the types of fields in the table describe...