Forge Home


Puppet module for fail2ban


7,054 latest version

3.2 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

  • 1.0.0 (latest)
  • 0.1.7
  • 0.1.6
  • 0.1.2
  • 0.1.0
released Feb 24th 2017

Start using this module

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

Add this module to your Puppetfile:

mod 'desalvo-fail2ban', '1.0.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add desalvo-fail2ban
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install desalvo-fail2ban --version 1.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.



desalvo/fail2ban — version 1.0.0 Feb 24th 2017


Puppet module for fail2ban configuration.

Table of Contents

  1. Overview - What is the fail2ban module?


This module is intended to be used to manage the fail2ban configurations.



class { fail2ban: }
  • bantime: banning time, in seconds
  • backend: backend to be used, defaults to 'auto'. Use 'systemd' to force using systemd.
  • action: action used to ban, defaults to 'iptables' unless you run on RHEL >= 7. Set it to 'firewallcmd-ipset' to use firewalld.
  • findtime: the counter is set to zero if no match is found within "findtime" seconds
  • maxretry: number of matches (i.e. value of the counter) which triggers ban action on the IP
  • jails: hash of jails to activate, currently supported options are imap, pop3, ssh, vsftpd.
  • mailto: mail address to send notifications
  • log_file: the log file path or SYSLOG (default), STDOUT, STDERR
  • log_level: the log level, level can be one of CRITICAL, ERROR, WARNING, NOTICE, INFO, DEBUG



This is a simple example to configure fail2ban with an SSH and IMAP jail. You can override values for the given jail by specifying the parameters in the jail hash.

Using the fail2ban ssh and imap jails

class { 'fail2ban':
    jails  => {'ssh' => { 'maxretry' => 5 }, 'imap' => {}},
    mailto => '',


Release Notes


  • Firewalld support
  • Jail parameter overrides


  • Fix params inheritance namespace
  • New log_level parameter


  • Add backend parameter to force systemd


  • Puppet 4 compatibility


  • Add log_file option


  • Fix whois package name for RHEL < 7


  • Add whois in case of ssh jails defined


  • Add bantime, findtime and maxretry parameters


  • Initial version