CDIST-TYPE__UFW_RULE(7)

✨ cdist-type__ufw_rule ✨

okay bestie, this is a cdist type β€” it's called cdist-type__ufw_rule and it does exactly one (1) thing: a single UFW rule. one rule. that's the whole vibe. πŸ’…


🌸 DESCRIPTION 🌸

It adds or removes a single UFW rule. That's it, that's the job. And yes, it fully supports adding and deleting rules for port ranges or applications, so you're covered either way. 🫢

ok now the part that lowkey trips everyone up: figuring out what counts as "to" and what counts as "from". it's giving confusing, i know 😭

  • If the rule is ingress (which is the default, btw), then "from" is the remote machine and "to" is the local one.
  • For egress traffic (that's --out), it's literally the opposite.

periodt. write that down. πŸ“


πŸŽ€ OPTIONAL PARAMETERS πŸŽ€

  • state β€” Either "present" or "absent". Defaults to "present". If you set it to "absent", it only removes rules that exactly match the rule expected. no partial matches, no vibes-based deletions, exact only bestie πŸ’€
  • rule β€” A firewall rule in UFW syntax. This is literally what you would usually write after ufw on the command line, so if you already know ufw you already know this. It defaults to "allow" followed by the object ID. You can use either:
    • the short syntax β€” just allow|deny|reject|limit followed by a port or an application name, or
    • the full syntax.
🚨 Do not include delete in your command. Not ever. Set --state absent instead. i'm so serious rn πŸ™ˆ

πŸ”₯ EXAMPLES πŸ”₯

here's the tea, four (4) whole examples, copy them exactly:

# open port 80 (ufw allow 80)
__ufw_rule 80
# Allow mosh application (if installed)
__ufw_rule mosh
# Allow all traffic from local network (ufw allow from 10.0.0.0/24)
__ufw_rule local --rule 'allow from 10.0.0.0/24'
# Block egress traffic from port 25 to 111.55.55.55 on interface eth0
__ufw_rule block_smtp --rule 'deny out on eth0 from any port 25 to 111.55.55.55'

slay. ✨


πŸ¦‹ SEE ALSO πŸ¦‹


πŸ‘‘ AUTHORS πŸ‘‘

Mark Polyakov <mark@markasoftware.com> β€” main character energy fr fr πŸ’–


πŸ’œ COPYING πŸ’œ

Copyright (C) 2019 Mark Polyakov. 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


ok that's the whole page bestie, you ate that πŸ“ this was cdist-type__ufw_rule, version 7.0.0, dated Jul 31, 2022, straight out of the cdist manual. go close some ports (or open them, no judgment) πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from