Bug #13171
closedChanging the redirect target for a Port Forward with an associated filter creates an incorrect firewall rule
100%
Description
Tested on 22.01 but I saw the same issue on 21.05_p2 too.
To reproduce this issue:
- I created alias for internal host 'MyHost: 192.168.87.125'
- then I created PortForwarding NAT rule with 'Redirect target IP: MyHost' ('PortForwarding_initial_rule.png'). So Firewall rule were created on WAN with 'Destination: MyHost' ('Initial_firewall_rule.png')
From /tmp/rules.debug:
pass in quick on $WAN reply-to ( vtnet0 192.168.122.1 ) inet proto tcp from any to $MyHost port 22 ridentifier 1652698285 flags S/SA keep state label "USER_RULE: NAT TestPF2"
- and when I used IP-address instead of MyHost alias ('Redirect target IP: 192.168.87.125'), related firewall rule was changed correctly.
From /tmp/rules.debug
pass in quick on $WAN reply-to ( vtnet0 192.168.122.1 ) inet proto tcp from any to 192.168.87.125 port 22 ridentifier 1652698285 flags S/SA keep state label "USER_RULE: NAT TestPF2"
- then I used 'Redirect target IP: LAN address', again firewall rule was changed correctly. From /tmp/rules.debug:
pass in quick on $WAN reply-to ( vtnet0 192.168.122.1 ) inet proto tcp from any to 192.168.87.1 port 22 ridentifier 1652698285 flags S/SA keep state label "USER_RULE: NAT TestPF2"
AND when again I used 'Redirect target IP: MyHost', on a Dashboard I saw firewall rule with "Destination: LAN address' ('firewall_rule_after_using_alias.png') which had 'LAN_address' marked as an alias and this alias were correctly showed as 'MyHost: 192.168.87.125' ('LAN_address_showed_as_my_alias.png')
BUT according to /tmp/rules.debug firewall rule wasn't changed:
pass in quick on $WAN reply-to ( vtnet0 192.168.122.1 ) inet proto tcp from any to 192.168.87.1 port 22 ridentifier 1652698285 flags S/SA keep state label "USER_RULE: NAT TestPF2"
and still had 'LAN address: 192.168.87.1' as a Destination.
- 1. LAN address
- 2. MyHost alias
- 3. IP: 192.168.87.125
but firewall rule always had 'Destination: LAN Address'
So using these built-in aliases (LAN/WAN address) as a 'Redirect target IP' in PortForwarding NAT rules breaks the logic of creating related firewall rules.
Files