Forge Home

server

The Server module serves as a base configuration for all your managed servers.

10,783 downloads

10,192 latest version

1.9 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

  • 0.1.1 (latest)
  • 0.1.0
  • 0.0.2
  • 0.0.1
released Feb 25th 2014

Start using this module

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

Add this module to your Puppetfile:

mod 'mikegleasonjr-server', '0.1.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add mikegleasonjr-server
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install mikegleasonjr-server --version 0.1.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

mikegleasonjr/server — version 0.1.1 Feb 25th 2014

#server

####Table of Contents

  1. Overview - What is the Server module?
  2. Module Description - What does the module do?
  3. Setup - The basics of getting started with Server
  4. Usage - Configuration and customization options
  5. Limitations - OS compatibility, etc.

##Overview

The Server module serves as a base configuration for all your managed servers.

##Module Description

Server introduces the class server, which is used to put the server in a secure and valid state before managing anything else. Even if your server pool contains many different types of servers, the server class can be used to manage the common resources that has to be present on all of them.

##Setup

###What Server affects:

  • packages installed
  • firewall settings
  • rsyslog settings
  • swap files
  • server's timezone and time synchronization

###Setup Requirements

Server uses the module puppetlabs/firewall which uses Ruby-based providers, so you must have pluginsync enabled.

###Beginning with Server

class { 'server': }

This will:

  • install vim
  • update the package list index every day
  • open up port 22 and protect it from brute force attacks, while blocking everything else
  • will set the timezone to UTC
  • synchronize the time with ntp

##Usage

You can change the default behavior with the following options:

###Packages installed

You can make sure that certain packages are installed and automatically updated. Defaults to vim and present.

class { 'server':
  packages        => ['vim', 'htop', 'tree'],
  packages_ensure => 'latest',
}

###Package list index update

You can control the package list index update frequency. Defaults to daily.

class { 'server':
  apt_update_interval => 'weekly',
}

###Timezone

You can change the server's timezone. Defaults to UTC.

class { 'server':
  timezone => 'America/New_York',
}

###Remote logging

You can change configure rsyslog to send the logs on a remote machine or service like papertrail. Defaults to disabled.

class { 'server':
  remote_logs_enabled => true,
  remote_logs_host    => 'logs.papertrailapp.com',
  remote_logs_port    => 123,
}

###Swap file

Lets you can create and enable a swap file on the server. Defaults to no swap file. Current swap files not managed by server will be preserved.

class { 'server':
  swap_enabled => true,
}

This will create the swap /mnt/managed_swap with a size equivalent of the amount of RAM installed. You can also change the swap location and size:

class { 'server':
  swap_enabled  => true,
  swap_filename => '/mnt/swap1',
  swap_size     => 1024
}

###Firewall

The module uses:

Any unknown firewall rules are flushed so you need to use the puppetlabs/firewall module to set up additional configurations:

class { 'server': }

firewall { '100 allow http and https access':
    port   => [80, 443],
    proto  => tcp,
    action => accept,
}

You can also prevent brute force attacks on additional ports (other than 22).

Here's an example of brute force attack prevention on port 8140:

class { 'server': }

firewall { '003 forward 8140 to sshguard':
    chain => 'INPUT',
    dport => 8140,
    proto => 'tcp',
    jump  => 'sshguard',
}

firewall { '001 allow 8140 access in sshguard':
    chain  => 'sshguard',
    action => 'accept',
    proto  => 'tcp',
    dport  => 8140,
}

sshguard will automatically insert blocking rules to offending IPs at the beginning of the sshguard chain.

##Limitations

This module has been tested on

  • Ubuntu 12.04
  • Debian 6

Bugs can be reported using Github Issues:

https://github.com/mikegleasonjr/puppet-server/issues