A firewall is a program installed on your computer or a piece of hardware that uses a rule set to block or allow access to a computer, server or network. It separates your internal network from the external network (the Internet).
Firewalls can permit traffic to be routed through a specific port to a program or destination while blocking other malicious traffic. A firewall can be a hardware, software, or a blending of both.
The firewall has two network connections. One is facing outward towards the WAN (wide area network or Internet), and the other one is facing inwards towards your private network or LAN (local area network).These firewall connections allow for specific traffic to travel from one side one the network to the other.
Stateful or Stateless?
There are two types of firewalls; Stateful or Stateless.
Stateful firewalls keep track of the state or type of connection that is made and can remember specific traits of that connection. For example, if you connect to a server via FTP, the connection details are noted and retained by the firewall and will allow that traffic to pass back and forth unchecked. Other traits may include details like the IP address or ports participating in the actual connection.
Stateless firewalls block or allow Internet traffic to a server based on a firewall ruleset or, the origin and destination web addresses requested by the server. Stateless firewalls do not inspect the packets of information sent to or from the server.
The windows firewall interface can be accessed multiple ways. The first way we will look at is via the windows search function.
- Login to your server using your preferred remote desktop application.
- Click the search icon and type in “firewall“. Then, click on the “Windows Firewall with Advanced Security” icon.
- This will open the firewall management interface.
The second way to access the Windows firewall interface is via the Start menu.
- Click on the Windows Start button in the lower left corner of the screen.
- Click on the Windows Administrative Tools action box.
- Then, click on the Windows Firewall with Advanced Security.
In this general overview, you can verify that the firewall is up and running and also show what each profiles current settings are.
Profiles are simply a grouping of firewall rules dependent on where a server is connected.
Domain Profile: This profile is used when the server is connected to a domain controller, which in turn is controlling a windows domain. This profile should be the least restrictive of the other domain profiles because security is usually very well controlled.
Private Profile: This profile is used if the server is part of or within a private network not directly connected to the Internet. In these cases, the server will be behind a router or hardware firewall. (This profile should be less restrictive than the domain profile above because security is usually well controlled)
Public Profile: This profile is used when the server is connected directly to a public network like a restaurant, library or airport. (This profile should be the most restrictive because security is usually not well controlled or uncontrolled)
- To turn the Windows Firewall off or on, open the firewall using one of the methods listed above in the “How Do I Access The Windows Server Firewall?” section.
- Once open, click on the Windows Firewall Properties link below the profile section.
- This will open a dialog box denoting the three different profiles discussed earlier (as well as the IPsec Settings tab)
- Under the Domain Profile tab, click on the Firewall state dropdown menu and select off.
- Depending on your settings and need, you can also disable the Firewall of the other profiles(highlighted in red above).
- Once you have disabled the firewall for the selected profile, click Apply, then OK.
- To turn the Firewall back on, simply reverse the process. Select the Profile you wish to enable the firewall for, click on the dropdown and select On (recommended).
- Once you have re-enabled the firewall for the selected profile, click Apply, then OK.
There are several basic behaviors of the Windows Firewall.
- Windows Firewall never blocks outgoing traffic.
Any requests sent out from the server will not be hindered in any way.
- Windows Firewall blocks all incoming traffic except for traffic that is in responses to a request.
This means that if you make a request to Google, Google’s inbound reply to your outbound request will not be blocked.
- Windows Firewall blocks all other traffic.
This means that any traffic not explicitly allow is blocked in the firewall.
There are two kinds of exceptions included in the basic firewall behavior: Port Exceptions and Program Exception.
- In the Windows Firewall with Advanced Security window, right-click Inbound Rules, and then click New Rule in the action pane.
- Rule Type dialog box, select Port and then click Next.
- In the Protocol and Ports dialog box, select TCP. Then select Specific local ports, and then type the port number.
- In the Action dialog box, select Allow the connection and then click Next.
- In the Profile dialog box, select any profiles that apply and then click Next.
- In the Name dialog box, type a name and description for this rule, and then click Finish.
- At this point, you will be dropped back to the main firewall screen. You will now see a new rule in the Main Firewall rules in the center section,as well as a new listing in the right window panel.
- To remove a specific rule, start at the basic firewall view.
- Select Inbound Rules in the top left window panel.
- Select the rule you would like to remove and either right-click the rule and click click delete or…
- Select the rule from the right-hand window pane (in this case, FTP 21), and click on Delete.
- A dialog box will pop up asking you to confirm the rule removal, click Yes.
- Click on the “Inbound Rules” option on the top left of the firewall interface. Then, click on the “New rule…”
- Under “Rule Type”, select the option “Program” and then click “Next”.
- Next, select the option “This Program path” and click “Next”.
- In this field, you can begin typing the path/location of the program to allow. In this case, we selected Windows Mail and click “Next”.
- Next, we select the option “Allow the connection” and then click “Next”.
- Select the profile the rule will be applied to. (We have allowed all three for demonstration purposes. Your selection may vary.)
- Select a name and description for this rule and then Click “Finish”.
- At this point, you will be dropped back to the main firewall screen. You will now see a new rule in the Main Firewall rules in the center section, as well as a new listing in the right window pane
Removing a port for a specific program is a lot easier than opening it! To remove an existing rule for a program:
- Go back into the firewall’s main interface
- Click on “Inbound Rules” in the left window pane.
- Select the rule you would like to remove (we are going to remove the FTP rule we added earlier). Rght-click on the rule which will open a context menu. Then click Delete.
- Another dialog box will pop up asking you to confirm the rule removal, click yes.
In summary, the windows firewall passes all outgoing traffic and allows incoming responses to that outbound traffic, allows incoming port/program exceptions and rejects all other incoming traffic. Overall, the windows firewall is a robust, easily configurable security feature that will provide the needed levels of protection to keep your server safe.