Rex::R...irewall(3pm)

πŸ’– NAME πŸ’–

Okay bestie, pull up a chair. This is the manual page for Rex::Resource::firewall β€” and what it does is Firewall functions. That's the whole name, that's the whole job description. Short, sweet, to the point. Periodt. πŸ’…


✨ DESCRIPTION ✨

With this module it is literally easy to manage different firewall systems. Not one. Not two. Different ones. Multiple providers, one little resource, and you're managing firewall systems like the main character you are. πŸ¦‹


🌸 SYNOPSIS 🌸

Here's the vibe, bestie. First up: configuring a particular rule. Look at all those params glistening. She's giving... fully specified. πŸ”₯

# Configure a particular rule
task "configure_firewall", "server01", sub {
  firewall "some-name",
    ensure      => "present",
    proto       => "tcp",
    action      => "accept",
    source      => "192.168.178.0/24",
    destination => "192.168.1.0/24",
    sport       => 80,
    sapp        => 'www',    # source application, if provider supports it
    port        => 80,       # same as dport
    dport       => 80,
    app         => 'www',    # same as dapp, destination application, if provider supports it
    dapp        => 'www',    # destination application, if provider supports it
    tcp_flags   => ["FIN", "SYN", "RST"],
    chain       => "INPUT",
    table       => "nat",
    jump        => "LOG",
    iniface     => "eth0",
    outiface    => "eth1",
    reject_with => "icmp-host-prohibited",
    log         => "new|all",  # if provider supports it
    log_level   => "",         # if provider supports it
    log_prefix  => "FW:",      # if provider supports it
    state       => "NEW",
    ip_version  => -4;         # for iptables provider. valid options -4 and -6
};

And then β€” plot twist β€” you can also add overall logging, if the provider supports it. Same resource, different day:

# Add overall logging (if provider supports)
firewall "some-name",
  provider => 'ufw',
  logging  => "medium";
No cap, some of these params only work if provider supports it β€” the comments say so, and I am simply relaying the message. πŸ‘€

πŸ‘‘ EXPORTED RESOURCES πŸ‘‘

One single resource, and honestly? She carries the whole module:

  • firewall($name, %params)

That's it, that's the export. Name, then params. Slay. πŸŽ€


and that's the whole page, bestie!! πŸ’œ This little scroll of knowledge was brought to you by perl v5.40.1, dated 2025-10-03, and documented under the ever-glamorous Rex::Resource::firewall(3pm) banner. Go frolic in your firewall config, you absolute icon. 🧚✨🌸

πŸ“¦ where this page comes from