Files
confdroid_nagios/manifests/monitoring/fail2ban.pp

42 lines
1.2 KiB
ObjectPascal
Raw Normal View History

2026-03-12 11:50:06 +01:00
## confdroid_nagios::monitoring::fail2ban.pp
# Module name: confdroid_nagios
# Author: 12ww1160 (12ww1160@confdroid.com)
# @summary Class manages fail2ban monitoring for the confdroid_nagios module.
###############################################################################
class confdroid_nagios::monitoring::fail2ban (
) inherits confdroid_nagios::params {
2026-03-12 11:55:49 +01:00
# we want to create a nagios jail here
2026-03-12 14:28:42 +01:00
if ($ng_nagios_server == $fqdn) and ($ng_enable_fail2ban == true) {
2026-03-12 14:15:13 +01:00
require confdroid_fail2ban
# create the jail file
file { $fn_jail_file:
ensure => file,
2026-03-12 14:41:28 +01:00
owner => 'root',
2026-03-12 14:15:13 +01:00
group => 'root',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => etc_t,
seluser => system_u,
content => template('confdroid_nagios/fail2ban/jail.conf.erb'),
notify => Service['fail2ban'],
}
# create the filter rule
file { $fn_filter_file:
ensure => file,
2026-03-12 14:41:28 +01:00
owner => 'root',
2026-03-12 14:15:13 +01:00
group => 'root',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => etc_t,
seluser => system_u,
content => template('confdroid_nagios/fail2ban/filter.conf.erb'),
notify => Service['fail2ban'],
}
}
2026-03-12 11:50:06 +01:00
}