diff --git a/templates/nrpe.cfg.j2 b/templates/nrpe.cfg.j2 index 11aca8a8159dd7a730a6b6932f7779cdff8b641c..b17eddafbf9174cd461032177f7baef0890c45ee 100644 --- a/templates/nrpe.cfg.j2 +++ b/templates/nrpe.cfg.j2 @@ -32,7 +32,16 @@ command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10 command[check_version]=/usr/lib/nagios/custom-plugins/check_version.sh # Check specific processes -command[check_fail2ban]=/usr/lib/nagios/custom-plugins/check_fail2ban -w 350 -c 500 +{% if inventory_hostname in groups.gitlab | default([]) %} +{% set fail2ban_jails = fail2ban_jails + ['gitlab'] %} +{% endif %} +{% if inventory_hostname in groups.odoo_server | default([]) or inventory_hostname in groups.owncloud_server | default([]) or inventory_hostname in groups.gitlab | default([]) %} +{% set fail2ban_jails = fail2ban_jails + ['nginx-http-auth', 'nginx-botsearch'] %} +{% endif %} +{% if inventory_hostname in groups.docker | default([]) and inventory_hostname not in groups.docker_nextcloud | default([]) %} +{% set fail2ban_jails = fail2ban_jails + ['traefik-auth'] %} +{% endif %} +command[check_fail2ban]=/usr/lib/nagios/custom-plugins/check_fail2ban.sh {{ fail2ban_jails | join(',') }} {% if inventory_hostname in groups.docker_gitlab | default([]) %} command[check_procs_sshd]=/usr/lib/nagios/plugins/check_procs -w 4 -c 2: -C sshd -a -D {% else %} diff --git a/vars/main.yml b/vars/main.yml index bd77b9bdd7ed143aa888a8c107490fa703fb28a4..b778e1877a3310479881d966f1a518734c6507b2 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -5,10 +5,13 @@ plugins_to_download: - name: check_docker.sh url: https://sources.le-filament.com/lefilament/nagios-plugin/-/raw/master/check_docker.sh - name: check_fail2ban - url: https://raw.githubusercontent.com/n1tr0-5urf3r/icinga2-scripts/master/plugins/check_fail2ban + url: https://sources.le-filament.com/lefilament/nagios-plugin/-/raw/master/check_fail2ban.sh - name: check_gitlab.rb url: https://sources.le-filament.com/lefilament/nagios-plugin/-/raw/master/check_gitlab.rb - name: check_mem.pl url: https://raw.githubusercontent.com/justintime/nagios-plugins/master/check_mem/check_mem.pl - name: check_version.sh url: https://exchange.nagios.org/components/com_mtree/attachment.php?link_id=1785&cf_id=24 +fail2ban_jails: + - sshd + - recidive