Archive

Posts Tagged ‘puppet’

pfSense: Unattended installation with Foreman

September 4th, 2014 Comments off

As you may know, Foreman is probably the lifecycle management tool for virtual and physical servers. And it already supports a rather large number of different operating systems. Lately it got support to provision FreeBSD servers and this brought up the idea to add support for pfSense firewalls as well.

First of all: This project was a success. It is now possible to automatically deploy pfSense with Foreman. I’ve created a small video to showcase the deployment of pfSense using Foreman:

The video may not be very entertaining, but it should give you an impression on how the unattended installation works (even if you don’t know Foreman yet).

You can download the required Foreman templates from Github. You may also want to have a look at the Foreman Documentation to find out how to add these templates to your instance of Foreman.

What are the benefits?
– do fully unattended installations of pfSense
– in conjunction with Puppet it allows you to automate basically every task (full lifecycle management)
– choose from different versions of pfSense according to your needs

How does it work?
– it assumes you want to use The Foreman to provision your servers
– it assumes that pfSense can be automatically provisioned similar to FreeBSD
– on top of that assumption it’s basically a set of patches for the pfSense Installer
– it assumes you want to use Puppet with pfSense

Feedback or contributions? Please use the Github issue tracker.

Automatically update pfSense firewalls (with puppet)

July 14th, 2014 Comments off

Updating pfSense firewalls is easy and stable thanks to its proven upgrade mechanisms. So why should I use the WebGUI to update every pfSense firewall manually? If you have multiple pfSense firewalls and a working test environment, there is no reason to avoid automatic updates.

I’ve extracted a portion of the pfSense firmware upgrade code and put together a small PHP script. This makes it possible to automatically update pfSense. In combination with puppet you need just one line to enable automatic updates:

class { 'pfsense_autoupdate': }

Now your pfSense firewall will check hourly for new versions and install it (almost) instantly. If you want more control you can specify any of the optional parameters:

class { 'pfsense_autoupdate':
  major_updates => false,
  update_hours => ['22-23', '2-4', 6],
  update_weekdays => ['6-7'],
  random_sleep => false,
  firmware_url => 'http://example.com/pfsense/firmware/',
  sig_verification => false,
  quiet => true,
}

You may download the PHP script and puppet module from puppet forge. Additionally you may want to check out the project page on github. Note that you need the puppet agent for pfSense and my pfSense provider collection for this to work.

Prepare pfSense for RANCID (with puppet)

July 14th, 2014 Comments off

pfSense is a great firewall and RANCID is a good choice for regular configuration backups. Sounds like a good team? It is! And it has been for years. But configuring pfSense for RANCID can be a pain. I wrote a puppet module to make it easier. You may download it from puppet forge.

Now configuring pfSense for RANCID is quite simple:

class { 'pfsense_rancid':
  password => '$1$dSJImFph$GvZ7.1UbuWu.Yb8etC0re.',
}

I’ve added some optional parameters to make it suitable for most environments:

class { 'pfsense_rancid':
  username       => 'backupuser',
  password       => '$1$dSJImFph$GvZ7.1UbuWu.Yb8etC0re.',
  authorizedkeys => [
    'ssh-rsa AAAAksdjfkjsdhfkjhsdfkjhkjhkjhkj user1@example.com',
    'ssh-rsa AAAAksdjfkjsdhfkjhsdfkjhkjhkjhkj user2@example.com',
  ],
  diskusage      => false,
}

Note that you need the puppet agent for pfSense and my pfSense provider collection for this to work.

Categories: [EN] Tech Tags: , ,

pfSense user/group management with puppet

July 14th, 2014 Comments off

3jel8jjmxg

Categories: [EN] Tech Tags: , , , , ,

Installing puppet on pfSense firewalls

July 14th, 2014 2 comments

Preface

While pfSense offers a rather large collection of packages, there is currently no puppet package available. However, there is a pull request to add a puppet package, but it has not been accepted yet. Please join the discussion here.

Some people might tell you to just install a FreeBSD package in pfSense to get puppet. Don’t do it, it’s just wrong. pfSense isn’t plain FreeBSD, it is an appliance and thus a different kind of beast. There are good reasons to use specialized pfSense packages.

Besides the technical reasons, the puppet package on pfSense includes a small but nice GUI component, as you can see from the screenshot below.

puppet_pfsense

Configure package repo

Since there’s no official puppet package for pfSense yet, we need to use an unofficial package. I’ve setup a pfSense package repo so everyone may checkout puppet on pfSense. To use this unofficial repo you need to open a hidden settings page in your pfSense firewall:

https://pfsense.example.com/pkg_mgr_settings.php

This allows you to configure a non-official server for packages. Enter pfsense.moov.de for Base URL and click Save. Now go to Available Packages tab, find the puppet package and install it.

Configure puppet agent

Go to Services->Puppet to configure the puppet agent. You may want to change the Puppet Server and Environment settings. Once you click Save the puppet agent configuration will be created and pfSense will try to start the puppet agent daemon. Of course, this will fail, since no signed SSL certificate is available. Now you should see a certificate request on your puppet master.

When the certificate was signed by your puppet master, you need to restart the puppet agent. Go to Status->Services and restart the puppet service accordingly.

Debug puppet agent

Now verify that the puppet agent is running. Go to Services->Puppet and open the Status tab. The agent should be running and no errors should be reported for the last run. The Facts and Debug tabs provide additional debug information. Additionally you may want to check Status->System Logs to see the log messages from last puppet run.

If your puppet agent is still not running you may want to open a pfSense shell and run puppet agent –test –verbose.

What’s next

Currently the number of ready-to-use puppet modules for pfSense is very limited, but most FreeBSD compatible modules/providers should work. You may also want to check out my collection of pfSense providers, pfsense_rancid module and pfsense_autoupdate module.

Categories: [EN] Tech Tags: , ,

Install puppet on ARM devices (Raspberry Pi)

March 11th, 2014 Comments off

If you try to install a recent puppet version on an ARM device like the Raspberry Pi you will see this error:

# apt-get install puppet
Reading package lists… Done
Building dependency tree
Reading state information… Done
You might want to run ‘apt-get -f install’ to correct these:
The following packages have unmet dependencies:
facter : Depends: dmidecode but it is not installable
puppet : Depends: puppet-common (= 3.4.3-1puppetlabs1) but it is not going to be installed
E: Unmet dependencies. Try ‘apt-get -f install’ with no packages (or specify a solution).

A quick google search reveals that this is a known bug. In fact it could easily be solved by removing the dmicode dependency from the facter package for the ARM architecture.

I didn’t want to rebuild the facter package to remove the dependency. Instead I’ve built a simple dmidecode dummy package to provide the required dependency. This makes it easy to install puppet on ARM devices running Debian Wheezy:

# setup puppetlabs repo
wget http://apt.puppetlabs.com/puppetlabs-release-wheezy.deb
dpkg -i puppetlabs-release-wheezy.deb

# install dumy package
wget http://dl.moov.de/linux/dmidecode_0.01_armhf.deb
dpkg -i dmidecode_0.01_armhf.deb

# install puppet
apt-get update
apt-get install puppet

Of course, I’d prefer a new facter package. I’m pretty sure puppetlabs will provide a new package in the future, but until then, this workaround will just work and does no harm.

css.php