Postgres Web Server Hardening with Puppet
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
files
manifests
.gitignore
.kitchen.yml
.puppet-lint.rc
.rubocop.yml
.travis.yml
Gemfile
Guardfile
Modulefile
Puppetfile
README.md
Rakefile
Thorfile
metadata.json

README.md

postgres_hardening (Puppet module)

Puppet Forge Build Status Gitter Chat

Description

This module provides hardening configuration for Postgres.

Requirements

  • Puppet

Parameters

Usage

class { '::postgresql::server':
  postgres_password          => 'iloverandompasswordsbutthiswilldo',
}

class { '::postgres_hardening':
  provider => 'puppetlabs/postgresql',
}

Enable SSL

Please read http://www.postgresql.org/docs/9.1/static/ssl-tcp.html first.

This module will delete the links from /var/lib/postgresql/${postgresql::server::version}/main/server.crt to /etc/ssl/certs/ssl-cert-snakeoil.pem and /var/lib/postgresql/${postgresql::server::version}/main/server.key to /etc/ssl/private/ssl-cert-snakeoil.key on Debian systems. This certificates are self-signed (see http://en.wikipedia.org/wiki/Snake_oil_%28cryptography%29) and therefore not trusted. You have to provide your own trusted certificates for SSL.

class { '::postgresql::server':
  postgres_password          => 'iloverandompasswordsbutthiswilldo',
}

class { '::postgres_hardening':
  provider => 'puppetlabs/postgresql',
  config_entry_ssl => 'on'
}

Local Testing

For local testing you can use vagrant and Virtualbox of VMWare to run tests locally. You will have to install Virtualbox and Vagrant on your system. See Vagrant Downloads for a vagrant package suitable for your system. For all our tests we use test-kitchen. If you are not familiar with test-kitchen please have a look at their guide.

Next install test-kitchen:

# Install dependencies
gem install bundler
bundle install

# Fetch tests
bundle exec thor kitchen:fetch-remote-tests

# Do lint checks
bundle exec rake lint

# Do spec checks
bundle exec rake spec

# fast test on one machine
bundle exec kitchen test default-ubuntu-1204

# test on Debian-based machines
bundle exec kitchen test

# for development
bundle exec kitchen create default-ubuntu-1204
bundle exec kitchen converge default-ubuntu-1204

For more information see test-kitchen

Contributors + Kudos

License and Author

  • Author:: Deutsche Telekom AG

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.