Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Luawaf configuration View tool

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report