今天有个storm的topology被人kill掉了,但是找不到是谁做的,storm的ui有kill topology的功能,但是没有权限验证,这样就导致知道ui地址的任何人都可以kill掉topology,比较危险,考虑把这个action disable掉。
有两种方法:
1.前端增加nginx,做location
分析ui页面,对应kill的button,html中的action为:
代码如下:
调用了js的confirmAction方法,这个方法存在于storm-core/src/ui/public/js/script.js 中,方法的定义如下:
代码如下:
if (wait) {
var waitSecs = prompt('Do you really want to ' + action + ' topology "' + name + '"? ' +'If yes, please, specify wait time in seconds:',defaultWait);if (waitSecs != null && waitSecs != "" && ensureInt(waitSecs)) {opts.url += '/' + waitSecs;} else {return false;}
} else if (!confirm('Do you really want to ' + action + ' topology "' + name + '"?')) {return false;}
$("input[type=button]").attr("disabled", "disabled");$.ajax(opts).always(function () {window.location.reload();}).fail(function () {alert("Error while communicating with Nimbus.")});return false;}
以看到方法主要分为两步,生成post请求的url,格式为'/topology/' + id + '/' + action + '/' + waitSecs,这里action为kill,waitSecs为触发kill时手动填入的时间,比如这里的30s,最终的url格式如下:
代码如下:
第二步就是根据这个设置触发一个ajax请求,这里我们只需要关心第一步即可,设置nginx如下:
代码如下:
server 127.0.0.1:8888 weight=3 max_fails=3 fail_timeout=5s;}
server {
server_name storm.xxx.com;
listen 80;
proxy_set_header Host $host;
proxy_read_timeout 3600;
proxy_set_header X-Forwarded-For $remote_addr;access_log /var/log/nginx/storm.access.log main;error_log /var/log/nginx/storm.error.log debug;location ~* /topology/(.*)/kill/(.*) {return 403;}
location / {
proxy_pass http://storm;
}
}
注意一个细节,storm ui的默认端口时8080,这个端口和nm冲突(见bug https://github.com/yahoo/storm-yarn/issues/25),设置storm.yaml ui.port: 8888,并重启ui即可.
2.更改代码,去掉action相关的button
代码如下:
去除掉下面的部分:
代码如下:
<h2 class="js-only">Topology actions</h2>
<p id="topology-actions" class="js-only">
</p>
</div>
第二种方法需要重新编译,还没有做测试。。
以上就是linux系统中屏蔽storm ui的kill功能的2种方法,在此感谢本文的原创作者 “菜光光的博客” ,请务必保留此出处http://caiguangguang.blog.51cto.com/1652935/1557514,谢谢阅读,希望能帮到大家,请继续关注快网idc,我们会努力分享更多优秀的文章。
相关文章
- 个人网站搭建:如何挑选具有弹性扩展能力的服务器? 2025-06-10
- 个人服务器网站搭建:如何选择适合自己的建站程序或框架? 2025-06-10
- 64M VPS建站:能否支持高流量网站运行? 2025-06-10
- 64M VPS建站:怎样选择合适的域名和SSL证书? 2025-06-10
- 64M VPS建站:怎样优化以提高网站加载速度? 2025-06-10
- 2025-07-10 怎样使用阿里云的安全工具进行服务器漏洞扫描和修复?
- 2025-07-10 怎样使用命令行工具优化Linux云服务器的Ping性能?
- 2025-07-10 怎样使用Xshell连接华为云服务器,实现高效远程管理?
- 2025-07-10 怎样利用云服务器D盘搭建稳定、高效的网站托管环境?
- 2025-07-10 怎样使用阿里云的安全组功能来增强服务器防火墙的安全性?
快网idc优惠网
QQ交流群
-
2025-05-29 98
-
2025-05-29 42
-
2025-05-29 51
-
2025-06-04 55
-
2025-05-25 50