193 lines
9.8 KiB
Plaintext
193 lines
9.8 KiB
Plaintext
# ==========================================================================
|
|
# Arquivo Global de Exceções do ModSecurity
|
|
# ==========================================================================
|
|
# Este arquivo centraliza todas as regras de exceção para as aplicações.
|
|
# Todos os IDs foram reorganizados para serem únicos.
|
|
SecRule REMOTE_ADDR "@ipMatch 172.16.0.0/16,10.10.0.0/16,10.11.0.0/16,10.12.0.0/16" \
|
|
"id:10000, \
|
|
phase:1, \
|
|
pass, \
|
|
nolog, \
|
|
ctl:ruleEngine=Off, \
|
|
msg:'WHITELIST: Acesso permitido da rede interna, ModSecurity desativado'"
|
|
# --------------------------------------------------------------------------
|
|
# Exceções para o Nextcloud
|
|
# --------------------------------------------------------------------------
|
|
# Desliga o motor de regras para as rotas de sincronização (WebDAV).
|
|
SecRule REQUEST_URI "@beginsWith /remote.php" "id:10001,phase:1,nolog,pass,ctl:ruleEngine=Off"
|
|
SecRule REQUEST_URI "@streq /.well-known/caldav" "id:10002,phase:1,nolog,pass,ctl:ruleEngine=Off"
|
|
SecRule REQUEST_URI "@streq /.well-known/carddav" "id:10003,phase:1,nolog,pass,ctl:ruleEngine=Off"
|
|
# --------------------------------------------------------------------------
|
|
# Exceções para o Zabbix
|
|
# --------------------------------------------------------------------------
|
|
# Desliga o ModSecurity para a API JSON-RPC e zabbix.php.
|
|
SecRule REQUEST_URI "@rx (api_jsonrpc\.php|jsrpc\.php|zabbix\.php)" "id:10004,phase:1,nolog,pass,ctl:ruleEngine=Off"
|
|
# Desativa regras específicas na página de Descoberta de Hosts.
|
|
# Lembre-se de substituir os IDs abaixo pelos que encontrou no seu log.
|
|
SecRule REQUEST_URI "@beginsWith /zabbix/host_discovery.php" "id:10005,phase:1,nolog,allow,ctl:ruleRemoveById=9XXXXX,ctl:ruleRemoveById=9YYYYY"
|
|
# --------------------------------------------------------------------------
|
|
# Exceções para o Microsoft Exchange
|
|
# --------------------------------------------------------------------------
|
|
# Desliga o ModSecurity para o Outlook Web App (OWA) e o Exchange Admin Center (ECP).
|
|
SecRule REQUEST_URI "@rx ^/(owa|ecp)/" "id:10006,phase:1,nolog,allow,ctl:ruleEngine=Off"
|
|
|
|
# --------------------------------------------------------------------------
|
|
# Exceções para o Zammad
|
|
# --------------------------------------------------------------------------
|
|
# Desativa regra de falso positivo para a API do Zammad.
|
|
# Lembre-se de substituir '9XXXXX' pelo ID da regra real.
|
|
SecRule REQUEST_URI "@beginsWith /api/v1/" "id:10007,phase:1,nolog,allow,ctl:ruleRemoveById=9XXXXX"
|
|
|
|
# --------------------------------------------------------------------------
|
|
# Exceções para o Gitea
|
|
# --------------------------------------------------------------------------
|
|
# Desliga o motor de regras para operações de ficheiros no Gitea.
|
|
SecRule REQUEST_URI "@rx ^/.*/(src/branch|_edit|_new|commits/branch)/" "id:10008,phase:1,nolog,allow,ctl:ruleEngine=Off"
|
|
SecRule REQUEST_URI "@rx ^/.*/.*(raw|assets)/" "id:10011,phase:1,nolog,pass,ctl:ruleEngine=Off"
|
|
SecRule REQUEST_FILENAME "@rx \.conf$" "id:10013,phase:1,nolog,pass,chain,msg:'[CUSTOM] Whitelist .conf files for Git server'"
|
|
SecRule SERVER_NAME "@streq git.itguys.com.br" "ctl:ruleRemoveById=930120"
|
|
SecRule REQUEST_URI "@rx ^/[^/]+/[^/]+/upload-file$" \
|
|
"id:10025, \
|
|
phase:1, \
|
|
pass, \
|
|
nolog, \
|
|
ctl:ruleEngine=Off, \
|
|
msg:'TUNING: ModSecurity desativado para a rota de upload de arquivos do Gitea'"
|
|
SecRule REQUEST_URI "@rx ^/[^/]+/[^/]+/wiki$" \
|
|
"id:10026, \
|
|
phase:1, \
|
|
pass, \
|
|
nolog, \
|
|
ctl:ruleEngine=Off, \
|
|
msg:'TUNING: ModSecurity desativado para a rota de wiki do Gitea'"
|
|
# --------------------------------------------------------------------------
|
|
# Exceções para o Grafana
|
|
# --------------------------------------------------------------------------
|
|
# Desativa a regra de falso positivo para a API de dashboards.
|
|
# Lembre-se de substituir '9XXXXX' pelo ID da regra real.
|
|
SecRule REQUEST_URI "@beginsWith /api/dashboards/" "id:10009,phase:1,nolog,allow,ctl:ruleRemoveById=9XXXXX"
|
|
|
|
# --------------------------------------------------------------------------
|
|
# Exceções para a Geração de Prévias (Thumbnails) do Nextcloud
|
|
# --------------------------------------------------------------------------
|
|
# Desativa a regra de falso positivo que bloqueia a criação de miniaturas.
|
|
# Substitua '9XXXXX' pelo ID real encontrado no log de auditoria.
|
|
SecRule REQUEST_URI "@beginsWith /index.php/core/preview" "id:10010,phase:1,nolog,pass,ctl:ruleRemoveById=9XXXXX
|
|
|
|
# --------------------------------------------------------------------------
|
|
# Exceções para o Nextcloud Office Online
|
|
# --------------------------------------------------------------------------
|
|
# Desliga completamente o motor de regras para as rotas de comunicação do
|
|
# Office Online, que geram muitos falsos positivos.
|
|
# As rotas são /hosting/discovery, /hosting/wopi/ e /op/.
|
|
SecRule REQUEST_URI "@rx ^/(hosting|op|we|wv|p|x|lo|m|o)/" "id:10014,phase:1,nolog,pass,ctl:ruleEngine=Off"
|
|
SecRule REQUEST_URI "@streq /index.php/apps/officeonline/ajax/admin.php" "id:10015,phase:1,nolog,pass,ctl:ruleEngine=Off"
|
|
|
|
# Exceções para a API do UniFi Controller
|
|
# --------------------------------------------------------------------------
|
|
# Desativa a regra que bloqueia o método 'PUT' para a API.
|
|
SecRule REQUEST_URI "@beginsWith /api/" "id:10012,phase:1,nolog,pass,ctl:ruleEngine=Off"
|
|
|
|
# Exceção para o Editor de Texto (Nextcloud Text)
|
|
# --------------------------------------------------------------------------
|
|
# Desliga o motor de regras para a criação de sessão do editor de texto,
|
|
# que é bloqueada por regras de segurança (falso positivo).
|
|
SecRule REQUEST_URI "@beginsWith /apps/text/session" "id:10016,phase:1,nolog,pass,ctl:ruleEngine=Off"
|
|
SecRule REQUEST_URI "@streq /apps/logreader/api/settings" "id:10020,phase:1,nolog,pass,ctl:ruleEngine=Off"
|
|
# ==========================================================================================
|
|
# NOVAS EXCEÇÕES - AJUSTADAS EM 2025-09-25 22:24
|
|
# ------------------------------------------------------------------------------------------
|
|
# MOTIVO: Corrige erros 403 (falsos positivos) em rotas da app "External Sites" do Nextcloud.
|
|
# MÉTODO: Em vez de desligar o motor, desabilita apenas as regras específicas que
|
|
# contribuem para o score de anomalia, mantendo as demais proteções.
|
|
# AÇÃO: Substitua 9XXXXX e 9YYYYY pelos IDs de regras encontrados no modsec_audit.log.
|
|
|
|
# Exceção para a API de "sites externos". Bloqueava requisições PUT.
|
|
SecRule REQUEST_URI "@beginsWith /ocs/v2.php/apps/external/api/v1/sites" "id:10017,phase:1,nolog,pass,ctl:ruleEngine=Off"
|
|
|
|
# Exceção para os ícones da app "sites externos". Bloqueava requisições DELETE.
|
|
SecRule REQUEST_URI "@beginsWith /apps/external/icons" "id:10018,phase:1,pass,nolog,ctl:ruleEngine=Off"
|
|
# ==========================================================================================
|
|
SecRule REQUEST_URI "@rx ^/(ocs/v2\.php/apps/user_status/api/v1/heartbeat|apps/files/api/v1/config/(sort_favorites_first|show_hidden|grid_view|folder_tree|sort_folders_first|crop_image_previews|show_dialog_file_extension))" \
|
|
"id:10022, \
|
|
phase:1, \
|
|
pass, \
|
|
nolog, \
|
|
ctl:ruleEngine=Off, \
|
|
msg:'TUNING: ModSecurity desativado para APIs de configuracao de UI do Nextcloud'"
|
|
SecRule REQUEST_URI "@rx ^/ocs/v2\.php/cloud/users|profile/.*" \
|
|
"id:10023, \
|
|
phase:1, \
|
|
pass, \
|
|
nolog, \
|
|
ctl:ruleEngine=Off, \
|
|
msg:'TUNING: ModSecurity desativado para a API de atualizacao de perfil de usuario do Nextcloud'"
|
|
SecRule REQUEST_URI "@streq /apps/files/api/v1/views" \
|
|
"id:10024, \
|
|
phase:1, \
|
|
pass, \
|
|
nolog, \
|
|
ctl:ruleEngine=Off, \
|
|
msg:'TUNING: ModSecurity desativado para a API de views de arquivos do Nextcloud'"
|
|
SecRule REQUEST_URI "@rx ^/(index\.php/core/preview|ocs/v2\.php/apps/user_status/api/v1/user_status)" \
|
|
"id:10027, \
|
|
phase:1, \
|
|
pass, \
|
|
nolog, \
|
|
ctl:ruleEngine=Off, \
|
|
msg:'TUNING: ModSecurity desativado para as APIs de Preview e User Status do Nextcloud'"
|
|
SecRule REQUEST_URI "@streq /ocs/v2.php/cloud/groups/details" \
|
|
"id:10028, \
|
|
phase:1, \
|
|
pass, \
|
|
nolog, \
|
|
ctl:ruleEngine=Off, \
|
|
msg:'TUNING: ModSecurity desativado para a API de busca de grupos do Nextcloud'"
|
|
SecRule REQUEST_URI "@beginsWith /ocs/v2.php/apps/forms/api/" \
|
|
"id:10031, \
|
|
phase:1, \
|
|
pass, \
|
|
nolog, \
|
|
ctl:ruleEngine=Off, \
|
|
msg:'TUNING: ModSecurity desativado para a API do Nextcloud Forms'"
|
|
SecRule REQUEST_METHOD "@streq PUT" "phase:1,id:1001,chain,nolog,pass"
|
|
SecRule REQUEST_URI "@rx ^/apps/integration_onedrive/(?:admin-config|sensitive-admin-config)$" \
|
|
"t:none,ctl:ruleRemoveById=949110"
|
|
SecRule REQUEST_URI "@rx ^/(apps/tables/|ocs/v2\.php/apps/tables/)" \
|
|
"id:10032, \
|
|
phase:1, \
|
|
pass, \
|
|
nolog, \
|
|
ctl:ruleEngine=Off, \
|
|
msg:'TUNING: (Nuke) ModSecurity DESATIVADO para Nextcloud Tables'"
|
|
SecRule REQUEST_URI "@beginsWith /ocs/v2.php/apps/notifications/api/v2/notifications" \
|
|
"id:10019, \
|
|
phase:1, \
|
|
nolog, \
|
|
pass, \
|
|
ctl:ruleEngine=Off, \
|
|
msg:'TUNING: (Corrigido) ModSecurity DESATIVADO para API de Notificações'"
|
|
SecRule REQUEST_URI "@beginsWith /apps/files_pdfviewer/" \
|
|
"id:10033, \
|
|
phase:1, \
|
|
pass, \
|
|
nolog, \
|
|
ctl:ruleRemoveById=949110, \
|
|
msg:'TUNING: Remove bloqueio por Anomaly Score (949110) para Nextcloud PDF Viewer'"
|
|
SecRule REMOTE_ADDR "@ipMatch 172.16.254.1" \
|
|
"id:10034, \
|
|
phase:1, \
|
|
pass, \
|
|
nolog, \
|
|
chain, \
|
|
msg:'WHITELIST: [Proxy 172.16.254.1] Desativa WAF para Office Online (WOPI)'"
|
|
SecRule REQUEST_URI "@beginsWith /index.php/apps/officeonline/wopi/files/" \
|
|
"ctl:ruleEngine=Off"
|
|
SecRule REQUEST_URI "@streq /apps/officeonline/index" \
|
|
"id:10035, \
|
|
phase:1, \
|
|
pass, \
|
|
nolog, \
|
|
ctl:ruleEngine=Off, \
|
|
msg:'TUNING: Desativa WAF para a pagina de indice do Office Online (falso positivo em GET)'"
|