手机
当前位置:查字典教程网 >操作系统 >unix linux >为了系统的安全Linux中如何屏蔽storm ui的kill功能
为了系统的安全Linux中如何屏蔽storm ui的kill功能
摘要:Linux系统中storm的ui有killtopology功能如果没有屏蔽的话,就会导致storm的topology很容易被人kill掉,如...

Linux系统中storm的ui有kill topology功能如果没有屏蔽的话,就会导致storm的topology很容易被人kill掉,如果你的topology出现被人kill的情况,多半是ui地址被人知道了,为了系统的安全,有必要将storm ui的kill功能进行屏蔽,一起来了解下吧。

为了系统的安全Linux中如何屏蔽storm ui的kill功能1

有两种方法:

1.前端增加nginx,做location

分析ui页面,对应kill的button,html中的action为:

代码如下:

《input enabled=“” onclick=“confirmAction(‘xxxxxxxxxx’, ‘xxxxxxxx’, ‘kill’, true, 30)” type=“button” value=“Kill”》

调用了js的confirmAction方法,这个方法存在于storm-core/src/ui/public/js/script.js 中,方法的定义如下:

代码如下:

function confirmAction(id, name, action, wait, defaultWait) {var opts = {type:‘POST’,url:‘/topology/’ + id + ‘/’ + action};

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格式如下:

代码如下:

/topology/xxxxx/kill/xxxx

第二步就是根据这个设置触发一个ajax请求,这里我们只需要关心第一步即可,设置nginx如下:

代码如下:

upstream storm {

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;

}

}

这样,就可以屏蔽掉前端的kill功能了。

注意一个细节,storm ui的默认端口时8080,这个端口和nm冲突(见bug https://github.com/yahoo/storm-yarn/issues/25),设置storm.yaml ui.port: 8888,并重启ui即可。

2.更改代码,去掉action相关的button

代码如下:

storm-core/src/ui/public/topology.html

去除掉下面的部分:

代码如下:

《div id=“topology-actions”》

《h2 class=“js-only”》Topology actions《/h2》

《p id=“topology-actions” class=“js-only”》

《/p》

《/div》

第二种方法需要重新编译,还没有做测试。。

以上就是linux系统中屏蔽storm ui的kill功能的方法介绍了,本文一共介绍了两种方法,因为第二种方法还没测试,所以你可以使用第一种方法进行屏蔽。

【为了系统的安全Linux中如何屏蔽storm ui的kill功能】相关文章:

Linux中安装oray服务的步骤分享

使Linux系统上的程序开机后自动运行

操作系统安全防范简述:Linux篇

Linux下如何用GCC编译动态库

轻松实现Linux下的互联网过滤功能

Linux rpm tar 操作系统下软件的安装与卸载方法

在Linux下如何使用软盘、光盘等分区

Linux根目录下主要目录功能说明

系统安全:Linux服务器安全隐患以及防范对策

怎样在Linux上录制你的终端操作及回放

精品推荐
分类导航