Skip to content
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

T5794: firewall: change firewall priority in oder to be loaded after all interfaces #3988

Merged
merged 1 commit into from
Aug 16, 2024

Conversation

nicolas-fort
Copy link
Contributor

Change Summary

Load firewall after all interfaces are created in the system.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Related PR(s)

Component(s) name

firewall

Proposed changes

How to test

Config shared in the example works and is correctly loaded into the system after reboot:

set firewall flowtable FT01 interface 'bond0'
set firewall flowtable FT01 interface 'bond0.2'
set firewall ipv4 forward filter default-action 'drop'
set firewall ipv4 forward filter rule 10 action 'offload'
set firewall ipv4 forward filter rule 10 offload-target 'FT01'
set firewall ipv4 forward filter rule 10 state 'established'
set firewall ipv4 forward filter rule 10 state 'related'
set firewall ipv4 forward filter rule 20 action 'accept'
set firewall ipv4 forward filter rule 20 state 'established'
set firewall ipv4 forward filter rule 20 state 'related'
set interfaces bonding bond0 address '192.168.1.1/24'
set interfaces bonding bond0 member interface 'eth0'
set interfaces bonding bond0 vif 2 address '192.168.2.1/24'

And nftables:

sudo nft list table ip vyos_filter
table ip vyos_filter {
        flowtable VYOS_FLOWTABLE_FT01 {
                hook ingress priority filter
                devices = { bond0, bond0.2 }
                counter
        }

        chain VYOS_FORWARD_filter {
                type filter hook forward priority filter; policy accept;
                ct state { established, related } counter packets 0 bytes 0 flow add @VYOS_FLOWTABLE_FT01 comment "ipv4-FWD-filter-10"
                ct state { established, related } counter packets 0 bytes 0 accept comment "ipv4-FWD-filter-20"
                counter packets 0 bytes 0 drop comment "FWD-filter default-action drop"
        }

Smoketest result

test_firewall --> OK

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

Copy link

👍
No issues in PR Title / Commit Title

@c-po c-po merged commit e7f3c9a into vyos:current Aug 16, 2024
13 of 14 checks passed
@c-po
Copy link
Member

c-po commented Aug 16, 2024

@Mergifyio backport sagitta circinus

Copy link

mergify bot commented Aug 16, 2024

backport sagitta circinus

✅ Backports have been created

c-po added a commit that referenced this pull request Aug 17, 2024
T5794: firewall: change firewall priority in oder to be loaded after all interfaces (backport #3988)
c-po added a commit that referenced this pull request Aug 17, 2024
T5794: firewall: change firewall priority in oder to be loaded after all interfaces (backport #3988)
@ruffy91
Copy link

ruffy91 commented Aug 17, 2024

Won't this accept/allow all connections on startup until the firewall has been loaded, as the default action of the firewall without config is to accept all connections?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

5 participants