Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Luawaf configuration View tool

Shulou Source: shulou.com Published: 2022-06-01 01:41:36 10月04日 Update

Reason: in openresty-waf applications, it is common practice to save configuration information to ngx.shared.config. Each check rule configuration is then read from here.

Sometimes the problem of incorrect configuration reading is encountered, which affects the progress of troubleshooting.

So write a small function that is easy to view and configure.

A simple configuration page is written in lua to make it easy to view the current configuration:

Location / show {default_type text/html Content_by_lua_block {local config = ngx.shared.config local keys = config:get_keys (512) ngx.print ('') for I K in pairs (keys) do local str = ((nil ~ = str) and str.. [[#]] .config: get (k) or config:get (k) ngx.say (") ngx.say (k.." = > ".. str) ngx.say (") end ngx.say ()}}

The principle is to read the configuration of ngx.shared.config and note that the xmp tag is used to prevent the pit displayed by xss.

Tags: Configuration questions information practices functions principles reasons tags rules progress pages active application impact inspection tools Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux MySQL Xiaomi MariaDB Microsoft