-
Notifications
You must be signed in to change notification settings - Fork 390
firewall: T7739: Default ruleset for firewall zones #4672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: current
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -992,6 +992,47 @@ def test_zone_basic(self): | |
self.verify_nftables(nftables_search, 'ip vyos_filter') | ||
self.verify_nftables(nftables_search_v6, 'ip6 vyos_filter') | ||
|
||
def test_zone_with_default_firewall(self): | ||
self.cli_set(['firewall', 'ipv4', 'name', 'smoketest', 'default-action', 'drop']) | ||
self.cli_set(['firewall', 'ipv4', 'name', 'smoketest-default', 'default-action', 'drop']) | ||
self.cli_set(['firewall', 'zone', 'smoketest-eth0', 'member', 'interface', 'eth0']) | ||
self.cli_set(['firewall', 'zone', 'smoketest-eth0', 'from', 'smoketest-eth1', 'firewall', 'name', 'smoketest']) | ||
self.cli_set(['firewall', 'zone', 'smoketest-eth0', 'from', 'smoketest-local', 'firewall', 'name', 'smoketest']) | ||
self.cli_set(['firewall', 'zone', 'smoketest-eth0', 'default-firewall', 'name', 'smoketest-default']) | ||
self.cli_set(['firewall', 'zone', 'smoketest-eth1', 'member', 'interface', 'eth1']) | ||
self.cli_set(['firewall', 'zone', 'smoketest-eth1', 'default-firewall', 'name', 'smoketest-default']) | ||
self.cli_set(['firewall', 'zone', 'smoketest-eth2', 'member', 'interface', 'eth2']) | ||
self.cli_set(['firewall', 'zone', 'smoketest-local', 'local-zone']) | ||
self.cli_set(['firewall', 'zone', 'smoketest-local', 'from', 'smoketest-eth0', 'firewall', 'name', 'smoketest']) | ||
self.cli_set(['firewall', 'zone', 'smoketest-local', 'default-firewall', 'name', 'smoketest-default']) | ||
|
||
self.cli_commit() | ||
|
||
nftables_search = [ | ||
['chain NAME_smoketest'], | ||
['chain NAME_smoketest-default'], | ||
['chain VYOS_ZONE_FORWARD'], | ||
['type filter hook forward priority filter + 1'], | ||
['chain VYOS_ZONE_OUTPUT'], | ||
['type filter hook output priority filter + 1'], | ||
['chain VYOS_ZONE_LOCAL'], | ||
['type filter hook input priority filter + 1'], | ||
['chain VZONE_smoketest-eth0'], | ||
['iifname "eth1"', 'jump NAME_smoketest'], | ||
['jump NAME_smoketest-default'], | ||
['chain VZONE_smoketest-eth1'], | ||
['jump NAME_smoketest-default'], | ||
['chain VZONE_smoketest-eth2'], | ||
['chain VZONE_smoketest-local_IN'], | ||
['iifname "eth0"', 'jump NAME_smoketest'], | ||
['jump NAME_smoketest-default'], | ||
Comment on lines
+1022
to
+1028
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These duplicate If you want to check for these jumps in specific chains you can use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've struggled to understand exactly how the smoke tests actually function. I more or less hoped there was some ordering expectation in the matching. I'll investigate verify_nftables_chain as just looking to see that something like the string I want does not actually make sure the feature works as intended. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the nftables verify functions, each list item is expecting to match all of the specified criteria on a single line of nftables output. For example
For example (excuse formatting, also not tested):
|
||
['chain VZONE_smoketest-local_OUT'], | ||
['iifname "eth0"', 'jump NAME_smoketest'], | ||
['oifname "eth1"', 'jump NAME_smoketest-default'] | ||
] | ||
|
||
self.verify_nftables(nftables_search, 'ip vyos_filter') | ||
|
||
def test_zone_with_vrf(self): | ||
self.cli_set(['firewall', 'ipv4', 'name', 'ZONE1-to-LOCAL', 'default-action', 'accept']) | ||
self.cli_set(['firewall', 'ipv4', 'name', 'ZONE2_to_ZONE1', 'default-action', 'continue']) | ||
|
Uh oh!
There was an error while loading. Please reload this page.