Forge Home

iptables

iptables management

15,610 downloads

8,434 latest version

3.8 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 1.2.2 (latest)
  • 1.2.1
  • 1.2.0
  • 1.1.0
  • 1.0.1
  • 1.0.0
  • 0.9.6
  • 0.9.5
  • 0.9.4
  • 0.9.3
  • 0.9.2
  • 0.9.1
  • 0.9.0
  • 0.0.2
  • 0.0.1
released Sep 19th 2013

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'arusso-iptables', '1.0.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add arusso-iptables
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install arusso-iptables --version 1.0.1

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

arusso/iptables — version 1.0.1 Sep 19th 2013

iptables Firewall Module

Build Status

This is yet another iptables module for Puppet. It supports both IPv4 and IPv6 and tries to maintain compatibility with iptables/ip6tables v1.3.5 and above.

Why Another iptables Modules?

Mostly because some of us don't like modifying the running rules directly, and instead would prefer to modify the on-disk rules. This has the advantage of allowing us to comment them inside of the rule file itself, making them easier to read in cases of debugging. Unfortunately, some hosts will always be snowflakes, so this is a big plus for some.

Second, we can expose a more iptables-specific interface in our objects, making it easier to read what you're doing inside of your manifests files.

Lastly, I've tried very hard to do as much error-checking as possible, so that we catch the errors before being deployed to the host. If you come up with a combination of parameters that puts an entry into the iptables file that causes an error, please file an issue.

Usage

The foundation of this module is understanding every rule has an order, from 000-999, and that the rules will be placed in ascending order in the specified chain.

Rules assume only three defaults -- the default table is filter,the default chain is INPUT and the default action is ACCEPT. So creating an empty rule will always result in the rule -A INPUT -j ACCEPT being generated in the filter table.

The module also takes into account when IPv6 address are supplied, and will generate IPv6 rules accordingly. If you specify options that are only valid for IPv4, it will throw an error (hopefully a useful one -- if not, file an issue!). We'd rather throw an error and make you aware of an issue early on, then to discover later that your rule only partially applied.

Examples

The following rules will create a chain ADMIN in addition to the INPUT and OUTPUT chains, and will place any incoming packets from $admin_network onto the ADMIN chain for processing. Admins should be allowed $admin_ports over tcp protocol.

$admin_network = '10.0.0.0/24,2001:db8:1000::/64'
$admin_ports = '22,636,5666'

iptables::rule { 'allow admin ssh':
  comment          => 'Allow admin workstations to connect to admin ports',
  order            => '100',
  protocol         => 'tcp',
  destination_port => $admin_ports,
  chain            => 'ADMIN',
}

iptables::rule { 'SA network jumps to ADMIN chain':
  comment          => 'SA workstations should traverse the ADMIN chain',
  order            => '10',
  destination_port => '22',
  protocol         => 'tcp',
  action           => 'ADMIN',
  source           => $admin_network,
}

iptables::rule { 'allow-puppet-local':
  comment          => 'Reject SSH from all other workstations',
  order            => '150',
  destination_port => '22',
  protocol         => 'tcp',
  action           => 'REJECT',
}

# place some outbound restrictions
iptables::rule { 'allow-outbound-smtp':
  comment          => 'only allow smtp to our internal mail servers',
  order            => '500',
  destination_port => '25',
  protocol         => 'tcp',
  destination      => '10.0.10.10,10.0.10.11,2001:db8:1001::10/126',
  action           => 'ACCEPT',
  chain            => 'OUTPUT',
}

iptables::rule { 'restrict-outbound-smtp':
  comment          => 'do not allow any further smtp outbound',
  order            => '999',
  destination_port => '25',
  protocol         => 'tcp',
  action           => 'REJECT',
  chain            => 'OUTPUT,
}

License

See LICENSE file

Copyright

Copyright © 2013 The Regents of the University of California

Contact

Aaron Russo arusso@berkeley.edu

Support

Please log tickets and issues at the Projects site