【问题标题】:How we can add whitelist IP when using load balancer?使用负载均衡器时如何添加白名单 IP?
【发布时间】:2020-04-14 20:01:15
【问题描述】:

对于使用 Ant Media Server 的扩展解决方案,我们如何在使用负载均衡器时将 IP 列入白名单?如您所知,负载均衡器 IP 动态变化,Ant Media Server 现在可以将域名列入白名单? 应该怎么设置?

【问题讨论】:

标签: webrtc live-streaming low-latency aws-load-balancer ant-media-server


【解决方案1】:

对于这个请求,您有 2 个选择。

选项 1 - 使用 REST 方法设置 IP 过滤器

第 1 步 - 删除 /AMS_DIR/webapps/root/WEB-INF/web.xml 中的以下代码 sn-ps

<filter>
<filter-name>AuthenticationFilter</filter-name>
<filter-class>io.antmedia.console.rest.AuthenticationFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>AuthenticationFilter</filter-name>
<url-pattern>/rest/*</url-pattern>
</filter-mapping>

第 2 步 - 使用以下支持 GET 方法的 REST 方法请求应用程序设置

http://domain-address.com:5080/rest/getSettings/WebRTCAppEE

返回该应用程序的设置对象。

第 3 步 - 在设置对象中添加/编辑 remoteAllowedCIDR 字段并将设置发送到对象到下面的以下 REST 方法。

http://domain-address:5080/rest/changeSettings/WebRTCAppEE

请求类型:POST

内容类型:application/json

您可以将逗号分隔的 CIDR 表示法或 IP 地址添加到 remoteAllowedCIDR。例如:

remoteAllowedCIDR=127.0.0.1,12.44.55.3/24,192.123.33.66

注意:您可以更改请求 https、端口地址、WebRTCAppEE 等应用程序

选项 2 - 使用 MongoDB 设置 IP 过滤器

第 1 步 - 更新 MongoDB 中设置对象中的 settings.remoteAllowedCIDRupdateTime​ 字段 -> clusterdb​ -> AppSettings collection​。此外,您可以将 MongoDB 与服务连接。

a- 你可以像上面一样更改settings.remoteAllowedCIDR

b- 您还应该更新 updateTime​ 字段。您可以以毫秒为单位设置当前时间(System.currentTimeMillis())。让我提供一些关于为什么我们需要更新 updateTime 的更多信息。

每个 AMS 都会定期检查 AppSettings 中的 updateTime​ 字段以更新应用程序设置。所以,在更新remoteAllowedCIDR​字段之后,你需要更新updateTime​字段,让每个节点自己更新。

注意:在 clusterdb 中,应用程序设置作为集合存储在 MongoDB 中。

您还可以查看以下有关 MongoDB 事务和 AppSettings 类的文档:

https://docs.mongodb.com/manual/core/transactions-in-applications/

https://docs.mongodb.com/manual/crud/#update-operations

https://github.com/ant-media/Ant-Media-Server-Common/blob/master/src/main/java/io/antmedia/AppSettings.java#L533

【讨论】:

    【解决方案2】:

    在这种设置中,我建议在负载平衡器级别使用安全性。

    在 Ant 管理员中禁用 IP 安全性的快速选项是添加 0.0.0.0/0 通配符。

    【讨论】:

      猜你喜欢
      • 2019-08-13
      • 1970-01-01
      • 1970-01-01
      • 2019-01-09
      • 2021-12-07
      • 2020-02-20
      • 2018-08-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多