【发布时间】:2017-06-16 22:58:15
【问题描述】:
我们有一个在 Azure 中部署为应用服务的 Web 应用。我们希望通过一个 IP 地址白名单来限制对它的访问,这可以在某些 Azure 应用服务设置中完成,而不是在我们在项目中拥有的 web.config 中完成。
目前,这就是我们在环境中进行 IP 地址限制的方式。
-
生产:我们为应用服务设置了 VNet 集成。我们将
NSG附加到VNet'sSubnet并从NSG我们可以控制入站和出站访问。 -
暂存:我们在
web.config中有以下配置块,其中包含允许访问暂存服务器中的应用服务的列入白名单的 IP 地址。<security> <ipSecurity allowUnlisted="false" denyAction="NotFound"> <add allowed="true" ipAddress="some ip address" subnetMask="255.255.255.254"></add> <add allowed="true" ipAddress="some ip address" subnetMask="255.255.255.254"></add> </ipSecurity> </security> 开发(本地):我们必须取消注释我们本地开发机器中的
<security>配置块,因为我们并不真的需要它。它会导致错误,请看下面的截图。
这是HttpFailre_09-07-33.html的一些内容
Module IpRestrictionModule
Notification BeginRequest
Handler aspNetCore
Error Code 0x80070021
Config Error This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".
我们希望从 web.config 中完全删除此 <security> 块,因为另一个原因,我们不希望 IP 地址进入生产环境。
而且,我们不允许在我们的暂存服务器中进行 VNet 集成(管理的东西,呃!任何削减成本的东西!)。
那么有没有办法限制 Azure App Service 中的 IP 地址?
【问题讨论】:
标签: security azure web-config azure-web-app-service