8.1. Packet Filter Rules

Rules for advanced packet filters can be viewed in the Filter Rules tab of the Advanced Packet Filter dialog window.

Rules are ordered in a list. Anytime a network connection is detected, the list is tested rule by rule from the top downwards and the first rule which the traffic meets is applied. Use the Up and Down buttons or Ctrl + up arrow and Ctrl + down arrow key combinations to reorder the list according to your liking and needs. More complex combinations of filtering rules can be defined thanks to these features.

Packet filter rules

Figure 8.1. Packet filter rules

Packet filter rules can be optionally classified by groups. Participation of a rule in a group does not influence the system of rule appliance since rules in all groups are always tested. This implies that these groups are for reference only. Rule groups are displayed on the left of the Filter Rules tab.

Rule groups of packet filter

Figure 8.2. Rule groups of packet filter

Click on a group name to view the list of rules included in the group.

The following two groups are predefined and they cannot be removed:

Note: Groups of rules cannot be created nor removed explicitly. New groups can be created by entering a new group name during a rule definition. Groups are removed automatically when the last rule is removed.

Use the following buttons below the group list to handle packet filter rules:

Notes:

  1. If no rule is selected, only the Add button is available.

  2. Hold down the Ctrl or the Shift key to select multiple rules. Groups of rules selected in this way can only be moved or deleted. Use the Edit button to edit the first selected rule (at the top). The Insert button inserts a new rule before the first rule of a particular group.

Rule Definition and Modification

Clicking on the Add, Insert or Edit button opens a dialog for definition of a packet filter rule. A rule is defined by the following parameters:

Packet filter rule

Figure 8.3. Packet filter rule

Description

Rule description/name. We recommend you to insert a brief rule description (purpose, application name, etc.). This description is used for your reference only. The name of a particular local application which participates in the communication is inserted for automatically generated rules.

Application

Local application to which the rule is applied. This application can be either inserted by hand (full path to a corresponding executable file), selected from a menu (menu of applications used for other rules is offered) or searched on the disc (use the Browse... button to open a standard system dialog from which an application can be run).

You can also create a general filtering rule which will be applied on all applications. This can be done through the any option or by leaving the Application item blank.

Group

Rule group in which the rule will be included. Participation of a rule in a group does not influence the system of rule appliance — the entire rule list is always tested. This implies that these groups are used for reference only.

Use the Group item to choose a group from the menu or to add a new group by inserting a new group name — the rule will be automatically included to this group. All rules are added to the Default group by default. The same method is applied on rules which are generated automatically (see above or refer to chapter 5.2. Connection Alert (unknown traffic detection)).

Log rule to network log

Enables/disables logging of communication meeting this rule into the Network log (see chapter 16.4. Network Log).

Show alert to user

Check this option to enable the Alert dialog (read more in chapter 5.5. Alert Dialog Window (alerts on events)) whenever traffic meeting this rule is detected.

Packet filter rule — Protocols

Figure 8.4. Packet filter rule — Protocols

Protocol

