From bc5193934d26aa6d5aa48f8fa0050f53a3ff897d Mon Sep 17 00:00:00 2001 From: "srvproxy001.itguys.com.br" Date: Sun, 28 Sep 2025 12:26:01 -0300 Subject: [PATCH] =?UTF-8?q?[Auto-Sync]=20Atualiza=C3=A7=C3=A3o=20das=20con?= =?UTF-8?q?figura=C3=A7=C3=B5es=20em=20srvproxy001.itguys.com.br=20-=20202?= =?UTF-8?q?5-09-28=2012:26:01?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fail2ban/filter.d/nginx-generic-badbots.conf | 13 ++++++++ fail2ban/jail.d/nginx-template.conf | 33 ++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 fail2ban/filter.d/nginx-generic-badbots.conf create mode 100644 fail2ban/jail.d/nginx-template.conf diff --git a/fail2ban/filter.d/nginx-generic-badbots.conf b/fail2ban/filter.d/nginx-generic-badbots.conf new file mode 100644 index 0000000..78491e1 --- /dev/null +++ b/fail2ban/filter.d/nginx-generic-badbots.conf @@ -0,0 +1,13 @@ +# /etc/fail2ban/filter.d/nginx-generic-badbots.conf +# +# Filtro genérico para Bad Bots e scanners comuns que se aplica a todos os sites. +# Este filtro é referenciado pelas jails individuais de cada site. +# ******************************************************************* + +[Definition] +# Detecta tentativas de acesso a arquivos e diretórios sensíveis (path traversal, env, etc.) +failregex = ^ .* "(GET|POST|HEAD|OPTIONS) .*(\.env|\.git/|\.svn/|setup\.php|phpmyadmin/|vendor/|wp-config\.php|wlwmanifest\.xml|test\.php).* HTTP\/1\..*"$ +# Detecta ferramentas de scanner conhecidas (sqlmap, Nikto, wpscan, etc.) + ^ .* "(GET|POST|HEAD|OPTIONS) .*(sqlmap|Nikto|wpscan|Telescope|zgrab|masscan).* HTTP\/1\..*"$ + +ignoreregex = diff --git a/fail2ban/jail.d/nginx-template.conf b/fail2ban/jail.d/nginx-template.conf new file mode 100644 index 0000000..8c6f574 --- /dev/null +++ b/fail2ban/jail.d/nginx-template.conf @@ -0,0 +1,33 @@ +# /etc/fail2ban/jail.d/nginx-template.conf +# +# TEMPLATE: COPIE e RENOMEIE este arquivo para [SEU-SITE].conf +# ******************************************************************* +# Renomeie: nginx-template.conf -> site-meuprojeto.conf +# ******************************************************************* + +#[nginx-site-meuprojeto-badbots] +#enabled = true +## Ação: Usa a ação padrão definida no [DEFAULT] do jail.local +#action = %(action_mwl)s +## Porta a ser banida (HTTPS e HTTP) +#port = http,https +## Referencia o filtro genérico criado (1.1. Passo) +#filter = nginx-generic-badbots +## *** CRÍTICO: Mude este caminho para o log dedicado do NGINX *** +#logpath = /var/log/nginx/site-meuprojeto.bad-bot.log +# +## Configurações de Banimento Customizadas +#maxretry = 3 +#findtime = 10m +#bantime = 12h +# +# =================================================================== +# JAIL ADICIONAL (Exemplo de log de erro) +# =================================================================== +# +#[nginx-site-meuprojeto-errors] +#enabled = false # Desabilite ou Habilite conforme a necessidade de monitoramento +#filter = nginx-bad-request +#logpath = /var/log/nginx/site-meuprojeto.error.log +#maxretry = 5 +#bantime = 3h