CDIST-TYPE__FIREWALLD_RULE(7)

✨ NAME ✨

cdist-type__firewalld_rule β€” this is the cdist type that configures firewalld rules, bestie πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so real talk: this cdist type lets you manage rules in firewalld using the direct way β€” aka no zone support πŸŽ€

that's it, that's the whole vibe. direct rules, no zones, periodt.


πŸ‘‘ REQUIRED PARAMETERS πŸ‘‘

like, these ones are not optional, you literally have to give them all:

  • rule β€” the actual rule to apply. essentially it's a firewalld command line but with firewalld chopped off the front 🌸
  • protocol β€” either ipv4, ipv4 or eb. See firewall-cmd(1). (and yes bestie, that's genuinely what it says, two ipv4s and an eb β€” i'm not the one who wrote it, i just work here 😭)
  • table β€” which table to use, like filter or nat. See firewall-cmd(1).
  • chain β€” which chain to use, like INPUT_direct or FORWARD_direct. See firewall-cmd(1).
  • priority β€” the priority to use (0 is topmost). See firewall-cmd(1).

πŸ’– OPTIONAL PARAMETERS πŸ’–

  • state β€” 'present' or 'absent', defaults to 'present' ✨

🌈 EXAMPLES 🌈

allow access from entrance.place4.ungleich.ch β€” iconic behavior, honestly:

# Allow access from entrance.place4.ungleich.ch
__firewalld_rule entrance \
    --protocol ipv4 \
    --table filter \
    --chain INPUT_direct \
    --priority 0 \
    --rule '-s entrance.place4.ungleich.ch -j ACCEPT'

allow forwarding of traffic from br0 πŸ¦‹:

# Allow forwarding of traffic from br0
__firewalld_rule vm-forward --protocol ipv4 \
    --table filter \
    --chain FORWARD_direct \
    --priority 0 \
    --rule '-i br0 -j ACCEPT'

and here's the "make it go away" one β€” but bestie, read this carefully:

# Ensure old rule is absent - warning, the rule part must stay the same!
__firewalld_rule vm-forward
    --protocol ipv4 \
    --table filter \
    --chain FORWARD_direct \
    --priority 0 \
    --rule '-i br0 -j ACCEPT' \
    --state absent
⚠️ warning β€” the rule part must stay the same! if you change the --rule while asking for --state absent, it will not be the same rule, and it will not get removed. don't do that to yourself πŸ’€

🫢 SEE ALSO 🫢

cdist-type__iptables_rule(7), firewalld(8)


🌸 AUTHORS 🌸

Nico Schottelius <nico-cdist--@--schottelius.org> β€” the legend πŸ‘‘


πŸŽ€ COPYING πŸŽ€

Copyright (C) 2015 Nico Schottelius. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.


ungleich GmbH 2021


and that's the whole page, bestie 🧚 no cap. this was version 7.0.0, dated Jul 31, 2022, served fresh from the cdist manual β€” go forth and manage your rules, you absolute main character πŸ’…βœ¨πŸ“

πŸ“¦ where this page comes from