CloudFoundry上运行的应用远程调试的一些安全考虑

We recommend that you never have the debugger listen on a public IP address. If you need to allow remote debugging connections we recommend the use of ssh tunnels instead. We provide the following example for illustrative purposes only. Please understand the security risk of allowing remote access to a privileged service before proceeding.

处于安全考虑,不要让被调试的应用监听在一个公网地址上,最佳实践是使用ssh隧道。

Let’s say you are running Node on remote machine, remote.example.com, that you want to be able to debug. On that machine, you should start the node process with the inspector listening only to localhost (the default).

假设有一个nodejs应用运行在一台远程服务器上,比如remote.example.com, 如果想要远程调试,必须通过带参数的方式启动该nodejs应用,即:

$ node --inspect server.js

现在假设我们想在本地调试,那么需要用SSH在本地机器和服务器之间建立一个安全通道。命令如下:

ssh -L 9221:localhost:9229 [email protected]

这个通道把本地端口9221和远程机器的9229连接起来了。
要获取更多Jerry的原创文章,请关注公众号"汪子熙":

CloudFoundry上运行的应用远程调试的一些安全考虑