系統(tǒng)之家 - 系統(tǒng)光盤下載網(wǎng)站!

當(dāng)前位置:系統(tǒng)之家 > 系統(tǒng)教程 > Linux屏蔽storm ui的kill功能

Linux中如何屏蔽storm ui的kill功能

時(shí)間:2014-12-12 16:42:11 作者:qipeng 來(lái)源:系統(tǒng)之家 1. 掃描二維碼隨時(shí)看資訊 2. 請(qǐng)使用手機(jī)瀏覽器訪問(wèn): https://m.xitongzhijia.net/xtjc/20141212/32524.html 手機(jī)查看 評(píng)論

  Linux系統(tǒng)中storm的ui有kill topology功能如果沒(méi)有屏蔽的話,就會(huì)導(dǎo)致storm的topology很容易被人kill掉,如果你的topology出現(xiàn)被人kill的情況,多半是ui地址被人知道了,為了系統(tǒng)的安全,有必要將storm ui的kill功能進(jìn)行屏蔽,一起來(lái)了解下吧。

 Linux中如何屏蔽storm ui的kill功能

  有兩種方法:

  1.前端增加nginx,做location

  分析ui頁(yè)面,對(duì)應(yīng)kill的button,html中的action為:

  代碼如下:

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

  調(diào)用了js的confirmAction方法,這個(gè)方法存在于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請(qǐng)求的url,格式為‘/topology/’ + id + ‘/’ + action + ‘/’ + waitSecs,這里action為kill,waitSecs為觸發(fā)kill時(shí)手動(dòng)填入的時(shí)間,比如這里的30s,最終的url格式如下:

  代碼如下:

  /topology/xxxxx/kill/xxxx

  第二步就是根據(jù)這個(gè)設(shè)置觸發(fā)一個(gè)ajax請(qǐng)求,這里我們只需要關(guān)心第一步即可,設(shè)置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 https://storm;

  }

  }

  這樣,就可以屏蔽掉前端的kill功能了。

  注意一個(gè)細(xì)節(jié),storm ui的默認(rèn)端口時(shí)8080,這個(gè)端口和nm沖突(見bug https://github.com/yahoo/storm-yarn/issues/25),設(shè)置storm.yaml ui.port: 8888,并重啟ui即可。

  2.更改代碼,去掉action相關(guān)的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》

  第二種方法需要重新編譯,還沒(méi)有做測(cè)試。。

  以上就是linux系統(tǒng)中屏蔽storm ui的kill功能的方法介紹了,本文一共介紹了兩種方法,因?yàn)榈诙N方法還沒(méi)測(cè)試,所以你可以使用第一種方法進(jìn)行屏蔽。

標(biāo)簽 storm

發(fā)表評(píng)論

0

沒(méi)有更多評(píng)論了

評(píng)論就這些咯,讓大家也知道你的獨(dú)特見解

立即評(píng)論

以上留言僅代表用戶個(gè)人觀點(diǎn),不代表系統(tǒng)之家立場(chǎng)

其他版本軟件

熱門教程

人氣教程排行

Linux系統(tǒng)推薦

官方交流群 軟件收錄