Forge Home

pf

Manage PF with Puppet

15,787 downloads

1,777 latest version

3.1 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.7.0 (latest)
  • 1.6.1
  • 1.4.1
  • 1.4.0
  • 1.1.3
  • 1.1.2
  • 1.0.0
  • 0.1.2
  • 0.1.1
  • 0.1.0
  • 0.0.2
  • 0.0.1
released Sep 2nd 2015
This version is compatible with:
  • Puppet Enterprise >= 3.2.0 < 3.8.0
  • Puppet 3.x
  • ,

Start using this module

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

Add this module to your Puppetfile:

mod 'zleslie-pf', '0.0.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add zleslie-pf
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install zleslie-pf --version 0.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

zleslie/pf — version 0.0.1 Sep 2nd 2015

Puppet-pf

A Puppet module for managing PF rules on BSD. This module is pretty basic. It only wraps the logic necessary to deploy a pf.conf file and the necessary parsing and loading of the rules deployed.

Usage

To use the PF module, you only need pass in a template.

With Hiera

If you are using Hiera, the following items will take care of you.

include pf

Then set pf::template to a value that you would pass to the template() function, as you would on a file resource. For example:

pf::template: 'site/mynodepf.conf.erb'

Then for each node that uses PF, simply build a template for each node where necessary.

Fun with templates

Templates are cool for many reasons. One of them is the fact that you can include templates from inside templates. As an example, you might keep pf options, macros, and tables each in a file that is common to all your hosts. Then only use differences where needed. For example, a firewall node template might look like the following.

<%= scope.function_template(['profile/network/firewall/pf/_options.erb']) %>
<%= scope.function_template(['profile/network/firewall/pf/_macros.erb']) %>
<%= scope.function_template(['profile/network/firewall/pf/_tables.erb']) %>
<%= scope.function_template(['profile/network/firewall/pf/_nat.erb']) %>
<%= scope.function_template(['profile/network/firewall/pf/_filter.erb']) %>
<%= scope.function_template(['profile/network/firewall/pf/_filter/_siteA_ipsec.erb']) %>

# Allow sasyncd in from peer
pass in on $ext_if proto tcp from $siteA_secondary_ext to $siteA_primary_ext port {isakmp}

Now this allows you to put the bulk of the code in common templates that can be distributed to multiple systems. This means that in order to make changes to the majority of your firewalls, you can do so with just a change to a single firewall. Obviously, how this structure is laid out and the usefulness of doing so will be dependent on the environment within which PF is deploy.

Dynamic rules with PuppetDB

Coming soon.