Nil*_*Pun 6 security asp.net-mvc web-config whitelist cidr
我们需要将来自 WAF 的 IP 地址范围列入白名单,如下所示:
199.83.128.0/21
198.143.32.0/19
149.126.72.0/21
103.28.248.0/22
 45.64.64.0/22
185.11.124.0/22 
192.230.64.0/18
更多详情:
我正在使用 .net ipSecurity部分。但是还没有找到如何添加上述 ip 地址而不必添加所有 ip 地址的示例。
例如
<ipSecurity allowUnlisted="false">
        <!-- this line blocks everybody, except those listed below -->
        <clear/>
        <add ipAddress="xx.xx.xx.xx" allowed="true"/>
      </ipSecurity>
我是子网掩码的新手。
有没有一种优雅的方法来实现这一点?
在199.83.128.0/21中,21是子网掩码的CIDR格式。您可以使用转换表将 CIDR 格式转换为 IP 地址。
然后将 IPSecurity 设置为拒绝除指定 IP 地址之外的所有地址。IE:
<security>
  <ipSecurity allowUnlisted="false">
    <add allowed="true" ipAddress="199.83.128.0"   subnetMask="255.255.255.240"/>
    [add additional ip addresses here]
  </ipSecurity>
</security>