{"id":18435998,"url":"https://github.com/oneinstack/ngx_lua_waf","last_synced_at":"2025-04-07T20:32:31.194Z","repository":{"id":51322846,"uuid":"138464227","full_name":"oneinstack/ngx_lua_waf","owner":"oneinstack","description":"ngx_lua_waf是一个基于lua-nginx-module的web应用防火墙","archived":false,"fork":false,"pushed_at":"2021-08-31T01:40:08.000Z","size":68,"stargazers_count":48,"open_issues_count":3,"forks_count":22,"subscribers_count":5,"default_branch":"master","last_synced_at":"2023-05-22T17:55:12.015Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oneinstack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-24T08:01:03.000Z","updated_at":"2023-04-17T12:17:34.000Z","dependencies_parsed_at":"2022-09-24T19:50:31.168Z","dependency_job_id":null,"html_url":"https://github.com/oneinstack/ngx_lua_waf","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oneinstack%2Fngx_lua_waf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oneinstack%2Fngx_lua_waf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oneinstack%2Fngx_lua_waf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oneinstack%2Fngx_lua_waf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oneinstack","download_url":"https://codeload.github.com/oneinstack/ngx_lua_waf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223291629,"owners_count":17120965,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T06:09:55.591Z","updated_at":"2024-11-06T06:09:55.668Z","avatar_url":"https://github.com/oneinstack.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"### ngx_lua_waf\nngx_lua_waf是一个基于lua-nginx-module的web应用防火墙, 支持验证码验证\n\n### OneinStack启用ngx_lua_waf \n```\n~/oneinstack/addons.sh\n#install ngx_lua_waf\n```\n### 手工安装\n```\ncd /root/oneinstack/src\nwget http://luajit.org/download/LuaJIT-2.1.0-beta3.tar.gz  #推荐2.1版本\nwget https://github.com/openresty/lua-cjson/archive/2.1.0.6.tar.gz -o lua-cjson-2.1.0.6.tar.gz\ngit clone https://github.com/simpl/ngx_devel_kit.git\ngit clone https://github.com/openresty/lua-nginx-module.git\ntar xzf LuaJIT-2.1.0-beta3.tar.gz\ntar xzf lua-cjson-2.1.0.6.tar.gz\ncd LuaJIT-2.1.0-beta3\nmake \u0026\u0026 make install\ncd ../lua-cjson-2.1.0.6\nsed -i 's@LUA_INCLUDE_DIR.*@LUA_INCLUDE_DIR \\?=   \\$(PREFIX)/include/luajit-2.1@' Makefile\nmake \u0026\u0026 make install\ncd ..\nexport LUAJIT_LIB=/usr/local/lib\nexport LUAJIT_INC=/usr/local/include/luajit-2.1\nsed -i \"s@^nginx_modules_options=.*@nginx_modules_options='--with-ld-opt=-Wl,-rpath,/usr/local/lib --add-module=../lua-nginx-module --add-module=../ngx_devel_kit'@\" options.conf\n./install.sh --nginx_option 1\n\n### 全局nginx新增waf\ncat \u003e /usr/local/nginx/conf/waf.conf \u003c\u003c EOF\nlua_shared_dict limit 20m;\nlua_package_path \"/usr/local/nginx/conf/waf/?.lua;;\";\ninit_by_lua_file \"/usr/local/nginx/conf/waf/init.lua\";\naccess_by_lua_file \"/usr/local/nginx/conf/waf/access.lua\";\nEOF\n\n#vi /usr/local/nginx/conf/nginx.conf\n#include vhost/*.conf;下一行新增，如下\ninclude waf.conf;\n\n### 单网站新增waf(推荐)\ncat \u003e /usr/local/nginx/conf/waf.conf \u003c\u003c EOF\nlua_shared_dict limit 20m;\nlua_package_path \"/usr/local/nginx/conf/waf/?.lua;;\";\ninit_by_lua_file \"/usr/local/nginx/conf/waf/init.lua\";\nEOF\n\n#vi /usr/local/nginx/conf/vhost/www.example.com.conf\n#location ~ [^/]\\.php(/|$) {下一行新增，如下\naccess_by_lua_file \"/usr/local/nginx/conf/waf/access.lua\";\n#注意：wordpress URL改成ngx.var.request_uri\n 66         local ATTACK_URL = ngx.var.host .. ngx.var.uri\n 67         -- local ATTACK_URL = ngx.var.host .. ngx.var.request_uri\n#改成：\n 66         -- local ATTACK_URL = ngx.var.host .. ngx.var.uri\n 67         local ATTACK_URL = ngx.var.host .. ngx.var.request_uri\n```\n\n### Copyright\ncopy以下项目:\u003cbr /\u003e\nhttps://github.com/loveshell/ngx_lua_waf\u003cbr /\u003e\nhttps://github.com/unixhot/waf\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foneinstack%2Fngx_lua_waf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foneinstack%2Fngx_lua_waf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foneinstack%2Fngx_lua_waf/lists"}