pam_shield

Install pam_shield brute force protection for sshd

Jonathan Gazeley

jgazeley

12,918 downloads

5,723 latest version

4.3 quality score

Version information

  • 2.0.0 (latest)
  • 1.1.2
  • 1.1.1
  • 1.1.0
  • 1.0.2
  • 1.0.1
  • 1.0.0
  • 0.1.0
released May 23rd 2017
This version is compatible with:
  • Puppet Enterprise 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
  • Puppet >= 3.0.0 < 5.0.0
  • RedHat
    ,
    CentOS
    ,
    Scientific Linux
    ,
    Fedora

Start using this module

Documentation

jgazeley/pam_shield — version 2.0.0 May 23rd 2017

pam_shield

Table of Contents

  1. Overview
  2. Module Description - What the module does and why it is useful
  3. Setup - The basics of getting started with pam_shield
  4. Usage - Configuration options and additional functionality
  5. Limitations - OS compatibility, etc.
  6. Development - Guide for contributing to the module

Overview

This module install pam_shield brute-force protection for sshd. It was developed for use with CentOS and by extension should work on Red Hat, Scientific and Fedora. It has not been tested with Debian or Ubuntu.

Note: Version 2.0.0 is exactly the same as 1.1.2, except that it requires puppet/selinux

= 1.0.0, which is not backwards compatible with puppet/selinux < 1.0.0. Test carefully before upgrading puppet/selinux, because everything that calls it to load a policy will need to update its calling syntax.

Module Description

This module installs the pam_shield package and provides basic config files to protect your system from ssh brute-force attacks with (relatively) sane defaults. It should "just work" out of the box.

Setup

What pam_shield affects

Wherever possible, this module adds its own files to your system without overwriting anything. However it will stamp all over your copy of /etc/pam.d/sshd so if you have customised this on your system, be sure to check the source of this module and make sure it is compatible.

On RedHat-like systems (except Fedora), the pam_shield package is provided by the EPEL repository. This module uses stahnma/epel to provide the repository. Check for conflicts if you provide EPEL in a different way.

Usage

Basic use of this module requires no parameters. To use it and accept the defaults, just call include ::pam_shield in your manifest.

It is likely you'll want to customise the installation and override the defaults.

  class { 'pam_shield':
    allow_missing_dns     => true,
    allow_missing_reverse => true,
    max_conns             => 5,
    interval              => '1m',
    retention             => '4m',
    allow                 => [
      '192.168.0.1/24',
      '192.168.6.32',
    ],
  }

Parameters with pam_shield:

allow_missing_dns

Boolean. Is it OK for the remote host to have no DNS entry? Default: true

allow_missing_reverse

Boolean. Is it OK for the remote host to have no reverse DNS entry? Default: true

max_conns

Integer. Number of failed connections per interval from one site that triggers us to block them. Default: 5

interval

String. The time interval during which max_conns must not be exceeded. Default: 1m

String formatting must be one of the following: 1s seconds 1m minutes 1h hours 1d days 1w weeks 1M months (30 days) 1y years

retention

String. Period until the entry expires from the database again. Formatting as interval. Default: 4m

allow

Array of strings. Any IP address or subnet in CIDR notation. Default: undef

selinux_policy

Boolean. Install an SELinux policy to allow pam_shield to operate normally. Requires puppet/selinux which defaults to false because it can do unexpected things. Test before deploying! Default: false

Limitations

This module was developed for use with CentOS and by extension should work on Red Hat, Scientific and Fedora. It has not been tested with Debian or Ubuntu. If packages are available for other platforms then it should be easy to extend this module.

Development

Feel free to fork and send pull requests, or just make feature requests in the issue tracker. I can't guarantee having the time to look at anything.