Issue with IP Addresses and Domain Restrictions in IIS - iis

i have windows server 2019 with iis 10 installed, ip and domain restriction enabled ip range 10.0.0.1=>10.0.0.240 - domain name : lo-server.com
the problem that am facing is : when adding a local ip address / Same ip with server / same network / example 10.0.0.66 to deny list it works perfectly it deny the access
but when i add an ip address outside the network / 192.168.20.10 / which is connected to a firewall ( FortiGate ) 10.0.0.200 the restriction doesn't work i need to add the firewall ip to deny it which i don't want to do it because i'll block all the ranges that are connected to the firewall.
how can i deny access to another network without adding the firewall

Microsoft considered the simplest case for you and implemented the so called Proxy mode, which you might try out,
https://learn.microsoft.com/en-us/iis/get-started/whats-new-in-iis-8/iis-80-dynamic-ip-address-restrictions#configuring-iis-for-proxy-mode
Deep down inside it checks x-forwarded-for header to see whether the incoming HTTP requests are through a proxy (the firewall in your case) and then apply the rules to decide whether to deny any request.
However, a real world proxy can manipulate the incoming requests in too many ways, so the proxy mode might fail you and you will have to switch to something like URL Rewrite module and write a more complicated rule to abort the desired requests.

You can use the IP Address and Domain Restrictions feature page to define and manage rules that allow or deny access to content for a specific IP address, a range of IP addresses, or a domain name or names.
Opens the Add Deny Restriction Rule dialog box from which you can define rules that allow access to content for a specific IP address, a range of IP addresses, or a DNS domain name.
More information you can refer to this link: IP Address and Domain Restrictions.

Related

pfSense(21.05.1): Whitelist Fully Qualified Domain Name

I have created pfSense(version: 21.05.1) firewall on Azure VM. In the LAN section, I have made a rule to deny any traffic, so all the traffic to the internet is blocked. Also, I have created an alias that contains the URL www.google.com. However, even after making a firewall rule to allow traffic to this alias, I cannot send traffic to www.google.com.
Can anyone please help me understand how to set up the firewall to allow a specific domain(www.google.com) and block all other domains?
[N.B.: I understand one way of achieving this is by finding out all the I.P. address(es) related to the domain and adding them to alias, but it is common for websites to use CDN services that don’t use anycast routing. In this case, the dns resolver can provide an I.P. address that is not present in the list, and this may block the traffic, even if the domain is allowed]
You can create alias with host type and under the hosts, you can add the FQDN such as www.google.com
Now, you can use this alias to create rule to allow traffic to this alias.
Reference : Firewall — Aliases | pfSense Documentation (netgate.com)

Accessing IIS website from another device without creating an inbound rule

I have deployed my flask application on IIS using the IP address. I want to access this from another PC in the network, I have read about creating an inbound rule and allowing the access but is there a safer way to do this?
In my opinion, you could use the 80 port which is usually an open port.
if you want to use another port you can set the firewall and use the private only in profile:
after that, you could use iis IP and domain name restriction to restrict the other ip then the remote machine IP.
you can follow the below steps to allow connections from specific IP addresses:
1)Open IIS Manager
2)In IIS Manager, expand SERVERNAME > Sites > click on a required website > double-click IP Address and Domain Restrictions
3)Click Add Allow Entry... (on the right pane) to add an IP address or IP address range that will be allowed to access the website. Click OK.
4)Once allowed IP addresses have been added, click Edit Feature Settings... and select Deny for Access for unspecified clients. Click OK.
Now, only users with the specified IP addresses are able to access the website.

Blocking access to the admin panel via .htaccess

How can I block all IP addresses for accessing the admin panel of my site and make my PC the only device that can access the site. I used this code:
order deny,allow
deny from all
allow from ***public_IP***
but it would allow all the IP addresses within the network. I was figuring out how to block ALL including addresses within the network. One problem I encounter is that the addresses are dynamic. As I search google, people are saying that the code above is cannot be used to dynamic IP's.
What can you suggest?
Connect via a VPN and Whitelist the VPN IP only instead.
If you want privacy, you will have to set up a network which only have you in it.

Only allow private access to website through VPN

I know this may be very basic, but I have a website on my server that I would only like to be accessed by VPN. I have OpenVPN running on my Windows machine and it is connecting to my server with the VPN. When the VPN connects I can use the VPN's IP address to hit the site on my server. I would like to block all other methods such as the actual site IP or my domain name. Would I use htaccess? What is normally done for private access only.
Let's say that your server vpn ip is 10.1.2.3 then you should add to your apache configuration
Listen 10.1.2.3:80
so that you will bind Apache - i.e. will accept incoming requests - only to that address.
Also:
The Listen directive does not implement Virtual Hosts - it only tells
the main server what addresses and ports to listen on. If no
directives are used, the server will behave in the same
way for all accepted requests. However, can be used to
specify a different behavior for one or more of the addresses or
ports. To implement a VirtualHost, the server must first be told to
listen to the address and port to be used. Then a
section should be created for the specified address and port to set
the behavior of this virtual host. Note that if the is
set for an address and port that the server is not listening to, it
cannot be accessed.
i.e. you could leave the original listen directive (listen to all interfaces) and filter the access per virtual host having your "private" virtual host configured like that:
<VirtualHost 10.1.2.3:80>
see http://httpd.apache.org/docs/2.4/bind.html
Finally if for some reason you are restricted to .htaccess only, then you could do in .htaccess:
Order Deny,Allow
Deny from all
Allow from 10.1.2.1/24
i.e. allowing access only from your vpn subnet.
Take care that you will need to restart the web server after every change.

Sonicwall Access Rule - Limit Access to Specific IP

I have a SonicWall TZ200 and used the Wizard to create a port forwarding for PPTP which is working great. Now, I want to limit the EXTERNAL IP addresses that can use this port forwarding rule so that it only allows connections from a couple employees static home IP addresses.
I created an Address Object for the external home IP address. Then I went to Access Rules WAN>LAN. For the PPTP rule I changed Allow Source to the Address Object for the home IP address.
But, I can still access the VPN from a different external IP address so it's obviously not blocking anything else.
What am I missing?
You need to set your NAT policy. The "Home" IP addresses are added at the "Original Destination" part of your policy.

Resources