Files
dashboard/deploy_user_agents_view.sql
SOC Analyst a61828d1e7 Initial commit: Bot Detector Dashboard for SOC Incident Response
🛡️ Dashboard complet pour l'analyse et la classification des menaces

Fonctionnalités principales:
- Visualisation des détections en temps réel (24h)
- Investigation multi-entités (IP, JA4, ASN, Host, User-Agent)
- Analyse de corrélation pour classification SOC
- Clustering automatique par subnet/JA4/UA
- Export des classifications pour ML

Composants:
- Backend: FastAPI (Python) + ClickHouse
- Frontend: React + TypeScript + TailwindCSS
- 6 routes API: metrics, detections, variability, attributes, analysis, entities
- 7 types d'entités investigables

Documentation ajoutée:
- NAVIGATION_GRAPH.md: Graph complet de navigation
- SOC_OPTIMIZATION_PROPOSAL.md: Proposition d'optimisation pour SOC
  • Réduction de 7 à 2 clics pour classification
  • Nouvelle vue /incidents clusterisée
  • Panel latéral d'investigation
  • Quick Search (Cmd+K)
  • Timeline interactive
  • Graph de corrélations

Sécurité:
- .gitignore configuré (exclut .env, secrets, node_modules)
- Credentials dans .env (à ne pas committer)

⚠️ Audit sécurité réalisé - Voir recommandations dans SOC_OPTIMIZATION_PROPOSAL.md

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-14 21:33:55 +01:00

80 lines
3.0 KiB
SQL

-- =============================================================================
-- Vue materialisée pour les User-Agents - Dashboard Bot Detector
-- =============================================================================
--
-- Instructions d'installation :
-- -----------------------------
-- 1. Se connecter à ClickHouse en CLI :
-- clickhouse-client --host test-sdv-anubis.sdv.fr --port 8123 \
-- --user default --password <votre_mot_de_passe>
--
-- 2. Copier-coller CHAQUE BLOC séparément (un par un)
--
-- 3. Vérifier que la vue est créée :
-- SELECT count() FROM mabase_prod.view_dashboard_user_agents;
--
-- =============================================================================
USE mabase_prod;
-- =============================================================================
-- BLOC 1/3 : Créer la table
-- =============================================================================
CREATE TABLE IF NOT EXISTS mabase_prod.view_dashboard_user_agents
(
src_ip IPv4,
ja4 String,
hour DateTime,
log_date Date,
user_agents Array(String),
requests UInt64
)
ENGINE = AggregatingMergeTree()
PARTITION BY log_date
ORDER BY (src_ip, ja4, hour)
TTL log_date + INTERVAL 7 DAY
SETTINGS index_granularity = 8192;
-- =============================================================================
-- BLOC 2/3 : Créer la vue materialisée
-- =============================================================================
CREATE MATERIALIZED VIEW IF NOT EXISTS mabase_prod.view_dashboard_user_agents_mv
TO mabase_prod.view_dashboard_user_agents
AS SELECT
src_ip,
ja4,
toStartOfHour(time) AS hour,
toDate(time) AS log_date,
groupArrayDistinct(header_user_agent) AS user_agents,
count() AS requests
FROM mabase_prod.http_logs
WHERE header_user_agent != '' AND header_user_agent IS NOT NULL
AND time >= now() - INTERVAL 7 DAY
GROUP BY src_ip, ja4, hour, log_date;
-- =============================================================================
-- BLOC 3/3 : Créer les index (optionnel - améliore les performances)
-- =============================================================================
ALTER TABLE mabase_prod.view_dashboard_user_agents
ADD INDEX IF NOT EXISTS idx_user_agents_ip (src_ip) TYPE minmax GRANULARITY 1;
ALTER TABLE mabase_prod.view_dashboard_user_agents
ADD INDEX IF NOT EXISTS idx_user_agents_ja4 (ja4) TYPE minmax GRANULARITY 1;
-- =============================================================================
-- FIN
-- =============================================================================
--
-- Pour vérifier que la vue fonctionne :
-- -------------------------------------
-- SELECT * FROM mabase_prod.view_dashboard_user_agents LIMIT 10;
--
-- Pour rafraîchir manuellement (si nécessaire) :
-- ----------------------------------------------
-- OPTIMIZE TABLE mabase_prod.view_dashboard_user_agents FINAL;
--
-- =============================================================================