When Zorp receives a connection request from a client, it tries to select a rule matching the parameters of the connection. The following parameters are considered.
Name in | Name in policy.py |
---|---|
VPN | reqid |
Source Interface | src_iface |
Source Interface Group | src_ifgroup |
Protocol | proto |
Source Port | src_port |
Destination Port | dst_port |
Source Subnet | src_subnet |
Source Zone | src_zone |
Destination Subnet | dst_subnet |
Destination Interface | dst_iface |
Destination Interface Group | dst_ifgroup |
Destination Zone | dst_zone |
Table 5.96. Evaluated Rule parameters
Zorp selects the rule that most specifically matches the connection. Selecting the most specific rule is based on the following method.
The order of the rules is not important.
The parameters of the connection act as filters: if you do not set any parameters, the rule will match any connection.
If multiple connections would match a connection, the rule with the most-specific match is selected.
For example, you have configured two rules: the first has the
Source Zone
parameter set as theoffice
(which is a zone covering all of your client IP addresses), the second has theSource Subnet
parameter set as192.168.15.15/32
. The other parameters of the rules are the same. If a connection request arrives from the192.168.15.15/32
address, Zorp will select the second rule. The first rule will match every other client request.Zorp considers the parameters of a connection in groups. The first group is the least-specific, the last one is the most-specific. The parameter groups are listed below.
The parameter groups are linked with a logical AND operator: if parameters of multiple groups are set in a rule, the connection request must match a parameter of every group. For example, if both the
Source Interface
andDestination Port
are set, the connection must match both parameters.Parameters within the same group are linked with a logical OR operator: if multiple parameters of a group are set for a rule, the connection must match any one of the parameters. If there are multiple similar rules, the rule with the most specific parameter match for the connection will be selected.
Note In general, avoid using multiple parameters of the same group in one rule, as it may lead to undesired side-effects. Use only the most specific parameter matching your requirements.
For example, suppose that you have a rule with the
Destination Zone
parameter set, and you want to create a similar rule for a specific subnet of this zone. In this case, create a new rule with theDestination Subnet
parameter set, do not set theDestination Zone
parameter in both rules. Setting theDestination Zone
parameter in both rules and setting theDestination Subnet
parameter in the second rule would work for connections targeting the specified subnet, but it would cause Zorp to reject the connections that target other subnets of the specified destination zone, because both rules would match for the connection.The parameter groups are the following from the least specific to the most specific ones. Parameters within each group are listed from left to right from the least specific to the most specific ones.
Destination Zone
>Destination Interface Group
>Destination Interface
>Destination Subnet
Source Zone
>Source Subnet
Destination Port
(Note that port is more specific than port range.)Source Port
(Note that port is more specific than port range.)Protocol
Source Interface Group
>Source Interface
>VPN
If no matching rule is found, Zorp rejects the connection.
Note It is possible to create rules that are very similar, making debugging difficult.
Published on May 30, 2024
© BalaSys IT Ltd.
Send your comments to support@balasys.hu