LAB 2 - Firewall Policies
LAB 2 - Firewall Policies
LAB 2 - Firewall Policies
© FORTINET
Lab 2: Firewall Policies
In this lab, you will configure firewall policies on Local-FortiGate and perform various tests on the Local-Windows
VM, to confirm that traffic is matching the desired firewall policies based on the configuration.
Objectives
l Configure firewall objects and firewall policies.
l Configure source and destination matching in firewall policies.
l Apply service and schedule objects to a firewall policy.
l Configure firewall policy logging options.
l Reorder firewall policies.
l Read and understand logs.
l Use policy lookup to find a matching policy.
Time to Complete
Estimated: 55 minutes
Prerequisites
Before beginning this lab, you must restore a configuration file to the Local-FortiGate.
In this exercise, you will configure firewall address objects. You will also configure an IPv4 firewall policy to which
you will apply firewall address objects along with schedule, services, and log options. Then, you will test the
firewall policy by passing traffic through it and checking the logs for your traffic.
At its core, FortiGate is a firewall, so almost everything that it does to your traffic is related to your firewall
policies.
By default, FortiGate has many preconfigured, well-known address objects in the factory default configuration.
However, if those objects don’t meet the needs of your organization, you can configure more.
Field Value
Name LOCAL_SUBNET
Type Subnet
Interface any
5. Click OK.
First, you will disable the existing firewall policy. Then, you will create a more specific firewall policy using the
firewall address object that you created in the previous procedure. You will also select specific services and
configure log settings.
© FORTINET
To disable an existing firewall policy
1. Continuing on the Local-FortiGate GUI, click Policy & Objects > IPv4 Policy.
2. Right-click the Full_Access firewall policy from the ID column.
3. Select Policy Status, and then click Disable.
Field Value
Name Internet_Access
Source LOCAL_SUBNET
Destination all
Schedule always
Tip: On right side of the screen, type the name in the search box, and
then click on services to add.
Action ACCEPT
NAT <enable>
3. Leave all other settings at their default values and click OK to save the changes.
© FORTINET
Test the Firewall Policy and View Generated Logs
Now that you have configured the firewall policy, you will test it by passing traffic through it and viewing the
generated logs.
© FORTINET
Enabling Generate Logs when Session Starts in the firewall policy will generate
twice the amount of log messages. You should use this option only when this level of
detail is absolutely necessary.
When you click Show Matching Logs in the firewall policy, it adds the Policy UUID
filter in forward traffic logs.
6. In the Forward Traffic logs, click X to remove the Policy UUID filter.
When you remove the Policy UUID filter, the logs show unfiltered. You will use the logs in upcoming labs.
In the applicable interface pair’s section, FortiGate will look for a matching policy, beginning at the top. Usually,
you should put more specific policies at the top; otherwise, more general policies will match the traffic first, and
your more granular policies will never be applied.
In this exercise, you will create a new firewall policy with more specific settings such as source, destination,
service, and action set to DENY. Then, you will move this firewall policy above the existing firewall policies and
observe the behavior of firewall policy reordering.
You will create a new firewall policy to match a specific source, destination, service, and action set to DENY.
After you have performed these steps, see Test the Reordering of a Firewall Policy on page 37.
© FORTINET
Field Value
Name Block_Ping
Source LOCAL_SUBNET
Destination LINUX_ETH1
Schedule always
Service PING
Tip: Type the name in the search box on right hand side and click on
services to add.
Action DENY
Now that your configuration is ready, you will test it by moving the Block_Ping firewall policy above the
Internet_Access firewall policy. The objective is to confirm that after reordering the firewall policy,
l traffic is matched to a more specific firewall policy
l the policy ID remains same
To confirm traffic matches a more granular firewall policy after reordering the firewall policy
1. Continuing on the Local-Windows VM, open a command prompt.
2. Ping the destination address (LINUX_ETH1) that you configured in the Block_Ping firewall policy.
ping –t 10.200.1.254
The ping should still work because it matches the ACCEPT policy and not the DENY policy that you created.
The Block_Ping policy was never checked, because the traffic matched the policy at the top (Internet_
Access). This demonstrates the behavior that FortiGate will look for a matching policy, beginning at the
top.
© FORTINET
3. Leave the command prompt window open and running.
4. Return to your browser where you are logging in to the Local-FortiGate GUI.
5. In Policy & Objects > IPv4 Policy, note the current ID values for both the Internet_Access and Block_Ping
firewall policies.
6. From the ID column, drag the Block_Ping firewall policy and drop it above the Internet_Access firewall policy.
When you move the Block_Ping policy up, the ID value remains the same.
7. Return to the command prompt window that is running the continuous ping.
You should see that the traffic is now blocked and the replies appear as Request timed out.
This demonstrates the outcome of the policy reordering. After moving the more granular policy above the
general access policy, the traffic is matched to the more granular policy and, based on the action DENY, the
traffic stops processing.
FortiGate can match traffic by device type by selecting a device definition in the source field. There are two types
of device identification:
l Agentless device identification, which uses traffic from the device and the device is indexed by its MAC address.
l Agent-based device identification, which uses FortiClient and sends its unique FortiClient ID to FortiGate.
In this lab, you will use the agentless device identification technique. You will add the device to the source field of
the existing firewall policy and observe the firewall policy source-matching behavior.
First, you will disable the Block_Ping firewall policy so that your traffic matches the Internet_Access firewall
policy.
If you require assistance, or to verify your work, use the step-by-step instructions that follow.
After you have performed these steps, see Configure and Test Device Identification on page 39.
Now, you will run a continuous ping to an IP address. To test the firewall policy source matching behavior, you will
add a non-matching device, such as a Linux PC, to the source field.
ping –t 10.200.1.254
© FORTINET
3. Return to your browser where you are logged in to the Local-FortiGate GUI, and click Policy & Objects > IPv4
Policy.
4. Right-click the ID column for the Internet_Access firewall policy and click Edit.
5. Click Source and in the right pane, click Device.
6. Click Linux PC.
You are choosing a device type that doesn’t match your device (Windows).
7. Click OK.
FortiGate notifies you that this action enables device identification on the source interface.
8. Click OK.
If you enable a source device type in the firewall policy, FortiGate enables device
detection on the source interface(s) of the policy.
9. Return to the command prompt on the Local-Windows VM where you are running the continuous ping.
You should see that traffic is blocked.
10. On the Local-Windows VM, open a few browser tabs and try connecting to various external websites such as:
l kb.fortinet.com
l docs.fortinet.com
The firewall blocks this traffic.
The traffic is blocked because the source device type in the firewall policy is set to Linux PC, which does not
match the Windows device from which the traffic is generated.
Do not close the command prompt. Keep the continuous ping running until you are
notified to stop it.
© FORTINET
Modify the Implicit Deny Firewall Policy
FortiGate checks from top to bottom to find a firewall policy that matches the traffic. If none of the firewall
policies match the traffic, the default implicit deny firewall policy drops the traffic.
To confirm that the traffic is dropped by the implicit deny policy, you will enable logging on the implicit firewall
policy and then check the logs.
After you have performed these steps, see Reconfigure Device Identification on page 41.
3. Right-click the ID column for the Implicit Deny firewall policy and click Edit.
4. Enable Log Violation Traffic.
5. Click OK.
Now you will edit the Internet_Access firewall policy and add a Windows PC to match your Local-Windows VM.
You will see that the traffic will be allowed by this policy after you add a matching source device.
© FORTINET
3. Click Source and in the right pane, click Device.
4. Click Windows PC to select it.
5. Click Linux PC to deselect it.
4. Click OK.
After a device is identified, FortiGate updates its list of devices and caches the list on the flash disk to speed up
detection. You can view the details of an identified device, which include device type, detection method, IP
address, and so on.
© FORTINET
4. On the Local-Windows VM, open PuTTY and connect over SSH to the LOCAL-FORTIGATE saved session.
5. At the login prompt, enter the user name admin and password password.
6. Run the following command to view the detection method and other device details:
The identified device is cached on FortiGate and is not added to the configuration file. You will add the identified
device to the configuration file by adding an alias to the device.
© FORTINET
2. Return to your browser where you are logged in to the Local-FortiGate GUI, and click User & Device > Device
Inventory.
3. Click your Windows PC device and click Edit.
4. Configure the following settings:
Field Value
Alias MyDevice
5. Click OK.
6. Return to the Local-FortiGate PuTTY session, and run the following command to confirm that the device now
appears in the configuration file as a permanent device:
8. Return to your browser where you are logged in to the Local-FortiGate GUI, and click User & Device > Custom
Devices & Groups.
Your device is now listed under Custom Devices.
Now that you've added your device as a custom device, you will add it to the firewall policy.
FortiGate can match the traffic using address objects or ISDB objects as destinations. ISDB objects are
predefined entries that are regularly updated by FortiGuard and contains a database of IP addresses, protocols,
and port numbers used by the most common Internet services.
ISDB objects can be used to allow or deny traffic to well-known Internet destinations, without worrying about
configuring IP addresses, protocols, or ports used by those destinations in the firewall policy.
In this lab, you will apply an ISDB object as a destination criteria on a firewall policy to block traffic to a well-known
Internet service.
You will now review the entries in the Internet Service Database.
4. Click Return.
Now, you will now modify an existing firewall policy and use an ISDB object as a destination.
© FORTINET
8. Click OK.
© FORTINET
Test the Internet Service Firewall Policy
Now that you have configured the firewall policy, you will test it by passing traffic through it.
FortiGate checks for the matching policy from top to bottom. Facebook is blocked by ID 4 firewall policy
because the destination is set to Facebook-Web. Twitter is allowed by ID 3 firewall policy, which allows
Internet access.
2. Return to the browser where you are logged into the Local-FortiGate GUI, and right-click the ID column for the
Block_Facebook firewall policy.
3. Select Policy Status, and then click Disable.
© FORTINET
FortiGate can find a matching firewall policy based on the policy lookup input criteria. Policy lookup feature is
basically creating a packet flow over FortiGate without real traffic. From this packet flow, FortiGate can extract a
policy ID and highlight it on the GUI policy configuration page.
In this lab, you will use the policy lookup feature to find a matching firewall policy based on input criteria.
As required in the previous exercises, most of the configured firewall policies are currently disabled. Now, you will
enable some of the existing firewall policies.
If you require assistance, or to verify your work, use the step-by-step instructions that follow.
After you have performed these steps, see Set Up and Test the Policy Lookup Criteria on page 49.
Now, you will set up the policy lookup criteria. FortiGate will search and highlight the matching firewall policy
based on your input criteria.
© FORTINET
Field Value
Protocol TCP
Source 10.0.1.100
Destination fortinet.com
3. Click Search.
The search will match the Full_Access policy, but not the more specific firewall policy, Fortinet.
In the search criteria, the source address is set to 10.0.1.100. This source address is not a part of the
Fortinet firewall policy; therefore, the search does not match the Fortinet firewall policy.
5. Click Search.
This time, the search matches the Fortinet firewall policy, in which the destination is set to FQDN.
Now you will reorder the firewall policies. You will move the Block_Facebook firewall policy above the Full_
Access policy.
If you require assistance, or to verify your work, use the step-by-step instructions that follow.
After you have performed these steps, see Retest Policy Lookup After Reordering the Firewall Policies on
page 51.
© FORTINET
To reorder the firewall policies
1. Continuing on the Local-FortiGate GUI, click Policy & Objects > IPv4 Policy.
2. From the ID column, drag the Block_Facebook firewall policy above the Full_Access firewall policy.
The order of your firewall policies should match the following example:
Now, you will test the policy lookup feature after reordering the firewall policies.
Field Value
Protocol TCP
Source 10.0.1.10
Destination facebook.com
3. Click Search.
© FORTINET
Stop and think!
Why did the search not match the more specific policy, Block_Facebook?
The search will match the Full_Access policy, but not the more specific policy, Block_Facebook,
because it is disabled.
4. Right-click the ID column of the Block_Facebook policy and set the Policy Status to Enable.
5. Click Policy Lookup.
6. Click Search.
This time the search matches the more specific policy, Block_Facebook.