Set parameters for protocols to which the rule will be applied. Typically, a single protocol is used for traffic (i.e. TCP or UDP, however, some applications use multiple protocols concurrently (i.e. TCP and UDP using the same ports).

If we leave the Protocol entry empty, the rule will be applied to any protocol.

Note: If an application uses TCP and UDP protocols at various ports, two different packet filter rules must be defined.

Click on the Add or Edit button to open a dialog for protocol definition.

Packet filter rule — Protocol addition

Figure 8.5. Packet filter rule — Protocol addition

The protocol is specified by a designated number in the IP packet header. This number can be defined directly through the Number entry. Use the Name option to select from a menu of predefined protocols.

You can use the Description text field to enter a description for your reference. It can be viewed in this dialog only.

The Codes item will be available in the dialog if ICMP is selected. Use this entry to specify type of ICMP messages which the rule will be applied on.

Packet filter rule — ICMP

Figure 8.6. Packet filter rule — ICMP

Types of messages are defined by number codes (individual codes are separated by comas). If the Codes entry is not specified, the rule will be applied on all types of ICMP messages.

Click on the Select button to open a special dialog for definition of types of ICMP messages. Select appropriate types of ICMP messages. Click on the OK button and codes of the types you have defined will be inserted into the Codes entry automatically.

Packet filter rule — Types of ICMP messages

Figure 8.7. Packet filter rule — Types of ICMP messages

Packet filter rule — Port

Figure 8.8. Packet filter rule — Port

Local

Specify parameters for the local point. Kerio Personal Firewall uses all local IP addresses implicitly including the loopback IP addresses. For this reason local parameters can be specified only by ports.

Use the Add button to add a single port (Add port) or a port range (Add port range). Multiple ports and port ranges can be specified — this way any port group can be covered easily.

The port can be specified either by specification of the Number entry (only values included in the 1-65535 are valid) or by selection of a predefined service in the Name item. You can use the Description entry to describe the port or the service (for reference only).

Packet filter rule — Addition of port

Figure 8.9. Packet filter rule — Addition of port

The dialog for range specification consists of two essential entries: First port (first port in the range) and Last port (last port in the range).

Packet filter rule — Addition of port range

Figure 8.10. Packet filter rule — Addition of port range

Remote

Specification of remote point of a connection. IP address, port or both can be specified. The rule will be applied if the packet will contain any of defined IP addresses and one of the defined ports.

Packet filter rule — Remote IP address (computer) and port (service)

Figure 8.11. Packet filter rule — Remote IP address (computer) and port (service)

Either individual ports (Add port) or a port range (Add port range) can be defined. The dialog is the same as for the Local point — see above.

Use the following methods to specify IP address:

  • a single IP address (Add address)

    Packet filter rule — Addition of IP address

    Figure 8.12. Packet filter rule — Addition of IP address

  • IP address range (Add address range) — enter first and last address of the range

    Packet filter rule — Addition of IP address from IP address range

    Figure 8.13. Packet filter rule — Addition of IP address from IP address range

  • subnet (Add address / mask) — specify subnet address and a corresponding mask

    Packet filter rule — Addition of subnet

    Figure 8.14. Packet filter rule — Addition of subnet

  • IP address group (Add IP group) — use the Select option to select one from the menu of IP addresses defined through the IP Groups tab (see below)

    Packet filter rule — Addition of IP address group

    Figure 8.15. Packet filter rule — Addition of IP address group

Individual methods can be combined.

Packet filter rule — Direction of the traffic and action settings

Figure 8.16. Packet filter rule — Direction of the traffic and action settings

Direction

Direction of the traffic which the rule will be applied to: Both directions, Incoming or Outgoing connection.

Traffic direction is represented by direction of an initial packet which starts the connection.

Action

Action which will be taken by Kerio Personal Firewall when a connection meeting this rule is detected:

  • Permit — allows the connection

  • Deny — blocks the connection

Packet filter rules details

It is important to be aware of how individual parts of a rule and their items are related to be able to define rules effectively.

  • The logical relations among Protocol, Local and Remote are “and”. This implies that only traffic which meets all the conditions will meet the rule.

  • The logical relation between items included in one item (protocols, IP addresses and ports) is “or”.

    Example: The Remote item consists of two port ranges : 80-88 and 8000-8080. The rule will be met when a remote port belongs to one of these ranges.

  • The logical relation between the “IP address” and “port” items in the Remote entry is “and”.

    Example: The Remote entry is specified by the IP address 65.131.55.1 and the port number 80. This condition will be met by traffic which includes a remote computer with the IP address 65.131.55.1 at the port number 80.

Notes to Packet Filter Definition

The Protocol, Local and Remote entries are closely related. A user should follow the following rules to ensure smooth functionality of the rule:

  1. Port definition is helpful only for TCP and UDP protocols (ports are ignored by other protocols).

    If the rule is available for any protocol (the Protocol is not specified), then port numbers are not applicable as they are used only for traffic through TCP or UDP protocols.

  2. Application service is specified by port numbers and by protocols. In the packet filter rule dialog, a service is represented by port only — the protocol must be entered by hand.

    Example: Suppose we want to create a rule for incoming HTTP connections (i.e. to enable access to a Web server on a computer which is protected by Kerio Personal Firewall), we will take the following steps:

    • Add port in the Local section. Select the HTTP service — this will automatically set the port value to 80.

    • Go to the Protocol section to set TCP, which is used by the HTTP service.

  3. The most common traffic model is the client to server communication. The server listens on a predefined port for an incoming connection. A client starts the connection by demanding a free local port (an unknown port) from the operating system that will be used for the connection. This implies that, unlike the server port (which must be always known), any free port can be used temporarily for a client.

    These facts should be considered during packet filter definition. The problem will be better understood through the two following examples:

    Example 1: We intend to enable access to a Web server on a local computer with IP address 60.80.100.120. We can achieve this by definition of the following rule:

    • Protocol[6] TCP (HTTP service uses the TCP protocol)

    • LocalPort: [80] HTTP (Web server runs on a local computer)

    • RemoteAddress: 60.80.100.120 (a client represented by a Web browser will be running at a remote host; port is not known yet, that is why we specify the IP address only)

    Example 2: We intend to block connections to the Web server with IP address 90.80.70.60. This is how we define the rule:

    • Protocol[6] TCP

    • Local — we leave this entry empty (client port cannot be specified yet)

    • RemotePort: [80] HTTP, Address: 90.80.70.60 (specification of the remote server)