zoukankan      html  css  js  c++  java
  • openresty用naxsi防xss、SQL注入

    下载naxsi

    wget https://github.com/nbs-system/naxsi/archive/untagged-afabfc163946baa8036f.tar.gz
    tar zxvf untagged-afabfc163946baa8036f.tar.gz
    mv naxsi-untagged-afabfc163946baa8036f/ naxsi

    编译openresty加上--add-module

    ./configure --prefix=/usr/local/openresty --with-http_stub_status_module --with-http_gzip_static_module --with-luajit --add-module=/usr/local/naxsi/naxsi_src

    将核心规则复制到openresty的conf中

    cp /usr/local/naxsi/naxsi_config/naxsi_core.rules /usr/local/openresty/nginx/conf/

    自定义一个规则文件

    vi /usr/local/openresty/nginx/conf/mySite.rules

    内容为

    #开启 naxsi
    SecRulesEnabled;
    #定义阻止请求的位置
    DeniedUrl "/50x.html";
    #CheckRules, 确定 naxsi 何时采取行动
    CheckRule "$SQL >= 8" BLOCK;
    CheckRule "$RFI >= 8" BLOCK;
    CheckRule "$TRAVERSAL >= 4" BLOCK;
    CheckRule "$EVADE >= 4" BLOCK;
    CheckRule "$XSS >= 8" BLOCK;

    编辑opernresty的主配置文件

    vi /usr/local/openresty/nginx/conf/nginx.conf

    在http中引用核心规则

    在接口中引用自定义规则

  • 相关阅读:
    02.jwt单点登录
    04.RBAC
    COM interop
    C++、c#互调用之VC6 调用 VC6 COM
    Type Library Importer (Tlbimp.exe)
    C++、C#互调用之C++ 调用C# dll
    VS tools
    Type Library to Assembly 转换摘要
    7个顶级心理预言
    c++、C#互调用之c# 调用 vc6 COM
  • 原文地址:https://www.cnblogs.com/kgdxpr/p/9841456.html
Copyright © 2011-2022 走看看