【问题标题】:Creating IP table rules for a Bluemix app for Secure Gateway为 Secure Gateway 的 Bluemix 应用程序创建 IP 表规则
【发布时间】:2016-02-06 11:27:10
【问题描述】:

Bluemix Doc 中有用于 Secure Gateway 服务的新部分:Creating IP table rules for a Bluemix app

很遗憾,我不明白我应该做什么。例如。文本说以这种形式进行 API 调用:PUT /v1/sgconfig/:<gateway_id>/destinations/:<endpoint_id>/ipTableRule 这永远不会起作用,它应该说像curl -k --request PUT https://sgmanager.ng.bluemix.net/v1/sgconfig/...

另外,在安全网关定义中的Advanced / Network Options 下,我是否需要检查Restrict network access to cloud endpoint 的选项?

有人可以修改文本吗?更重要的是,请添加一个示例?

【问题讨论】:

  • 我已经打开了一个工作项来审查和更新文档。

标签: security integration ibm-cloud secure-gateway


【解决方案1】:

如果您想强制执行 IP 表规则,那么是的,您需要选中 Restrict network access to cloud endpoint 框。此时,您将添加您想要强制执行的规则,例如:192.0.0.19000(单个 IP 和端口)、192.0.0.1-192.0.0.55000:5005(IP 范围和端口范围)或其中的任何组合。

如果您使用 cURL 创建您的私人目的地,您可以使用如下命令:

curl "https://sgmanager.ng.bluemix.net/v1/sgconfig/<gateway_id>/destinations" \
-H "Authorization: Bearer <security_token>" \
-H "Content-type: application/json" \
-d '{"desc":"My Private Destination","ip":"1.1.1.1","port":8000,"private":true}' -k

创建私有目标后,您可以使用以下命令添加 IP 表规则:

curl -X PUT "https://sgmanager.ng.bluemix.net/v1/sgconfig/<gateway_id>/destinations/<destination_id>/ipTableRule" \
-H "Authorization: Bearer <security_token>" \
-H "Content-type: application/json" \
-d '{"src":"192.0.0.1","spt":"9000"}' -k

curl -X PUT "https://sgmanager.ng.bluemix.net/v1/sgconfig/<gateway_id>/destinations/<destination_id>/ipTableRule" \
-H "Authorization: Bearer <security_token>" \
-H "Content-type: application/json" \
-d '{"src_range":"192.0.0.1-192.0.0.5","spt":"5000:5005"}' -k

请注意,这里的第一个命令使用src 提供单个IP,而第二个命令使用src_range 提供一系列IP。

【讨论】:

  • 感谢您的指导。但我想限制对 Bluemix 应用程序的访问:只有我的 Bluemix 应用程序 XYZ 应该能够连接到我的本地目标端点。我不知道我的 Bluemix 应用程序的 IP 地址,即使我今天知道它,如果我重新启动它,它明天也可能会改变。如何为 Bluemix 应用程序配置它?
  • 您的 BlueMix 应用程序可以在启动时调用 Secure Gateway API,为自己动态添加 IP 表规则。如果您的 IP 将经常更改并且您不希望有逻辑来删除以前的 IP 表规则(这可能很困难,因为您不一定知道您以前的 IP),您可以在正文中提供一个应用程序 ID添加规则时 (app : &lt;appID&gt;)。如果您提供应用 ID,它将替换已使用该 ID 的任何其他规则。
  • 为了澄清我之前的评论,来自您的 BlueMix 应用程序的请求正文可能只是 {"src":"&lt;IP-of-BM-App&gt;","app":"&lt;desired-App-ID&gt;"}。这将向 SG 目标添加一个 IP 表规则,该规则应允许来自该 IP 的流量来自任何端口。如果您提供具有相同应用 ID 的另一个规则,它将替换之前关联的规则。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-09-16
  • 1970-01-01
  • 2016-07-08
  • 1970-01-01
相关资源
最近更新 更多