装置nginx+ngx_lua支撑WAF防护功用

访客5年前关于黑客接单867

 

nginx lua模块 *** 开发的nginx第三方模块,它能将lua言语嵌入到nginx装备中,然后运用lua就极大增强了nginx的才能.nginx以高并发而闻名,lua脚本简便,两者的调配可谓完美.

用处: 避免sql注入,本地包括,部分溢出,fuzzing测验,xss,SSRF等web进犯

避免svn/备份之类文件走漏

避免ApacheBench之类压力测验东西的进犯

屏蔽常见的扫描黑客东西,扫描器

屏蔽反常的 *** 恳求

屏蔽图片附件类目录php履行权限

避免webshell上传

体系:centos 6.4_x64

需求的软件:LuaJIT-2.0.3.tar.gz

tengine-2.1.0.tar.gz (nginx)

ngx_devel_kit-master.zip (ngx_devel_kit)

lua-nginx-module-master.zip (nginx_lua模块)

ngx_lua_waf-master.zip (waf战略 web运用防火墙)

yum -y install gcc gcc-c++ ncurses-devel libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel autoconf pcre-devel libtool-libs freetype-devel gd zlib-devel zip unzip wget crontabs iptables file bison cmake patch mlocate flex diffutils automake make readline-devel glibc-devel glibc-static glib2-devel bzip2-devel gettext-devel libcap-devel logrotate ntp libmcrypt-devel GeoIP*

装置LuaJIT 2.0

tar zxf LuaJIT-2.0.0.tar.gz

cd LuaJIT-2.0.0

make && make install

注:lib和include是直接放在/usr/local/lib和usr/local/include

再来设置环境变量(这是给后边nginx编译的时分运用的):

vi /etc/profile

export LUAJIT_LIB=/usr/local/lib

export LUAJIT_INC=/usr/local/include/luajit-2.0

export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH

source /etc/profile

装置nginx

tar zxvf tengine-2.1.0.tar.gz

cd tengine-2.1.0

./configure --user=www --group=www --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-pcre=/root/lnmp/pcre-8.20 --with-google_perftools_module --with-http_realip_module --with-poll_module --with-select_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_slice_module --with-http_mp4_module --with-http_gzip_static_module --with-http_concat_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_sysguard_module --with-http_browser_module=shared --with-http_user_agent_module=shared --with-http_upstream_ip_hash_module=shared --with-http_upstream_least_conn_module=shared --with-http_upstream_session_sticky_module=shared --with-http_addition_module=shared --with-http_xslt_module=shared --with-http_image_filter_module=shared --with-http_sub_module=shared --with-http_flv_module=shared --with-http_slice_module=shared --with-http_mp4_module=shared --with-http_concat_module=shared --with-http_random_index_module=shared --with-http_secure_link_module=shared --with-http_sysguard_module=shared --with-http_charset_filter_module=shared --with-http_userid_filter_module=shared --with-http_footer_filter_module=shared --with-http_trim_filter_module=shared --with-http_access_module=shared --with-http_autoindex_module=shared --with-http_map_module=shared --with-http_split_clients_module=shared --with-http_referer_module=shared --with-http_uwsgi_module=shared --with-http_scgi_module=shared --with-http_memcached_module=shared --with-http_limit_conn_module=shared --with-http_limit_req_module=shared --with-http_empty_gif_module=shared

make && make install

报过错请履行 error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: No such file or directory

ln -s /usr/local/lib/libluajit-5.1.so.2 /lib64/libluajit-5.1.so.2

然后创立下面文件夹

mkdir -p /data/logs/{client_body,hack}

chown -R www:www /data

chmod -R 755 /data

解压ngx lua waf-master.zip

unzip ngx_lua_waf-master.zip

mv ngx_lua_waf-master/* /usr/local/webserver/nginx/conf/

vi /usr/local/webserver/nginx/conf/config.lua

RulePath = waf的途径--规矩寄存目录

logdir = 日志记载地址--log存储目录,该目录需求用户自己新建,切需求nginx用户的可写权限

attacklog = "off" --是否敞开进犯信息记载,需求装备logdir

UrlDeny="on" --是否阻拦url拜访

Redirect="on" --是否阻拦后重定向

CookieMatch = "on" --是否阻拦cookie进犯

postMatch = "on" --是否阻拦post进犯

whiteModule = "on" --是否敞开URL白名单

[1] [2]  黑客接单网

相关文章

探寻如何绕过WAF的XSS检测机制-黑客接单平台

一、前语 本文提出了一种清晰界说的办法,即通过勘探假定出检测歹意字符串的规矩并编写Payload,来绕过跨站脚本进犯(XSS)的安全防备机制。咱们提出的办法共包含三个阶段:确认Payload结构、勘探...

根据机器学习的web反常检测

Web防火墙是信息安全的第一道防地。跟着网络技能的快速更新,新的黑客技能也层出不穷,为传统规矩防火墙带来了应战。传统web侵略检测技能经过保护规矩集对侵略拜访进行阻拦。一方面,硬规矩在灵敏的黑客面前,...

为什么干流网站无法捕获 XSS 缝隙?

 二十多年来,跨站脚本(简称 XSS)缝隙一直是干流网站的心头之痛。为什么过了这么久,这些网站仍是对此类缝隙束手无策呢? 关于最近 eBay 网站曝出的跨站脚本缝隙,你有什么主意?为什么会呈现这样的漏...

Node.js使用的反向shell

布景介绍 一个小型Web开发者团队曾托付咱们对他们的移动使用进行安全评价,该使用的后端是一个REST API。该使用的架构很简单,只由3台linux服务器组成: Node.js MongoDB Red...

CTF标题实战:2019-Hgame-Web-Week4

前语 最近使用空余时刻做了一下Hgame,以下是部分web题题解。 happyPython 信息收集 发现是flask,顺手测验一下。 http://118.25.18.223:3001/{{1+1}...

运用 PtH 进犯 NTLM 认证的 Web 使用

本文具体介绍了在Windows/Active Directory环境中运用PtH进犯NTLM认证的web运用的具体进程。该技能细节来源于Alva ‘Skip’ Duckwall 和Chris Camp...