Mulesoft :- 强制实施 url 仅收听代理(或)安全实施 url

Mulesoft :- Force Implementation url to listen to proxy only (or) Secure Implementation url

如何强制实施 url 在 Mulesoft 中仅从代理监听?

现在可以使用 client_id、client_secret 等来保护代理。但是实施 url 并不安全。碰巧如果有人知道实现 url 那么它的潜在风险事件。

有什么方法可以强制实施 url 只听代理。

(或) 我们能否在实施中添加政策 url.

Mulesoft 文档 setting-up-an-api-proxy states that the proxy application is nothing but a mule application mocking the contractual behavior of the actual service implementation and making service calls to the actual API for fulfilling requests. So instead of HTTP, it is recommended to use HTTPS 以增强安全性和数据完整性。由于 Mulesoft 建议在 mule 代理和服务实现之间使用 HTTPS 协议,因此利用 HTTPS 协议,一种选择是尝试 在代理和实现之间强制执行双向 SSL 这将帮助您只接受来自合法客户的请求。

查看主题 enable-two-way-ssl-in-mule 了解更多实施细节

第二个选项是在实际服务实施上启用策略,即在您的服务上启用 api-auto-discovery。 虽然你可以做到,但由于以下原因,这将是一项开销:

  1. 正如您将在两层执行策略并将 调用 API 管理器将策略同步为服务 实现将每隔固定时间间隔轮询 API 管理器 是时候 check/fetch 政策了。
  2. 要在服务实现上启用策略应用程序, 服务需要在 api-gateway runtimemule 3.8 上 运行 以后 运行时间较旧的 mule 版本不支持策略。

可以通过在 API xml.

中添加以下 XML 片段来完成实施
<api-platform-gw:api apiName="app-${env}" version="${api.version}" flowRef="api-main" create="true" apikitRef="api-config" doc:name="API Autodiscovery" />
  • apiName 将是在 API 管理器中创建的 API 定义 您可以查看和管理 API
  • 版本与 API
  • 的主要版本相同
  • flowRef 会将其映射到主流引用
  • 创建标志以表示是否需要在 API 管理器中创建定义以防它不存在

Conclusion:

  1. Enforce 2 way SSL to enforce client-server certificate based authentication
  2. Add Auto Discovery to service implementation so to apply policies on implementation layer as well

Mulesoft 文档建议添加 VPC 。当我们测试 http 在 VPC 中工作但不是 https 时。

由于 https 是一项强制性要求,我们无法通过 VPC 做到这一点,因此我们以不同的方式对其进行了修复。

我们在代理代码中添加了自定义 header 并在实施中验证了 header。

这是已推出的修复程序