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

Improve firewalld support #304

Merged
merged 24 commits into from
Jan 3, 2025
Merged

Conversation

decoyjoe
Copy link
Contributor

Description

I started out meaning to just fix a couple of bugs with the firewalld provider. I ended up needing to refactor and modernize the firewalld implementation in order to get it into a supportable state. Many bugs were fixed along the way.

Key changes in this release:

  • Rich Rules on firewalld: The firewall_rule resource now creates rich rules on firewalld platforms instead of using the deprecated --direct interface.
  • Flexible firewall selection: The cookbook now uses the default['firewall']['solution'] attribute to determine the firewall solution to use instead of a hardcoded assignment for each platform. It defaults to the platform's native firewall (same as previous hardcoded values).
  • Firewalld 2.0.0: Platforms using firewalld 2.0.0 and later, such as RHEL 10 and Ubuntu 24.04, are now supported.

Added

  • Support for firewalld 2.0.0 and the platforms that use it; RHEL 10 and Ubuntu 24.04.
    • priority, ingress_priority, egress_priority properties added to firewalld_zone.
  • Added firewalld_rich_rule resource for adding/removing rich rules to/from firewalld zones.
  • Support for IPv6 rules on firewalld platforms.
  • Support for using any compatible firewall solution on any platform. Defaults to the operating system's default firewall solution.

Changed

  • Ensure firewalld service remains enabled and started when installed.
  • firewall_rule resource now creates rich rules on firewalld platforms, instead of the using the deprecated --direct firewalld interface.

Fixed

  • Fixed: firewall_rule resource fails with a --zone is an invalid option with --direct error on firewalld.
  • Fixed: New zones created by firewalld_zone unexpectedly have forwarding enabled by default.
  • Fixed: firewalld_* resources ignore properties whose value is false.
  • Fixed: firewalld_* resources were not idempotent when using ports, source_ports, and rich_rules properties.
  • Fixed: ufw provider doesn't ensure ufw service is enabled.

Removed

  • Removed deprecated disabled property from firewall resource.
  • Removed all default['firewall']['firewalld'] attributes. Use the firewalld_zone resource to manage firewalld zone configuration.
  • Removed firewalld action :save from firewall resource. Firewalld rules are now always added permanently.
  • Removed firewalld property permanent from firewall_rule resource. Firewalld rules are now always added permanently.
  • Removed properties disabled_zone and enabled_zone from firewall resource. Use the firewalld_zone resource to manage firewalld zone configuration.
  • Removed recipe firewall::firewalld. Its functionality has been merged into the firewall::default recipe.
  • Removed attributes default['firewall']['ubuntu_iptables'] and default['firewall']['redhat7_iptables']. Use the new default['firewall']['solution'] attribute to set the desired firewall solution to use.

Issues Resolved

Check List

  • A summary of changes made is included in the CHANGELOG under ## Unreleased
  • New functionality includes testing.
  • New functionality has been documented in the README if applicable.

Suites now correctly test against all compatible platforms for each
firewall solution.

Signed-off-by: Joseph Larionov <[email protected]>
The resource was specifying --zone when creating --direct rules, which
is not allowed for direct rules in firewalld.

Fixes sous-chefs#298

Signed-off-by: Joseph Larionov <[email protected]>
The firewalld_zone resource has been updated to support priority,
ingress_priority, and egress_priority zone options introduced in
firewalld 2.0.0.

As a result, this update extends support to RHEL 10, its derivatives,
and Ubuntu 24.04, all of which utilize firewalld 2.0.0 or later.

Signed-off-by: Joseph Larionov <[email protected]>
Signed-off-by: Joseph Larionov <[email protected]>
Refactors firewalld support to use rich rules instead of the "--direct"
interface, which was deprecated with the firewalld 1.0.0 release [1].

Adds IPv6 support for firewalld platforms (fixes sous-chefs#86).

[1] https://firewalld.org/2021/06/the-upcoming-1-0-0

Signed-off-by: Joseph Larionov <[email protected]>
Signed-off-by: Joseph Larionov <[email protected]>
@decoyjoe
Copy link
Contributor Author

Bonus fix: All kitchen tests now run successfully in GitHub Actions CI.

@decoyjoe decoyjoe marked this pull request as ready for review January 2, 2025 17:31
@decoyjoe decoyjoe requested a review from a team as a code owner January 2, 2025 17:31
@bmhughes bmhughes added Release: Major Release to Chef Supermarket as a major change when merged Bug Something isn't working Feature Request Enhancement to existing functionality or new functionality labels Jan 3, 2025
@bmhughes
Copy link

bmhughes commented Jan 3, 2025

Wow @decoyjoe! Thanks for this, really great job. I'll get this released now.

@bmhughes bmhughes merged commit b8ec824 into sous-chefs:main Jan 3, 2025
169 checks passed
@kitchen-porter
Copy link
Contributor

Released as: 7.0.0

@decoyjoe
Copy link
Contributor Author

decoyjoe commented Jan 3, 2025

Thanks! I'll keep an eye on the repo's issues in-case a new bug crops up due to this refactor.

@decoyjoe
Copy link
Contributor Author

decoyjoe commented Jan 3, 2025

I should have surveyed the open issues a bit better before creating the PR. I found these open issues that are all fixed by this PR:

@decoyjoe decoyjoe restored the fix-firewalld-support branch January 4, 2025 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Feature Request Enhancement to existing functionality or new functionality Release: Major Release to Chef Supermarket as a major change when merged
Projects
None yet
3 participants