如何禁止在IBM Cloud(Bluemix)上匿名访问我的NodeRed UI仪表板? [英] How could I prohibit anonymous access to my NodeRed UI Dashboard on IBM Cloud(Bluemix)?

查看:121
本文介绍了如何禁止在IBM Cloud(Bluemix)上匿名访问我的NodeRed UI仪表板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在样板IBM云中使用node-red.我知道有一种方法可以更改环境变量(NODE_RED_USERNAME和NODE_RED_PASSWORD)的值,以更改编辑器流程的用户名和密码.但是,UI仪表板呢?我的意思是使用仪表板节点.禁止访问

I'm working with node-red, on boilerplate IBM cloud. I know that there is a way, changing the value of enviroments variables(NODE_RED_USERNAME and NODE_RED_PASSWORD), to change username and password of the editor flow. But, what about UI dashboard? I mean using dashboard nodes. Forbid access to

https://noderedservicename.mybluemix.net/ui/

我知道在代码上,更改文件settings.js上的变量httpNodeAuth可以做我想做的事情.在IBM Cloud上这样做的方式是什么? 预先谢谢你!

I know that on the code, changing the variable httpNodeAuth on the file settings.js I can do what I want. What is the way for doing that on IBM Cloud? Thank you in advance!

推荐答案

您需要添加httpNodeAuth(而不是httpAdminAuth,因为这是用于控制对Node-RED编辑器的访问,并且可以使用环境变量来完成) app/bluemix-settings.js文件中讨论.

You need to add the httpNodeAuth (not the httpAdminAuth as this is for controlling access to the Node-RED editor and can done with the environment variables discussed in the other answer.) to the app/bluemix-settings.js file.

类似这样的东西:

...
httpStatic: path.join(__dirname,"public"),
httpNodeAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."},
functionGlobalContext: { },
...

有关如何生成pass的详细信息,请参见此处

Details of how to generate the pass can be found here

您可以通过多种方法来编辑文件,其中包括将Node-RED部署链接到git存储库或下载整个应用程序,编辑文件并将其推回Bluemix(首次部署Node时). -RED从入门包中提供了有关如何下载源进行更改然后将其推回的说明.您可以通过单击Node-RED Bluemix控制台页面中的入门"链接来获得这些说明.

There are a number of ways you can edit the file, some of which include linking the Node-RED deployment to a git repository or downloading the whole app, editing the file and pushing it back to Bluemix (when you first deploy Node-RED from the starter pack it gives you instructions on how to download the source to make changes and then push them back. You can get to these instructions by clicking on the "Getting started" link in your Node-RED Bluemix console page).

但是最快/最简单/最简单的方法可能只是通过SSH进入实例并使用诸如vi之类的文件来更改文件.有关如何SSH到应用程序实例的详细信息,请参见此处.但是以下方法应该起作用:

But the quickest/simplest/dirtiest way is probably to just SSH into the instance and change the file with something like vi. Details on how to ssh to an app instance can be found here. But the following should work:

cf ssh [app name]

编辑完文件后,您需要告诉bluemix重新启动应用程序.您可以从Web控制台或使用cf命令行工具执行此操作.

Once you have edited the file you will need to tell bluemix to restart the app. You can do this from the web console or with the cf command line tool.

(如果重新启动应用程序,则此方法所做的更改将无法保存,或者bluemix决定将您的实例内部移动到另一台计算机,因为它将从推送的源中重建应用程序.永久性的解决方案是下载源,编辑并后退)

(The changes made by this method will not survive if the app is restaged, or bluemix decides to move your instance to another machine internally because it will rebuild the app from the pushed sources. The permanent solution is to download the source, edit and push back)

这篇关于如何禁止在IBM Cloud(Bluemix)上匿名访问我的NodeRed UI仪表板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