Skip to content

Conversation

troglobit
Copy link
Contributor

Description

This PR adds support for a basic zone-based firewall to Infix. It builds on top of firewalld using the concepts and limitations laid out in #448

Fixes #448

Checklist

Tick relevant boxes, this PR is-a or has-a:

  • Bugfix
    • Regression tests
    • ChangeLog updates (for next release)
  • Feature
    • YANG model change => revision updated?
    • Regression tests added?
    • ChangeLog updates (for next release)
    • Documentation added?
  • Test changes
    • Checked in changed Readme.adoc (make test-spec)
    • Added new test to group Readme.adoc and yaml file
  • Code style update (formatting, renaming)
  • Refactoring (please detail in commit messages)
  • Build related changes
  • Documentation content changes
    • ChangeLog updated (for major changes)
  • Other (please describe):

@troglobit troglobit added the ci:main Build default defconfig, not minimal label Aug 24, 2025
@troglobit troglobit force-pushed the fw branch 2 times, most recently from cf84a4c to 422e812 Compare August 25, 2025 06:40
Signed-off-by: Joachim Wiberg <[email protected]>
Used by infix-firewall.c when figuring out interfaces that are not
explicitly assigned to any zone.  Placing them in the default zone

Signed-off-by: Joachim Wiberg <[email protected]>
Add supoprt for infix-firewall.yang, modeled on the zone-based firewalld
The terminology is a mix of firewalld, classic netfilter and inspired by
Ubiquity.  E.g., zone 'policy' -> 'action', and the zone matrix overview.

 - Port forwarding allows forwarding a range of ports
 - Operational data comes from firewalld active rules
 - Firewall logging goes to /var/log/firewall.log
 - Show implicit/built-in rules and zones (HOST) in firewall matrix,
   includes "locked" policy for the default-drop behavior
 - The zone services field in admin-exec 'show firewall' shows ANY when
   the zone default action is set to 'accept'
 - Zone 'forwarding' and 'masquerade' settings live in Infix in the
   policys instead, meaning users need to explicitly add a policy
   to allow both intra-zone and inter-zone forwarding
 - Support for emergency lockdown (kill switch)
 - Pre-defined services (xml+enums) are filtered and included as a
   separate YANG model, extensions added for netconf and restconf
 - Includes initial support for firewalld rich rules

firewalld policy rules, including rich rules, have an obnoxious priority
field which is extremely hard to get right, so in Infix we use the far
superior YANG construct 'ordered-by user;'.  This ensure all rules are
generated in that order by setting the priority field, on read-back from
firewalld (operational) the priority field is used to sort the output
of rules in the CLI.

Note: insted of 'firewall-cmd --reload' we use a helper script so we
      don't block forever in Finit. The D-Bus API is *much* quicker.

Fixes #448

Signed-off-by: Joachim Wiberg <[email protected]>
Signed-off-by: Joachim Wiberg <[email protected]>
 - Drop 'local', not available in POSIX shell scripts
 - Check for an assortment of backup file combos
 - Simplify nested if-statements, skip whitelist first

Signed-off-by: Joachim Wiberg <[email protected]>
 - Sort packages alphabetically
 - Add nmap for firewall tests

Signed-off-by: Joachim Wiberg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:main Build default defconfig, not minimal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for basic firewall, NAT, IP masquerading, port forwarding
1 participant