starjun / openstar Goto Github PK
View Code? Open in Web Editor NEWlua waf,nginx+lua,openresty,luajit,waf+,cdn,nginx
lua waf,nginx+lua,openresty,luajit,waf+,cdn,nginx
5460 在谷歌浏览器下面访问成了下载页面怎么回事
假设起来可以正常运行了,但是有这么几个问题
1 遇到恶意请求的时候页面显示的是乱码,修改浏览器编码后可以正常显示,这个应该在哪里修改啊,比如统一改成gb2312之类的,这个页面是否可以自己定义
2 想要把日志发出去怎么配置啊,比如发给Logstash
3 现在有没有一些统计信息的展示啊,没找到。。
报错信息如下:
*1767 lua entry thread aborted: runtime error: /opt/openresty/openstar/i_worker.lua:130: attempt to index local 'optl' (a userdata value)
stack traceback:
coroutine 0:
/opt/openresty/openstar/i_worker.lua: in function </opt/openresty/openstar/i_worker.lua:127>, context: ngx.timer
1、openstar 的路径正确,/opt/openresty/openstar
2、/opt/openresty/openstar/lib/optl.lua 这个文件存在
3、waf.conf 中lua_package_cpath "/opt/openresty/openstar/lib/?.so;;"; 这行也没有注释;
但还是报上面的错误
CVE-2018-9230 这个漏洞测试可以绕过.
基于OpenResty构造的WEB安全防护,大多数使用ngx.req.get_uri_args、ngx.req.get_post_args获取uri参数,即默认限制100,并没有考虑参数溢出的情况,攻击者可构造超过限制数的参数,轻易的绕过安全防护。
IP模块是否可以支持IP段模式?
能不能给个上传和图片木马规则的示例,参考app那里面的示例不会弄。
谢谢
access_all.lua 第556-559行if else判断逻辑可能有问题 ,导致限制高频次访问的ip 封禁时间都为pTime,
原代码: if ip_count == nil then
local pTime = v.network.pTime or 10
limit_ip_dict:set(mod_ip,1,pTime)
else
修改后:
if ip_count == nil then
local pTime = v.network.pTime or 10
local bTime = v.network.blackTime or 600
limit_ip_dict:set(mod_ip,1,bTime)
else
经测试后 ip封禁时间为 blackTime,network这段整体逻辑不是很清楚,这样改可能存在bug,请留意
-- 拉取config_dict配置数据
local function pull_redisConfig()
local httpc = http.new()
local _url = "http://127.0.0.1:5460/api/dict_redis?action=pull&key=all_dict"
local res, err = httpc:request_uri(_url,{
method = "GET",
headers = {
["Host"] = "127.0.0.1:5460",
}
})
if not res then
ngx_log(ngx_ERR, "failed to pull_redisConfig request: ", err)
return
else
return true
end
end
这里为什么没有 http.close(),会造成连接泄漏吧?
在url 后面输入and 1=1这样的 连接直接变成了下载 这个是正常模式吗
我有一个需求,网站上有些请求地址不需要进行过滤拦截,比如富文本编辑器提交的内容或者爬虫功能配置提交的内容,这些功能不进行过滤拦截,我该如何配置?
9994#0: *54544 lua entry thread aborted: runtime error: /opt/openresty/openstar/access_all.lua:559: bad argument #1 to 'pairs' (table expected, got nil)
nginx version: openresty/1.15.8.1
不知道是不是个例,在开启openstar后,nginx内存占用百分比持续升高,直到系统崩溃。。。关闭后,nginx内存占用趋于稳定
背景:站点一直有垃圾蜘蛛频繁访问,为节省宽带,使用了openstar,并用了ua策略,但是开启之后过几分钟站点访问速度明显减慢,nginx内存持续上升,经一段时间观察测试,发现以上问题。不知道是不是个例。。。
请问大佬集群中多台机器部署的话,有需要额外配置的地方吗?还是只要能正常运行就行了?
过cdn的话remote_addr 为cdn地址,http_x_forwarded_for 为真实ip。
如果想对发起请求的真实 ip 加ip黑名单,需要怎么设置?
io.open会产生阻塞,如果在高并发的情况下,用io.open效果肯定不好。
有考虑有其他的方式么?比如socket?
2017/09/22 16:07:24 [error] 12373#12373: *350 lua entry thread aborted: runtime error: ~/openresty/openstar/lib/optl.lua:481: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
coroutine 0:
[C]: in function 'pairs'
~/openresty/openstar/lib/optl.lua:481: in function 'get_table'
~/openresty/openstar/access_all.lua:46: in function <~/openresty/openstar/access_all.lua:1>, client: 192.168.*.*, server: *.*.cn, request: "POST *.*?action=save HTTP
code写的不错,文档太多地方读不通了
如header中真实字段名为real_ip(包含下划线时),无法匹配改真实ip字段
{
"localhost": {
"ips": ["*",""],
"realipfrom": "real_ip"
}
}
该规则匹配header中的 real-ip(中划线),那么如何匹配带下划线的header字段呢?
打字
在使用中有这么一个需求,就算是403的时候把request 的内容也记录下来,现在默认情况下只能记录请求的url但是并无法记录post的内容,是否考虑把这部分也输出
首先,感谢分享的知识。
我大概看了下,没理解。
我对于楼的项目关注点在 CC防护上面。
之前用过一个开源版本使用的 Httpguard 防护CC的不过code太老了,自己想重写,但是又没那么多时间去搞这个东西,lua语言使用也是一知半解。
主要想问楼主两个问题:
1,代码是否一直开源?
2,github上的代码是否会一直维护?
3,是否可以写一个使用文档文档详解
4,Read 里面写的确实比较乱,最好有个清晰的结构看来比较容易。希望能改进下
用你的bash里面的脚本进行安装
直接这样了
uname -a
Linux HostKvm-42eb96 3.10.0-229.1.2.el7.x86_64 #1 SMP Fri Mar 27 03:04:26 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
##########################
cat /proc/version
Linux version 3.10.0-229.1.2.el7.x86_64 ([email protected]) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) ) #1 SMP Fri Mar 27 03:04:26 UTC 2015
##########################
cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 13
model name : QEMU Virtual CPU version 1.5.3
stepping : 3
microcode : 0x1
cpu MHz : 2199.998
cache size : 4096 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 4
wp : yes
flags : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pse36 clflush mmx fxsr sse sse2 syscall nx lm rep_good nopl pni cx16 hypervisor lahf_lm
bogomips : 4399.99
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 13
model name : QEMU Virtual CPU version 1.5.3
stepping : 3
microcode : 0x1
cpu MHz : 2199.998
cache size : 4096 KB
physical id : 1
siblings : 1
core id : 0
cpu cores : 1
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 4
wp : yes
flags : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pse36 clflush mmx fxsr sse sse2 syscall nx lm rep_good nopl pni cx16 hypervisor lahf_lm
bogomips : 4399.99
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
##########################
cat /etc/issue 或cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
##########################
getconf LONG_BIT (Linux查看版本说明当前CPU运行在32bit模式下, 但不代表CPU不支持64bit)
64
./install.sh install/openstar/openresty/check
init.lua没有初始化base.json ,运行时报500
access_all.lua 中的表 next_tb 没有初始化,运行报错
在哪配置限制上传后缀和上传图片木马呢?
openresty版本,1.17.8.2
curl http://127.0.0.1,返回500 Internal Server Error
nginx errorlog如下
报错如下:coroutine 0:
/opt/openresty/openstar/i_worker.lua: in function </opt/openresty/openstar/i_worker.lua:127>, context: ngx.timer
2020/12/02 15:54:51 [error] 29#0: *1819 lua entry thread aborted: runtime error: /opt/openresty/openstar/i_worker.lua:130: attempt to index local 'optl' (a userdata value)
stack traceback:
异常包体如下:
导致异常包体.txt
#测试版本:1.5.0.7---1.5.0.10
#通过burp进行发包。
#正常处理请求回复时间在30ms左右,这条处理异常的情况,时间达到了60s+
#截图如下:
自己在实践过程中学习到了很多.
因为我是新人, 所以有些问题不太懂
比如在单机/集群那里
感激不尽
这个阶段你直接修改内容进行替换,会有问题吧,替换后过短,会导致timeout;
过长会导致阶段
没看你在header_filter阶段,content_length set nil 或者change content_length
我搭建了几台他们之间的规则这么同步呢
您现在的redis同步我看是全量的, 代价是不是有点大, 是否有考虑做成增量的, 是否ip_Mod考虑增量?
而且我看您在api/ip_dict.lua中 , 只做了nginx.shared.ip_dict的修改, 然而相关文件(conf/ip_Mod.json)并没有同步修改.会完善吗?
使用中在访问kinbana的时候有页面被拦截了
HTTP/1.1 403 /api/saved_objects/_find?type=dashboard&per_page=1000&page=1&search_fields=title^3&search_fields=description Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36 waf_log: [args_HPP] deny No: 0
没有找到args_HPP对应的规则,求教下。
还有就是如何对某个路径白名单,比如/api/saved_objects/这个路径后面所有的请求都放过
nginx 的error.log 显示出错如下:
[C]: in function 'raw_header'
/opt/openresty/openstar/access_all.lua:32: in function </opt/openresty/openstar/access_all.lua:1>, client: 110.81.7.88, server: _, request: "GET /favicon.ico HTTP/2.0", host: "179.226.234.102", referrer: "https://179.226.234.102/index.html"
2017/11/11 12:31:16 [error] 20108#0: *9095 lua entry thread aborted: runtime error: /opt/openresty/openstar/access_all.lua:32: http v2 not supported yet
stack traceback:
coroutine 0:
您好,现在http2应用挺广了。openstar要怎么样才可以支持http2呢?
建议增加ModSecurity,并使用ModSecurity-nginx将ModSecurity安装为OpenResty的模块
建议更新 openresty 里面的 opm 版本:https://opm.openresty.org/package/starjun/openstar/
建议提供一些开源的 waf 相关的特征库
能否提供商业版本的demo
用脚本安装完后一直报这个,请问是什么原因
2020/10/20 23:15:47 [error] 70063#0: *884 lua entry thread aborted: runtime error: /opt/openresty/openstar/i_worker.lua:130: attempt to index local 'optl' (a userdata value)
stack traceback:
coroutine 0:
/opt/openresty/openstar/i_worker.lua: in function </opt/openresty/openstar/i_worker.lua:127>, context: ngx.timer
访问http://localhost: 5460报500错误,后台error.log日志如下:
/opt/openresty/openstar/i_worker.lua: in function </opt/openresty/openstar/i_worker.lua:127>, context: ngx.timer
2021/05/07 18:35:20 [error] 4184#0: *711 lua entry thread aborted: runtime error: /opt/openresty/openstar/i_worker.lua:130: attempt to index local 'optl' (a number value)
stack traceback:
coroutine 0:
默认的规则对sql、xss注入拦截效果不太好,自己完善规则成本较大,是否能支持libinjection?
怎么过滤post请求中json格式的内容?比如{"xx":"xx";"hacker":''zz''},我要过滤"hacker"字眼。
比如一些访问统计啊和拦截记录什么,把数据可视化显示出来,这样方便巡查什么的
======================================================
POST //xmlrpc.php HTTP/1.1
Host: 172.19.100.9
Content-Length: 160093
Connection: close
Accept-Encoding: gzip,deflate
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.21 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.21
Accept: /
======================================================
How to compile libgetuuid for macos?
Following bug reached.
openstar/lib/libgetuuid.so: unknown file type, first eight bytes
openstar/lib/libgetuuid.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
[root@baji openresty]# /opt/openresty/nginx/sbin/nginx -t
nginx: [emerg] unknown log format "main" in /opt/openresty/openstar/conf/waf.conf:62
nginx: configuration file /opt/openresty/nginx/conf/nginx.conf test failed
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.