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

Support ingress/egress priority on zones for version >=2.0 #379

Open
ananace opened this issue Jan 22, 2025 · 0 comments
Open

Support ingress/egress priority on zones for version >=2.0 #379

ananace opened this issue Jan 22, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@ananace
Copy link
Member

ananace commented Jan 22, 2025

With Firewalld 2.0, there's a new option to specify the ingress and egress priority for each zone, i.e;

# firewall-cmd --version
2.0.1
# firewall-cmd --zone=k8s --list-all
k8s (active)
  target: ACCEPT
  ingress-priority: -10
  egress-priority: -10
  icmp-block-inversion: no
...

These can be set to a signed integer value in order to specify the order that rules and routing should be handled between zones, with lower priority values taking precedence.
The priority values can only be set with --permanent

An example of how to do this using an exec;

if versioncmp(fact('firewalld_version'), '2.0.0') >= 0 {
  exec { 'Set priority on k8s zone':
    command => @(EOF),
      firewall-cmd --permanent --zone=k8s --set-ingress-priority -10 && \
      firewall-cmd --permanent --zone=k8s --set-egress-priority -10
    |EOF
    unless  => 'firewall-cmd --info-zone=k8s | grep priority | grep -- -10',
    path    => fact('path'),
  }
  ~> Class['firewalld::reload']
}
@ananace ananace added the enhancement New feature or request label Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant