Defined Type: fail2ban::jail
- Defined in:
- manifests/jail.pp
Overview
Activate or define a fail2ban jail.
All parameters are optional; providing any of them overrides the system-provided defaults in /etc/fail2ban/jail.conf; /etc/fail2ban/jail.local, /etc/fail2ban/fail2ban.conf, and /etc/fail2ban/fail2ban.local
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'manifests/jail.pp', line 46
define fail2ban::jail (
Optional[Variant[String, Integer[1,6535]]] $port = undef,
Optional[String] $filter = undef,
Optional[Stdlib::Absolutepath] $log_path = undef,
Enum['present', 'absent'] $ensure = present,
Boolean $enabled = true,
Optional[Enum['udp', 'tcp', 'icmp', 'all']] $protocol = undef,
Optional[Integer] $maxretry = undef,
Optional[Integer] $findtime = undef,
Optional[String] $action = undef,
Optional[String] $banaction = undef,
Optional[Integer] $bantime = undef,
Array[Variant[IP::Address::NoSubnet, IP::Address::V4::CIDR, String]] $ignoreip = [],
Optional[Integer] $order = undef,
Optional[Enum['pyinotify', 'gamin', 'polling', 'systemd', 'auto']] $backend = undef,
) {
include ::fail2ban::config
# Debian wheezy and older does not use jail.d
if $::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '8') < 1 {
if $ensure != present {
notify {'no_ensure_wheezy':
message => 'The $ensure parameter cannot be used on Debian 7 or older.',
}
}
concat::fragment { "jail_${name}":
target => '/etc/fail2ban/jail.local',
content => template("${module_name}/jail.erb"),
order => $order,
}
}
else {
if $order {
notify {'order_only_with_wheezy':
message => 'The parameter $order makes sense only with Debian 7 or older.',
}
}
file { "/etc/fail2ban/jail.d/${name}.conf":
ensure => $ensure,
content => template("${module_name}/jail.erb"),
owner => 'root',
group => $::fail2ban::config::root_group,
mode => '0644',
}
}
}
|