azure - 在 IIS web.config 中使用动态 IP 安全设置时忽略某些 IP 或 IP 范围

标签 azure api iis web-config

我正在运行一个 API 和一个用于 SSR 目的的前端节点服务器。一切都通过应用服务在 Azure 上进行。

节点服务器和客户端都向 API 发出请求。

我正在尝试在 API 的 web.config 中应用“dynamicIpSecurity”,但不希望我的节点服务器 IP 受到该安全设置的限制,因为它是受信任的“客户端”。

目标是通过此设置限制所有其他客户端 IP,以防客户端决定在未经我许可的情况下尝试对我进行 ddos​​ 攻击或对我的 API 进行负载测试以查找漏洞。

我目前已注释掉动态 IP 安全设置,但这就是它们的样子。

<dynamicIpSecurity>
    <!--Restricting single IP to make maximum of 20 concurrent request at a time-->
    <denyByConcurrentRequests enabled="true" maxConcurrentRequests="20" />

    <!--Restricting single IP NOT to make more than 50 requests within 3 seconds duration-->
    <denyByRequestRate enabled="true" maxRequests="50" requestIntervalInMilliseconds="3000"/>
</dynamicIpSecurity>

最佳答案

article , <dynamicIpSecurity>只能使用denyByConcurrentRequestsdenyByRequestRate阻止来自基于 The number of concurrent requests 的 IP 地址的请求或者 The number of requests over a period of time .

尽管作为 article说,<dynamicIpSecurity>可以Allow list of IP addresses that will not be blocked 。但是在web.config中无法配置,只能在IIS中进行配置。

因此,如果您仍想定义基于 IP 的安全限制列表,您可以使用 <ipSecurity>如下所示:

<security>
   <ipSecurity allowUnlisted="true">
      <add ipAddress="192.168.100.1" />
      <add ipAddress="169.254.0.0" subnetMask="255.255.0.0" />
   </ipSecurity>
   <dynamicIpSecurity enableLoggingOnlyMode="true">
       <denyByConcurrentRequests enabled="true" maxConcurrentRequests="10" />
       <denyByRequestRate enabled="true" maxRequests="30"
           requestIntervalInMilliseconds="300" />
   </dynamicIpSecurity>
</security>

关于azure - 在 IIS web.config 中使用动态 IP 安全设置时忽略某些 IP 或 IP 范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55385359/

相关文章:

asp.net - 我可以在一个 Web 应用程序中跨多个服务使用身份验证吗?

api - 做 REST url 的正确方法是什么?

c++ - 用于桌面应用程序的 Twitter API 库?

ios - 是一种在ios 上阅读Apple API 内部实现的方法吗?

javascript - 正则表达式,我怎么说,匹配除一个词以外的所有内容?

asp.net - 在应用程序级别之外使用注册为allowDefinition ='MachineToApplication'的节是错误的

PHP fatal error : Class 'Imagick' not found - Windows 7 64bit IIS PHP 5. 2

html - 为什么在 Azure Web 应用程序中找不到我的静态 html 文件?

azure - 默认情况下在新子网 (Azure) 上应用 NSG/ASG

azure - 为所有资源创建 Application Insights 警报