主頁 > 知識庫 > linux系統(tǒng)中 屏蔽storm ui的kill功能的兩種方法

linux系統(tǒng)中 屏蔽storm ui的kill功能的兩種方法

熱門標(biāo)簽:地圖標(biāo)注怎么兼職 滁州外呼系統(tǒng)接口對接 營業(yè)廳外呼系統(tǒng)有錄音嗎 地圖標(biāo)注和視頻彩鈴制作生意 南通電銷外呼系統(tǒng)排名 信陽智能外呼系統(tǒng)聯(lián)系方式 宿松百度地圖標(biāo)注 南京電銷外呼系統(tǒng)廠家 合力億捷外呼系統(tǒng)如何解壓安裝

  今天有個storm的topology被人kill掉了,但是找不到是誰做的,storm的ui有kill topology的功能,但是沒有權(quán)限驗證,這樣就導(dǎo)致知道ui地址的任何人都可以kill掉topology,比較危險,考慮把這個action disable掉。

  有兩種方法:

  1.前端增加nginx,做location

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


復(fù)制代碼
代碼如下:
  input enabled="" onclick="confirmAction('xxxxxxxxxx', 'xxxxxxxx', 'kill', true, 30)" type="button" value="Kill">

  調(diào)用了js的confirmAction方法,這個方法存在于storm-core/src/ui/public/js/script.js 中,方法的定義如下:


復(fù)制代碼
代碼如下:
  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為觸發(fā)kill時手動填入的時間,比如這里的30s,最終的url格式如下:


復(fù)制代碼
代碼如下:
  /topology/xxxxx/kill/xxxx

  第二步就是根據(jù)這個設(shè)置觸發(fā)一個ajax請求,這里我們只需要關(guān)心第一步即可,設(shè)置nginx如下:


復(fù)制代碼
代碼如下:
  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功能了。

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

  2.更改代碼,去掉action相關(guān)的button


復(fù)制代碼
代碼如下:
  storm-core/src/ui/public/topology.html

  去除掉下面的部分:


復(fù)制代碼
代碼如下:
  div id="topology-actions">
  h2 class="js-only">Topology actions/h2>
  p id="topology-actions" class="js-only">
  /p>
  /div>

  第二種方法需要重新編譯,還沒有做測試。。

  以上就是linux系統(tǒng)中屏蔽storm ui的kill功能的2種方法,在此感謝本文的原創(chuàng)作者 “菜光光的博客” ,請務(wù)必保留此出處http://caiguangguang.blog.51cto.com/1652935/1557514,謝謝閱讀,希望能幫到大家,請繼續(xù)關(guān)注腳本之家,我們會努力分享更多優(yōu)秀的文章。

標(biāo)簽:衢州 麗水 運城 銅陵 新余 保定 山南 潛江

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《linux系統(tǒng)中 屏蔽storm ui的kill功能的兩種方法》,本文關(guān)鍵詞  linux,系統(tǒng),中,屏蔽,storm,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《linux系統(tǒng)中 屏蔽storm ui的kill功能的兩種方法》相關(guān)的同類信息!
  • 本頁收集關(guān)于linux系統(tǒng)中 屏蔽storm ui的kill功能的兩種方法的相關(guān)信息資訊供網(wǎng)民參考!
  • 企业400电话

    智能AI客服机器人
    15000

    在线订购

    合计11份范本:公司章程+合伙协议+出资协议+合作协议+股权转让协议+增资扩股协议+股权激励+股东会决议+董事会决议

    推薦文章