2025-03-02 16:28:57 +01:00
|
|
|
# Module name: haproxy_cd
|
2025-02-14 11:36:23 +01:00
|
|
|
# Author: Arne Teuke (arne_teuke@confdroid.com)
|
|
|
|
|
# @summary Class manages fail2ban settings
|
|
|
|
|
##############################################################################
|
2025-03-02 16:28:57 +01:00
|
|
|
class haproxy_cd::monitoring::fail2ban (
|
2025-02-14 11:36:23 +01:00
|
|
|
|
2025-03-02 16:28:57 +01:00
|
|
|
) inherits haproxy_cd::params {
|
2025-02-14 11:36:23 +01:00
|
|
|
if $hy_manage_fail2ban == true {
|
2025-03-02 17:26:09 +01:00
|
|
|
require fail2ban_cd # (external module)
|
2025-02-14 11:41:18 +01:00
|
|
|
|
2025-02-14 11:36:23 +01:00
|
|
|
# configure filter
|
2025-02-22 13:12:45 +01:00
|
|
|
|
2025-02-14 11:36:23 +01:00
|
|
|
file { '/etc/fail2ban/filter.d/haproxy.conf':
|
2025-03-02 17:26:09 +01:00
|
|
|
ensure => file,
|
|
|
|
|
owner => 'root',
|
|
|
|
|
group => 'root',
|
|
|
|
|
mode => '0644',
|
|
|
|
|
selrange => s0,
|
|
|
|
|
selrole => object_r,
|
|
|
|
|
seltype => etc_t,
|
|
|
|
|
seluser => system_u,
|
|
|
|
|
content => template('haproxy_cd/fail2ban/f2b_haproxy.conf.erb'),
|
|
|
|
|
notify => Service['fail2ban'],
|
2025-02-14 12:01:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
file { '/etc/fail2ban/jail.d/010-haproxy.conf':
|
2025-03-02 17:26:09 +01:00
|
|
|
ensure => file,
|
|
|
|
|
owner => 'root',
|
|
|
|
|
group => 'root',
|
|
|
|
|
mode => '0644',
|
|
|
|
|
selrange => s0,
|
|
|
|
|
selrole => object_r,
|
|
|
|
|
seltype => etc_t,
|
|
|
|
|
seluser => system_u,
|
|
|
|
|
content => template('haproxy_cd/fail2ban/010_jail.d_haproxy.conf.erb'),
|
|
|
|
|
notify => Service['fail2ban'],
|
2025-02-14 11:36:23 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|