IP Security - Configure IP address restrictions in Web.Config on IIS

Restrict access to your website using IIS IP security

commit f0946ac · authored · 1 min read

IP Security - Configure IP address restrictions in Web.Config on IIS

When your website is using some kind of proxy/firewall just like Sucuri to increase the security, you need to make sure that only the allowed ones are accessing the site directly, so that all the requests to the site is going through the firewall.

To ensure this, we use the IP security feature in IIS, in which we can configure which IP’s are allowed.

<system.webServer>
...
<security>
<ipSecurity allowUnlisted="false">
<clear />
<add ipAddress="-.-.-.-" subnetMask="-.-.-.-" allowed="true" />
<add ipAddress="-.-.-.-" subnetMask="-.-.-.-" allowed="true" />
<add ipAddress="-.-.-.-" subnetMask="-.-.-.-" allowed="true" />
<add ipAddress="-.-.-.-" subnetMask="-.-.-.-" allowed="true" />
</ipSecurity>
...
</security>
</system.webServer>

In the above code, we set allowUnlisted attribute to false to prevent access to all IP address unless they are listed. And then we add the allowed IP addresses one by one. eg.

<add ipAddress="192.168.134.0" subnetMask="255.255.254.0" allowed="true" />

Additional Resource

local graph · open full graph

"IP Security - Configure IP address restrictions in Web.Config on IIS" is connected to the topics Internet Information Services, Security, ASP.NET and related to 7 other entries. IIS - OPTIONS Requests Returns 404 IIS - OPTIONS Requests Retu… Enable Click-Jacking Protection - Umbraco Enable Click-Jacking Protec… Redirect HTTPS requests to HTTP using IIS Rewrite rule in Web.Config Redirect HTTPS requests to … Redirect HTTP to HTTPS using Web.Config in IIS Redirect HTTP to HTTPS usin… Redirect WWW to Non-WWW using Web.Config in IIS Redirect WWW to Non-WWW usi… Redirect non-www urls to www urls Redirect non-www urls to ww… Create New Database Level User Create New Database Level U… Internet Information Services #iis Security #security ASP.NET #aspnet IP Security - Configure IP addres…

comments

loading discussion…