Forge Home


Install pam_shield brute force protection for sshd


6,759 latest version

4.3 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

  • 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
  • , , ,

Start using this module

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

Add this module to your Puppetfile:

mod 'jgazeley-pam_shield', '2.0.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add jgazeley-pam_shield
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install jgazeley-pam_shield --version 2.0.0

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.

Tags: ssh, pam-shield


jgazeley/pam_shield — version 2.0.0 May 23rd 2017


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


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.


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.


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                 => [

Parameters with pam_shield:


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


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


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


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


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


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


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


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.


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.