Naxsi 开源项目教程

Naxsi 开源项目教程

naxsiNAXSI is an open-source, high performance, low rules maintenance WAF for NGINX项目地址:https://gitcode.com/gh_mirrors/na/naxsi

1. 项目的目录结构及介绍

Naxsi 项目的目录结构如下:

nbs-system/naxsi/
├── naxsi_config/
├── naxsi_src/
├── nxapi/
├── .gitattributes
├── .gitignore
├── .travis.yml
├── LICENSE
├── README.md
├── README_original.md
└── logo.png

目录介绍

  • naxsi_config/: 包含 Naxsi 的配置文件。
  • naxsi_src/: 包含 Naxsi 的源代码。
  • nxapi/: 包含 Naxsi 的 API 相关文件。
  • .gitattributes: Git 属性配置文件。
  • .gitignore: Git 忽略配置文件。
  • .travis.yml: Travis CI 配置文件。
  • LICENSE: 项目许可证文件。
  • README.md: 项目说明文档。
  • README_original.md: 原始项目说明文档。
  • logo.png: 项目 Logo 图片。

2. 项目的启动文件介绍

Naxsi 项目的启动文件主要是 Nginx 配置文件,通常位于 naxsi_config/ 目录下。以下是一个典型的 Nginx 配置文件示例:

http {
    include       mime.types;
    default_type  application/octet-stream;

    # Naxsi core rules
    include naxsi_core.rules;

    server {
        listen       80;
        server_name  localhost;

        location / {
            # Naxsi rules
            include naxsi.rules;
            # Naxsi basic configuration
            include naxsi_basic.conf;

            root   html;
            index  index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

启动文件介绍

  • naxsi_core.rules: Naxsi 的核心规则文件。
  • naxsi.rules: Naxsi 的具体规则文件。
  • naxsi_basic.conf: Naxsi 的基本配置文件。

3. 项目的配置文件介绍

Naxsi 的配置文件主要位于 naxsi_config/ 目录下,以下是一些关键的配置文件介绍:

naxsi_core.rules

这是 Naxsi 的核心规则文件,包含了基本的防护规则,例如防止 SQL 注入和 XSS 攻击。

naxsi.rules

这是 Naxsi 的具体规则文件,可以根据实际需求进行定制,添加或修改防护规则。

naxsi_basic.conf

这是 Naxsi 的基本配置文件,包含了 Naxsi 模块的基本设置,例如错误日志路径、拦截模式等。

配置文件示例

# naxsi_core.rules
SecRulesEnabled;
DeniedUrl "/RequestDenied";
CheckRule "$SQL >= 8" BLOCK;
CheckRule "$XSS >= 8" BLOCK;

# naxsi.rules
BasicRule wl:0 "mz:$URL:/login|ARGS:username";
BasicRule wl:0 "mz:$URL:/login|ARGS:password";

# naxsi_basic.conf
LearningMode;
SecRulesDisabled;

配置文件介绍

  • SecRulesEnabled;: 启用安全规则。
  • DeniedUrl "/RequestDenied";: 设置请求被拒绝时的跳转 URL。
  • CheckRule "$SQL >= 8" BLOCK;: 设置 SQL 注入检测规则。
  • CheckRule "$XSS >= 8" BLOCK;: 设置 XSS 攻击检测规则。
  • BasicRule wl:0 "mz:$URL:/login|ARGS:username";: 设置特定 URL 和参数的规则。
  • LearningMode;: 启用学习模式。
  • SecRulesDisabled;: 禁用安全规则。

以上是 Naxsi 开源项目的教程,包含了项目的目录结构、启动文件和配置文件的介绍。希望对您有所帮助。

naxsiNAXSI is an open-source, high performance, low rules maintenance WAF for NGINX项目地址:https://gitcode.com/gh_mirrors/na/naxsi

  • 25
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

谢贝泰Neville

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值