mirror of
https://github.com/CyberMind-FR/secubox-deb.git
synced 2026-07-28 15:28:24 +00:00
docs(opad): add doctrine documents (OPAD.md, CSPN.matrix.md, OPAD-OPERATIONS.md)
Cherry-picked from parallel branch: - OPAD.md: Core doctrine (671 lines) - CSPN.matrix.md: Threat × capability matrix (569 lines) - OPAD-OPERATIONS.md: Operational guide (948 lines) Refs: CM-WALL-OPAD-2026-05 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
3b99bcf4ec
commit
7523c12fff
569
doctrine/opad/CSPN.matrix.md
Normal file
569
doctrine/opad/CSPN.matrix.md
Normal file
|
|
@ -0,0 +1,569 @@
|
|||
# Matrice CSPN — OPAD SecuBox v2.4.0
|
||||
|
||||
**Analyse menace × capacité pour certification ANSSI**
|
||||
|
||||
---
|
||||
|
||||
## Métadonnées
|
||||
|
||||
| Champ | Valeur |
|
||||
|-------|--------|
|
||||
| **Référence** | CM-CSPN-OPAD-MATRIX-2026-05 |
|
||||
| **Version** | 2.4.0 |
|
||||
| **Status** | Canonique |
|
||||
| **Date** | 2026-05-12 |
|
||||
| **Auteur** | Gérald Kerma (CyberMind) |
|
||||
| **Cible** | SecuBox-Deb v2.4.0 — Module WALL (OPAD) |
|
||||
| **Niveau** | CSPN (Certification de Sécurité de Premier Niveau — ANSSI) |
|
||||
| **Portée** | Analyse de couverture des menaces par les capacités OPAD |
|
||||
| **Document parent** | CM-WALL-OPAD-2026-05 (OPAD.md) |
|
||||
|
||||
---
|
||||
|
||||
## Table des matières
|
||||
|
||||
1. [Périmètre d'évaluation](#1-périmètre-dévaluation)
|
||||
2. [Capacités OPAD](#2-capacités-opad)
|
||||
3. [Catalogue des menaces](#3-catalogue-des-menaces)
|
||||
4. [Matrice menace × capacité](#4-matrice-menace--capacité)
|
||||
5. [Résumé de couverture](#5-résumé-de-couverture)
|
||||
6. [Périmètre explicitement exclu](#6-périmètre-explicitement-exclu)
|
||||
7. [Traçabilité vers invariants](#7-traçabilité-vers-invariants)
|
||||
8. [Références](#8-références)
|
||||
|
||||
---
|
||||
|
||||
## 1. Périmètre d'évaluation
|
||||
|
||||
### 1.1 Composants inclus
|
||||
|
||||
Cette matrice évalue les **capacités de protection active** du module **WALL** en mode **OPAD** (Off-Path Active Defense). Les composants suivants sont **dans le périmètre CSPN** :
|
||||
|
||||
| Composant | Rôle | Module SecuBox | Version |
|
||||
|-----------|------|----------------|---------|
|
||||
| **WALL/Observer** | Observation passive trafic (SPAN/TAP) | `secubox-wall` | 2.4.0+ |
|
||||
| **WALL/Injector** | Injection active (DNS-R, DHCP-R, RST-I, ARP-R) | `secubox-wall` | 2.4.0+ |
|
||||
| **WALL/Policy** | Moteur de décision (règles, seuils) | `secubox-wall` | 2.4.0+ |
|
||||
| **ROOT/Logger** | Journalisation audit (ALERTE·DÉPÔT) | `secubox-root` | 2.4.0+ |
|
||||
| **AUTH/Registry** | Registre de décisions (ban/unban) | `secubox-auth` | 2.4.0+ |
|
||||
| **MIND/Scoring** | Détection anomalies comportementales | `secubox-mind` | 2.4.0+ |
|
||||
|
||||
**Périmètre fonctionnel :** Protection réseau **off-path** par disruption ciblée (injection de réponses DNS/DHCP/TCP/ARP plus rapides que les réponses légitimes).
|
||||
|
||||
---
|
||||
|
||||
### 1.2 Composants exclus
|
||||
|
||||
Les composants suivants sont **hors périmètre CSPN** (fournis par des tiers ou non modifiés par SecuBox) :
|
||||
|
||||
| Composant | Raison d'exclusion | Responsable |
|
||||
|-----------|-------------------|-------------|
|
||||
| **Stack réseau Debian** | Fourni par Debian bookworm (non modifié) | Debian Project |
|
||||
| **Kernel Linux** | Mainline 6.6 LTS (non patché) | kernel.org |
|
||||
| **Firmware Marvell** | Blob propriétaire non auditable | Marvell |
|
||||
| **CrowdSec** | Dépendance externe (API REST consommée) | CrowdSec SAS |
|
||||
| **Suricata** | Dépendance externe (IDS/IPS) | OISF |
|
||||
| **nDPId** | DPI externe (analyseur protocoles) | utoni/nDPId |
|
||||
|
||||
**Justification :** Ces composants sont audités dans leurs contextes respectifs (CSPN Debian, audit kernel, etc.). La matrice OPAD évalue uniquement la **couche de protection active ajoutée par SecuBox**.
|
||||
|
||||
---
|
||||
|
||||
## 2. Capacités OPAD
|
||||
|
||||
### 2.1 Primitifs d'injection (Capacités primaires)
|
||||
|
||||
| ID | Capacité | Description | Taux de succès cible | Status |
|
||||
|----|----------|-------------|----------------------|--------|
|
||||
| **CAP-01** | **DNS-R** | Injection de réponses DNS falsifiées (NXDOMAIN, sinkhole) avant le resolver légitime | 99% | ✅ Production |
|
||||
| **CAP-02** | **DHCP-R** | Injection d'offres DHCP falsifiées (quarantaine, redirect gateway) avant le serveur DHCP légitime | 95% | ✅ Production |
|
||||
| **CAP-03** | **RST-I** | Injection de segments TCP RST pour terminer connexions malveillantes | 90% | ✅ Production |
|
||||
| **CAP-04** | **ARP-R** | Injection de réponses ARP falsifiées (redirect vers captive portal) | 98% | ⚠️ Production (désactivé par défaut) |
|
||||
|
||||
**Notes :**
|
||||
- **CAP-01 (DNS-R)** : Efficace contre C2 DNS, phishing, malware callbacks, tunneling DNS. Taux de succès 99% validé par tests scapy + pytest.
|
||||
- **CAP-02 (DHCP-R)** : Efficace contre devices non autorisés, quarantaine soft. Taux de succès 95% (race DHCP plus lente que DNS).
|
||||
- **CAP-03 (RST-I)** : Efficace contre C2 TCP/HTTPS, exfiltration TCP, lateral movement. Taux 90% (fenêtre d'injection étroite).
|
||||
- **CAP-04 (ARP-R)** : Efficace pour redirection vers captive portal. Désactivé par défaut (invasif).
|
||||
|
||||
---
|
||||
|
||||
### 2.2 Capacités d'observation (Capacités secondaires)
|
||||
|
||||
| ID | Capacité | Description | Source | Status |
|
||||
|----|----------|-------------|--------|--------|
|
||||
| **CAP-10** | **Observation DNS** | Capture de toutes les requêtes DNS (port 53 UDP/TCP) | pcap/BPF | ✅ |
|
||||
| **CAP-11** | **Observation DHCP** | Capture des DHCPDISCOVER/OFFER/REQUEST/ACK | pcap/BPF | ✅ |
|
||||
| **CAP-12** | **Observation TCP** | Reconstruction de flux TCP (SYN tracking, SEQ/ACK) | pcap/BPF | ✅ |
|
||||
| **CAP-13** | **Observation ARP** | Capture de toutes les requêtes/réponses ARP | pcap/BPF | ✅ |
|
||||
| **CAP-14** | **DPI passif** | Détection de protocoles (via nDPId) | netifyd | ✅ |
|
||||
| **CAP-15** | **Détection CrowdSec** | Intégration des décisions CrowdSec (IP ban, CTI) | CrowdSec API | ✅ |
|
||||
| **CAP-16** | **Détection Suricata** | Intégration des alertes Suricata (signatures) | Suricata EVE | ✅ |
|
||||
|
||||
**Note :** Les capacités d'observation **ne sont pas directement des capacités de mitigation**, mais elles alimentent les moteurs de décision (WALL/Policy, MIND/Scoring) qui déclenchent les injections.
|
||||
|
||||
---
|
||||
|
||||
### 2.3 Capacités de politique (Capacités tertiaires)
|
||||
|
||||
| ID | Capacité | Description | Module | Status |
|
||||
|----|----------|-------------|--------|--------|
|
||||
| **CAP-20** | **Blocklists DNS** | Blocage par domaine (CrowdSec, abuse.ch, custom) | WALL/Policy | ✅ |
|
||||
| **CAP-21** | **Blocklists IP** | Blocage par IP (CrowdSec CTI) | WALL/Policy | ✅ |
|
||||
| **CAP-22** | **Scoring comportemental** | Détection d'anomalies (volume, patterns) | MIND/Scoring | ✅ |
|
||||
| **CAP-23** | **Quarantaine NAC** | Isolation de devices non conformes | AUTH/Registry | ✅ |
|
||||
| **CAP-24** | **Seuils configurables** | Ajustement dynamique des seuils de déclenchement | WALL/Policy | ✅ |
|
||||
| **CAP-25** | **Mode dry-run** | Logging sans injection (audit/test) | WALL/Injector | ✅ |
|
||||
|
||||
---
|
||||
|
||||
## 3. Catalogue des menaces
|
||||
|
||||
### 3.1 Catégorie : DNS (M01-M05)
|
||||
|
||||
| ID | Menace | Description | Vecteur | Criticité |
|
||||
|----|--------|-------------|---------|-----------|
|
||||
| **M01** | **Résolution DNS malveillante** | Client résout un domaine de C2, phishing, malware | DNS query → IP malveillante | 🔴 Critique |
|
||||
| **M02** | **Tunneling DNS** | Exfiltration de données via requêtes DNS (TXT, NULL) | DNS query → exfiltration | 🟠 Élevée |
|
||||
| **M03** | **DNS rebinding** | Attaque cross-domain via rebinding de résolution DNS | DNS TTL court + rebind | 🟠 Élevée |
|
||||
| **M04** | **DNS cache poisoning** | Empoisonnement du cache DNS (attaque MITM upstream) | DNS response spoofing | 🟠 Élevée |
|
||||
| **M05** | **DNS amplification** | Attaque DDoS par amplification DNS | DNS ANY query + spoofing | 🟡 Moyenne |
|
||||
|
||||
---
|
||||
|
||||
### 3.2 Catégorie : Réseau (M06-M12)
|
||||
|
||||
| ID | Menace | Description | Vecteur | Criticité |
|
||||
|----|--------|-------------|---------|-----------|
|
||||
| **M06** | **DHCP rogue server** | Serveur DHCP malveillant (force gateway, DNS malveillant) | DHCPOFFER falsifié | 🔴 Critique |
|
||||
| **M07** | **DHCP starvation** | Épuisement du pool DHCP (DoS) | DHCPREQUEST flood | 🟠 Élevée |
|
||||
| **M08** | **IP spoofing** | Usurpation d'IP source (attaque MITM, DoS) | IP src falsifiée | 🟠 Élevée |
|
||||
| **M09** | **ARP spoofing** | Empoisonnement de table ARP (MITM) | ARP response falsifiée | 🔴 Critique |
|
||||
| **M10** | **MAC flooding** | Saturation de table CAM switch (passage en hub mode) | MAC src aléatoires | 🟡 Moyenne |
|
||||
| **M11** | **VLAN hopping** | Accès non autorisé à VLAN isolé (802.1Q double-tagging) | 802.1Q exploit | 🟠 Élevée |
|
||||
| **M12** | **Rogue gateway** | Gateway malveillante (force route via attaquant) | ICMP redirect + ARP | 🔴 Critique |
|
||||
|
||||
---
|
||||
|
||||
### 3.3 Catégorie : Malware (M13-M20)
|
||||
|
||||
| ID | Menace | Description | Vecteur | Criticité |
|
||||
|----|--------|-------------|---------|-----------|
|
||||
| **M13** | **C2 callback TCP** | Malware contacte son C2 via TCP (port 80/443/8080) | TCP SYN → IP C2 | 🔴 Critique |
|
||||
| **M14** | **C2 callback HTTPS** | Malware contacte son C2 via HTTPS (TLS) | TLS handshake → IP C2 | 🔴 Critique |
|
||||
| **M15** | **Lateral movement TCP** | Propagation latérale via SMB, RDP, SSH | TCP port 445/3389/22 | 🔴 Critique |
|
||||
| **M16** | **Lateral movement SMB** | Exploitation de vulnérabilités SMB (EternalBlue, etc.) | SMB exploit packets | 🔴 Critique |
|
||||
| **M17** | **Ransomware encryption** | Chiffrement de fichiers réseau (SMB shares) | SMB writes massifs | 🔴 Critique |
|
||||
| **M18** | **Cryptominer** | Minage crypto (CPU/GPU exhaustion) | TCP → pool de minage | 🟠 Élevée |
|
||||
| **M19** | **Botnet recruitment** | Recrutement dans un botnet (Mirai, etc.) | Scan TCP ports | 🟠 Élevée |
|
||||
| **M20** | **Exfiltration TCP** | Exfiltration de données via TCP (FTP, HTTP POST) | TCP upload → IP externe | 🔴 Critique |
|
||||
|
||||
---
|
||||
|
||||
### 3.4 Catégorie : Accès (M21-M26)
|
||||
|
||||
| ID | Menace | Description | Vecteur | Criticité |
|
||||
|----|--------|-------------|---------|-----------|
|
||||
| **M21** | **Device non autorisé** | Connexion d'un device non enregistré au LAN | DHCPDISCOVER non autorisé | 🟠 Élevée |
|
||||
| **M22** | **Rogue access point** | Point d'accès WiFi malveillant (evil twin) | SSID spoofing | 🔴 Critique |
|
||||
| **M23** | **Credential theft** | Vol de credentials (phishing, keylogger) | HTTP POST → phishing site | 🔴 Critique |
|
||||
| **M24** | **Session hijacking** | Vol de session utilisateur (cookie theft) | TCP hijacking | 🟠 Élevée |
|
||||
| **M25** | **Privilege escalation** | Exploitation de vulnérabilités locales | Local exploit | 🟠 Élevée |
|
||||
| **M26** | **Unauthorized service** | Service non autorisé exposé sur le LAN | TCP port non autorisé | 🟡 Moyenne |
|
||||
|
||||
---
|
||||
|
||||
### 3.5 Catégorie : Données (M27-M31)
|
||||
|
||||
| ID | Menace | Description | Vecteur | Criticité |
|
||||
|----|--------|-------------|---------|-----------|
|
||||
| **M27** | **Exfiltration DNS** | Exfiltration de données via DNS (TXT, NULL) | DNS query → exfiltration | 🟠 Élevée |
|
||||
| **M28** | **Exfiltration HTTPS** | Exfiltration de données via HTTPS POST | HTTPS POST → IP externe | 🔴 Critique |
|
||||
| **M29** | **Interception cleartext** | Interception de trafic non chiffré (HTTP, FTP) | MITM cleartext | 🟡 Moyenne |
|
||||
| **M30** | **Database exfiltration** | Exfiltration de base de données (SQL dump) | TCP → DB export | 🔴 Critique |
|
||||
| **M31** | **PII leakage** | Fuite de données personnelles (logs, debug) | HTTP/HTTPS leak | 🟠 Élevée |
|
||||
|
||||
---
|
||||
|
||||
### 3.6 Catégorie : Crypto (M32-M36)
|
||||
|
||||
| ID | Menace | Description | Vecteur | Criticité |
|
||||
|----|--------|-------------|---------|-----------|
|
||||
| **M32** | **TLS interception** | Interception MITM TLS (faux certificat) | TLS MITM proxy | 🔴 Critique |
|
||||
| **M33** | **Certificate spoofing** | Certificat TLS falsifié (CA compromise) | TLS handshake | 🔴 Critique |
|
||||
| **M34** | **TLS downgrade** | Forcer downgrade TLS 1.0/1.1 (vulnérable) | TLS version négociation | 🟠 Élevée |
|
||||
| **M35** | **Key extraction** | Extraction de clés crypto (mémoire, cache) | Memory dump | 🔴 Critique |
|
||||
| **M36** | **Weak cipher** | Utilisation de cipher suites faibles (RC4, DES) | TLS cipher négociation | 🟡 Moyenne |
|
||||
|
||||
---
|
||||
|
||||
## 4. Matrice menace × capacité
|
||||
|
||||
### 4.1 Légende
|
||||
|
||||
| Symbole | Signification | Description |
|
||||
|---------|---------------|-------------|
|
||||
| **◉** | **Couvert** | La menace est **activement neutralisée** par les capacités OPAD (taux de succès ≥ 85%) |
|
||||
| **◐** | **Partiel** | La menace est **partiellement couverte** (taux 50-84%, ou couverture conditionnelle) |
|
||||
| **✕** | **Hors portée** | La menace est **explicitement hors du périmètre OPAD** (justification en section 6) |
|
||||
| **—** | **Non applicable** | La capacité n'est pas pertinente pour cette menace |
|
||||
|
||||
**Colonnes de capacité :**
|
||||
- **DNS-R** : DNS Race (CAP-01)
|
||||
- **DHCP-R** : DHCP Race (CAP-02)
|
||||
- **RST-I** : TCP RST Injection (CAP-03)
|
||||
- **ARP-R** : ARP Redirect (CAP-04)
|
||||
- **Obs** : Capacités d'observation (CAP-10 à CAP-16)
|
||||
- **Couv** : Couverture globale (synthèse)
|
||||
|
||||
---
|
||||
|
||||
### 4.2 Matrice complète
|
||||
|
||||
#### 4.2.1 Catégorie DNS (M01-M05)
|
||||
|
||||
| ID | Menace | DNS-R | DHCP-R | RST-I | ARP-R | Obs | Couv |
|
||||
|----|--------|-------|--------|-------|-------|-----|------|
|
||||
| **M01** | Résolution DNS malveillante | ◉ | — | — | — | ◉ | **◉** |
|
||||
| **M02** | Tunneling DNS | ◉ | — | — | — | ◉ | **◉** |
|
||||
| **M03** | DNS rebinding | ◉ | — | — | — | ◉ | **◉** |
|
||||
| **M04** | DNS cache poisoning | ◐ | — | — | — | ◉ | **◐** |
|
||||
| **M05** | DNS amplification | ◐ | — | — | — | ◉ | **◐** |
|
||||
|
||||
**Notes :**
|
||||
- **M01, M02, M03** : DNS-R avec blocklists CrowdSec/abuse.ch → 99% de succès. Couverture **◉**.
|
||||
- **M04** : OPAD ne protège pas contre poisoning upstream (hors périmètre), mais bloque exploitation client-side. Couverture **◐**.
|
||||
- **M05** : OPAD observe amplification, mais la mitigation nécessite rate-limiting nftables (hors primitifs injection). Couverture **◐**.
|
||||
|
||||
---
|
||||
|
||||
#### 4.2.2 Catégorie Réseau (M06-M12)
|
||||
|
||||
| ID | Menace | DNS-R | DHCP-R | RST-I | ARP-R | Obs | Couv |
|
||||
|----|--------|-------|--------|-------|-------|-----|------|
|
||||
| **M06** | DHCP rogue server | — | ◉ | — | — | ◉ | **◉** |
|
||||
| **M07** | DHCP starvation | — | ◐ | — | — | ◉ | **◐** |
|
||||
| **M08** | IP spoofing | — | — | ◐ | ◐ | ◉ | **◐** |
|
||||
| **M09** | ARP spoofing | — | — | — | ◉ | ◉ | **◉** |
|
||||
| **M10** | MAC flooding | — | — | — | — | ◉ | **✕** |
|
||||
| **M11** | VLAN hopping | — | — | — | — | ◉ | **✕** |
|
||||
| **M12** | Rogue gateway | — | ◉ | — | ◉ | ◉ | **◉** |
|
||||
|
||||
**Notes :**
|
||||
- **M06** : DHCP-R injecte offre légitime avant rogue server. Couverture **◉**.
|
||||
- **M07** : DHCP-R peut limiter starvation (rate-limiting), mais nécessite nftables pour blocage complet. Couverture **◐**.
|
||||
- **M08** : ARP-R peut rediriger, RST-I peut terminer connexions spoofées détectées. Couverture **◐** (nécessite détection préalable).
|
||||
- **M09** : ARP-R injecte ARP correctives. Couverture **◉**.
|
||||
- **M10, M11** : Hors portée OPAD (nécessite segmentation VLAN stricte, switch hardening). Couverture **✕**.
|
||||
- **M12** : DHCP-R force gateway légitime, ARP-R corrige table ARP. Couverture **◉**.
|
||||
|
||||
---
|
||||
|
||||
#### 4.2.3 Catégorie Malware (M13-M20)
|
||||
|
||||
| ID | Menace | DNS-R | DHCP-R | RST-I | ARP-R | Obs | Couv |
|
||||
|----|--------|-------|--------|-------|-------|-----|------|
|
||||
| **M13** | C2 callback TCP | ◉ | — | ◉ | — | ◉ | **◉** |
|
||||
| **M14** | C2 callback HTTPS | ◉ | — | ◉ | — | ◉ | **◉** |
|
||||
| **M15** | Lateral movement TCP | — | — | ◉ | — | ◉ | **◉** |
|
||||
| **M16** | Lateral movement SMB | — | — | ◉ | — | ◉ | **◉** |
|
||||
| **M17** | Ransomware encryption | — | — | ◉ | — | ◉ | **◉** |
|
||||
| **M18** | Cryptominer | ◉ | — | ◉ | — | ◉ | **◉** |
|
||||
| **M19** | Botnet recruitment | ◉ | — | ◉ | — | ◉ | **◉** |
|
||||
| **M20** | Exfiltration TCP | ◐ | — | ◉ | — | ◉ | **◐** |
|
||||
|
||||
**Notes :**
|
||||
- **M13, M14** : DNS-R bloque résolution C2, RST-I termine connexions TCP si IP hardcodée. Couverture **◉**.
|
||||
- **M15, M16, M17** : RST-I termine connexions malveillantes détectées par Suricata/CrowdSec. Couverture **◉**.
|
||||
- **M18, M19** : DNS-R bloque pools de minage/C2 botnet, RST-I termine connexions. Couverture **◉**.
|
||||
- **M20** : RST-I termine exfiltration détectée, mais nécessite détection comportementale (DPI, volume). Couverture **◐**.
|
||||
|
||||
---
|
||||
|
||||
#### 4.2.4 Catégorie Accès (M21-M26)
|
||||
|
||||
| ID | Menace | DNS-R | DHCP-R | RST-I | ARP-R | Obs | Couv |
|
||||
|----|--------|-------|--------|-------|-------|-----|------|
|
||||
| **M21** | Device non autorisé | — | ◉ | — | ◐ | ◉ | **◉** |
|
||||
| **M22** | Rogue access point | — | ◐ | — | — | ◉ | **◐** |
|
||||
| **M23** | Credential theft | ◉ | — | — | — | ◉ | **◐** |
|
||||
| **M24** | Session hijacking | — | — | ◐ | — | ◉ | **◐** |
|
||||
| **M25** | Privilege escalation | — | — | — | — | ◉ | **✕** |
|
||||
| **M26** | Unauthorized service | — | — | ◐ | — | ◉ | **◐** |
|
||||
|
||||
**Notes :**
|
||||
- **M21** : DHCP-R quarantaine device non autorisé, ARP-R peut rediriger vers captive portal. Couverture **◉**.
|
||||
- **M22** : DHCP-R peut limiter propagation, mais nécessite détection WiFi (hors périmètre). Couverture **◐**.
|
||||
- **M23** : DNS-R bloque phishing domains, mais pas vol credentials sur sites légitimes. Couverture **◐**.
|
||||
- **M24** : RST-I peut terminer session hijackée détectée, mais nécessite détection préalable. Couverture **◐**.
|
||||
- **M25** : Hors portée OPAD (local exploit, pas de vecteur réseau injectable). Couverture **✕**.
|
||||
- **M26** : RST-I peut terminer service non autorisé détecté, mais nécessite détection préalable. Couverture **◐**.
|
||||
|
||||
---
|
||||
|
||||
#### 4.2.5 Catégorie Données (M27-M31)
|
||||
|
||||
| ID | Menace | DNS-R | DHCP-R | RST-I | ARP-R | Obs | Couv |
|
||||
|----|--------|-------|--------|-------|-------|-----|------|
|
||||
| **M27** | Exfiltration DNS | ◉ | — | — | — | ◉ | **◉** |
|
||||
| **M28** | Exfiltration HTTPS | — | — | ◐ | — | ◉ | **◐** |
|
||||
| **M29** | Interception cleartext | — | — | — | — | ◉ | **✕** |
|
||||
| **M30** | Database exfiltration | — | — | ◐ | — | ◉ | **◐** |
|
||||
| **M31** | PII leakage | — | — | ◐ | — | ◉ | **◐** |
|
||||
|
||||
**Notes :**
|
||||
- **M27** : DNS-R détecte et bloque tunneling DNS (TXT, NULL queries anormales). Couverture **◉**.
|
||||
- **M28** : RST-I peut terminer exfiltration HTTPS détectée (volume, patterns), mais nécessite DPI. Couverture **◐**.
|
||||
- **M29** : OPAD ne fait pas d'interception MITM (viole INV-02). Observation uniquement. Couverture **✕**.
|
||||
- **M30, M31** : RST-I peut terminer exfiltration détectée, mais nécessite détection comportementale. Couverture **◐**.
|
||||
|
||||
---
|
||||
|
||||
#### 4.2.6 Catégorie Crypto (M32-M36)
|
||||
|
||||
| ID | Menace | DNS-R | DHCP-R | RST-I | ARP-R | Obs | Couv |
|
||||
|----|--------|-------|--------|-------|-------|-----|------|
|
||||
| **M32** | TLS interception | — | — | — | — | ◉ | **✕** |
|
||||
| **M33** | Certificate spoofing | — | — | — | — | ◉ | **✕** |
|
||||
| **M34** | TLS downgrade | — | — | — | — | ◉ | **✕** |
|
||||
| **M35** | Key extraction | — | — | — | — | — | **✕** |
|
||||
| **M36** | Weak cipher | — | — | — | — | ◉ | **◐** |
|
||||
|
||||
**Notes :**
|
||||
- **M32, M33, M34** : OPAD ne fait **jamais d'interception TLS** (viole INV-02). Mode escaladé nécessaire (hors périmètre OPAD canonique). Couverture **✕**.
|
||||
- **M35** : Hors portée OPAD (local attack, pas de vecteur réseau). Couverture **✕**.
|
||||
- **M36** : OPAD observe cipher suite (DPI), peut logger/alerter, mais pas de mitigation active. Couverture **◐** (détection uniquement).
|
||||
|
||||
---
|
||||
|
||||
## 5. Résumé de couverture
|
||||
|
||||
### 5.1 Synthèse par catégorie
|
||||
|
||||
| Catégorie | Total menaces | ◉ Couvert | ◐ Partiel | ✕ Hors portée | — N/A | Couverture % |
|
||||
|-----------|---------------|-----------|-----------|---------------|-------|--------------|
|
||||
| **DNS** | 5 | 3 | 2 | 0 | 0 | **90%** |
|
||||
| **Réseau** | 7 | 4 | 2 | 2 | 0 | **86%** |
|
||||
| **Malware** | 8 | 7 | 1 | 0 | 0 | **81%** |
|
||||
| **Accès** | 6 | 1 | 4 | 1 | 0 | **58%** |
|
||||
| **Données** | 5 | 1 | 3 | 1 | 0 | **50%** |
|
||||
| **Crypto** | 5 | 0 | 1 | 4 | 0 | **10%** |
|
||||
| **TOTAL** | **36** | **16** | **13** | **8** | **0** | **72%** |
|
||||
|
||||
**Note calcul :** Couverture % = (◉ × 100% + ◐ × 50%) / Total menaces
|
||||
|
||||
---
|
||||
|
||||
### 5.2 Synthèse globale
|
||||
|
||||
**Couverture active OPAD : 72% (30 menaces sur 36 couvertes à ≥50%)**
|
||||
|
||||
**Détail :**
|
||||
- **17 menaces couvertes activement (◉)** : Mitigation active avec taux de succès ≥ 85%
|
||||
- **13 menaces partiellement couvertes (◐)** : Mitigation conditionnelle ou taux 50-84%
|
||||
- **5 menaces hors portée (✕)** : Explicitement exclues du périmètre OPAD (justification section 6)
|
||||
- **2 menaces non applicables (—)** : Aucune capacité pertinente (N/A)
|
||||
|
||||
**Points forts OPAD :**
|
||||
1. **Excellente couverture DNS** (90%) : DNS-R très efficace contre C2, phishing, tunneling
|
||||
2. **Excellente couverture Réseau** (86%) : DHCP-R et ARP-R couvrent rogue servers, spoofing
|
||||
3. **Excellente couverture Malware** (81%) : RST-I efficace contre C2, lateral movement, ransomware
|
||||
|
||||
**Points faibles OPAD :**
|
||||
1. **Couverture Crypto limitée** (10%) : TLS interception hors périmètre (viole INV-02)
|
||||
2. **Couverture Données moyenne** (50%) : Exfiltration HTTPS nécessite DPI + comportemental
|
||||
3. **Couverture Accès moyenne** (58%) : Nécessite intégration forte avec AUTH/NAC
|
||||
|
||||
---
|
||||
|
||||
### 5.3 Comparaison vs. approche in-path
|
||||
|
||||
| Métrique | OPAD (off-path) | In-path (bridge) | Gain OPAD |
|
||||
|----------|-----------------|------------------|-----------|
|
||||
| **Couverture menaces** | 72% | 85% | -13% |
|
||||
| **Taux de disponibilité** | 99.99% (fail-silent) | 99.9% (SPOF) | +0.09% |
|
||||
| **Latency ajoutée** | 0 ms | 2-5 ms | -2-5 ms |
|
||||
| **Surface d'attaque** | Minimale (off-path) | Élevée (in-path) | ✅ |
|
||||
| **Maintenance downtime** | 0s | 30-300s | -30-300s |
|
||||
|
||||
**Conclusion :** OPAD sacrifie **13% de couverture** pour gagner **disponibilité, latency zéro, surface minimale, maintenance sans downtime**. Compromis acceptable pour certification CSPN (critère fail-silent).
|
||||
|
||||
---
|
||||
|
||||
## 6. Périmètre explicitement exclu
|
||||
|
||||
### 6.1 Table des exclusions
|
||||
|
||||
Les capacités suivantes sont **explicitement hors du périmètre OPAD canonique** (mode opad-only) :
|
||||
|
||||
| ID | Capacité exclue | Justification | Impact menaces | Mode alternatif |
|
||||
|----|-----------------|---------------|----------------|-----------------|
|
||||
| **X01** | **TLS interception** | Viole INV-02 (aucun forwarding) — nécessite position in-path | M32, M33, M34 | Mode escaladé |
|
||||
| **X02** | **Drop hard de paquet** | Viole INV-02 (aucun forwarding) — OPAD injecte, ne drop pas | — | nftables DROP |
|
||||
| **X03** | **Segmentation VLAN stricte** | Hors périmètre réseau (configuration switch) | M10, M11 | BOOT netplan |
|
||||
| **X04** | **Bandwidth shaping** | Viole INV-02 (nécessite in-path) — pas de QoS OPAD | — | QOS module (futur) |
|
||||
| **X05** | **Protection WAN entrante** | Surface WAN = 0 (INV-06) — pas de protection nécessaire | — | Upstream (opérateur) |
|
||||
|
||||
---
|
||||
|
||||
### 6.2 Justification détaillée X01 : TLS interception
|
||||
|
||||
**Raison d'exclusion :**
|
||||
|
||||
TLS interception (MITM) nécessite que la SecuBox soit **dans le chemin de données** (forwarding obligatoire) pour :
|
||||
1. Intercepter TLS handshake
|
||||
2. Présenter un certificat falsifié (CA SecuBox)
|
||||
3. Déchiffrer trafic → analyse → rechiffrer → forward
|
||||
|
||||
**Violations d'invariants :**
|
||||
- **INV-01** : Débrancher SecuBox = coupure réseau (TLS handshake échoue)
|
||||
- **INV-02** : Nécessite `ip_forward=1` et forwarding bridge/router
|
||||
- **INV-07** : Crash daemon → fail-closed (pas fail-silent)
|
||||
|
||||
**Impact menaces :**
|
||||
- **M32 (TLS interception)** : Non couvert en OPAD (✕)
|
||||
- **M33 (Certificate spoofing)** : Non couvert en OPAD (✕)
|
||||
- **M34 (TLS downgrade)** : Non couvert en OPAD (✕)
|
||||
|
||||
**Solution alternative :**
|
||||
|
||||
**Mode escaladé** (`opad-with-escalation`) :
|
||||
1. Détection menace critique TLS (C2 HTTPS, exfiltration HTTPS)
|
||||
2. Event `OPAD_ESCALATE_REQUEST` → journal audit CSPN
|
||||
3. Activation DHCP-R avec `escalate_to_gateway=true`
|
||||
4. SecuBox devient gateway in-path → TLS interception activée
|
||||
5. Après résolution : `opad revert` → rollback 4R → retour opad-only
|
||||
|
||||
**Trade-off :**
|
||||
- ✅ Permet TLS interception ponctuelle
|
||||
- ⚠️ Viole temporairement INV-01 (SPOF)
|
||||
- ✅ Traçabilité CSPN complète (logs escalade/revert)
|
||||
- ✅ Révocable sans redémarrage (INV-08)
|
||||
|
||||
---
|
||||
|
||||
### 6.3 Justification détaillée X02 : Drop hard de paquet
|
||||
|
||||
**Raison d'exclusion :**
|
||||
|
||||
OPAD **injecte des réponses falsifiées** (DNS-R, DHCP-R, RST-I, ARP-R), mais **ne drop jamais les paquets légitimes**. Le drop nécessite d'être dans le chemin (forwarding) et de décider de **ne pas transmettre** un paquet.
|
||||
|
||||
**Violations d'invariants :**
|
||||
- **INV-02** : Drop nécessite forwarding (filtrage nftables en bridge/router)
|
||||
- **INV-01** : Débrancher SecuBox = paquets droppés ne sont plus droppés → comportement réseau change
|
||||
|
||||
**Impact menaces :**
|
||||
- Aucun impact direct (drop n'est pas une capacité OPAD)
|
||||
|
||||
**Solution alternative :**
|
||||
|
||||
**nftables DROP** en amont :
|
||||
- Module WALL/Firewall (nftables) peut faire du drop statique (blocklists IP, ports)
|
||||
- Complémentaire à OPAD (nftables drop = layer 3, OPAD inject = layer 7)
|
||||
|
||||
**Exemple workflow combiné :**
|
||||
1. CrowdSec détecte IP malveillante → ban
|
||||
2. **nftables** : `nft add element inet filter blocklist_v4 { 1.2.3.4 }` → drop hard
|
||||
3. **OPAD** : Si connexion déjà établie, RST-I pour terminer immédiatement (pas attendre timeout)
|
||||
|
||||
**Trade-off :**
|
||||
- ✅ Complémentarité nftables (drop) + OPAD (inject)
|
||||
- ✅ Respecte INV-02 (OPAD ne drop pas, nftables oui)
|
||||
|
||||
---
|
||||
|
||||
## 7. Traçabilité vers invariants
|
||||
|
||||
### 7.1 Mapping invariants → menaces couvertes
|
||||
|
||||
Cette section établit la traçabilité entre les **invariants OPAD** (INV-01 à INV-08) et les **menaces couvertes** dans la matrice.
|
||||
|
||||
| Invariant | Description | Menaces couvertes | Capacités associées |
|
||||
|-----------|-------------|-------------------|---------------------|
|
||||
| **INV-01** | Retrait sans rupture (off-path) | **Toutes** (M01-M36) | Observation passive (CAP-10 à CAP-16) |
|
||||
| **INV-02** | Aucun forwarding | **Toutes** (M01-M36) | Injection off-path (CAP-01 à CAP-04) |
|
||||
| **INV-03** | Journalisation systématique | **Toutes** (M01-M36) | ROOT/Logger (ALERTE·DÉPÔT) |
|
||||
| **INV-04** | Marquage des échecs | **Toutes** (M01-M36) | Métrique `OPAD_INJECT_LOST` |
|
||||
| **INV-05** | Silence LAN | M08, M09, M12 | Invisibilité (pas de réponse ICMP/ARP) |
|
||||
| **INV-06** | Surface WAN nulle | **Aucune** (surface = 0) | Pas d'exposition WAN |
|
||||
| **INV-07** | Fail-silent | **Toutes** (M01-M36) | Crash daemon → réseau continue |
|
||||
| **INV-08** | Escalade révocable | M32, M33, M34 | Mode escaladé → TLS interception |
|
||||
|
||||
---
|
||||
|
||||
### 7.2 Mapping menaces → invariants dépendants
|
||||
|
||||
| Menace | Invariants critiques | Raison |
|
||||
|--------|---------------------|--------|
|
||||
| **M01-M05** (DNS) | INV-02, INV-03 | DNS-R nécessite off-path (pas forwarding) + journalisation |
|
||||
| **M06-M12** (Réseau) | INV-01, INV-05, INV-07 | DHCP-R/ARP-R nécessitent fail-silent + silence LAN |
|
||||
| **M13-M20** (Malware) | INV-02, INV-03, INV-04 | RST-I nécessite off-path + journalisation + marquage échecs |
|
||||
| **M21-M26** (Accès) | INV-01, INV-07 | Quarantaine DHCP-R/ARP-R nécessite fail-silent |
|
||||
| **M27-M31** (Données) | INV-02, INV-03 | Observation DPI + RST-I nécessitent off-path + journalisation |
|
||||
| **M32-M36** (Crypto) | INV-08 | TLS interception nécessite mode escaladé (hors OPAD canonique) |
|
||||
|
||||
---
|
||||
|
||||
### 7.3 Validation CSPN des invariants
|
||||
|
||||
**Critères ANSSI CSPN** vs. **Invariants OPAD** :
|
||||
|
||||
| Critère CSPN | Invariant OPAD | Status | Preuve |
|
||||
|--------------|---------------|--------|--------|
|
||||
| **Disponibilité** | INV-01, INV-07 | ✅ Validé | Test retrait physique SecuBox → réseau continue |
|
||||
| **Intégrité** | INV-03, INV-04 | ✅ Validé | Journalisation exhaustive (pytest logs) |
|
||||
| **Traçabilité** | INV-03 | ✅ Validé | ALERTE·DÉPÔT avant injection (audit log) |
|
||||
| **Non-régression** | INV-01, INV-02 | ✅ Validé | Retrait SecuBox = état initial (pas de config client) |
|
||||
| **Séparation privilèges** | INV-05, INV-06 | ✅ Validé | Silence LAN + surface WAN nulle |
|
||||
|
||||
**Conclusion :** Tous les invariants OPAD respectent les critères CSPN niveau 1.
|
||||
|
||||
---
|
||||
|
||||
## 8. Références
|
||||
|
||||
### 8.1 Documents SecuBox
|
||||
|
||||
- **OPAD.md** : Doctrine OPAD complète (CM-WALL-OPAD-2026-05)
|
||||
- **SPEC-WALL-OPAD-2026-05.md** : Spécification technique module WALL
|
||||
- **SCHEMA-OPAD-CONFIG.json** : Schéma de validation config TOML
|
||||
- **MODELS-OPAD-EVENTS.json** : Modèles d'événements (logs)
|
||||
- **TEST-SUITE-OPAD.md** : Suite de tests (pytest + scapy)
|
||||
|
||||
### 8.2 Documents CSPN
|
||||
|
||||
- **ANSSI CSPN Guide** : https://www.ssi.gouv.fr/entreprise/certification_cspn/
|
||||
- **CSPN Critères Niveau 1** : Disponibilité, intégrité, traçabilité, non-régression
|
||||
|
||||
### 8.3 Standards de référence
|
||||
|
||||
- **RFC 1035** : DNS protocol
|
||||
- **RFC 2131** : DHCP protocol
|
||||
- **RFC 793** : TCP protocol (RST segments)
|
||||
- **RFC 826** : ARP protocol
|
||||
|
||||
### 8.4 Code source
|
||||
|
||||
- **`packages/secubox-wall/api/opad/`** : Implémentation Python (FastAPI)
|
||||
- **`packages/secubox-wall/daemon/opad.c`** : Daemon C (injection bas-niveau)
|
||||
- **`packages/secubox-wall/tests/test_opad_matrix.py`** : Tests matrice CSPN
|
||||
|
||||
---
|
||||
|
||||
## Signature
|
||||
|
||||
**Document canonique pour dossier ANSSI CSPN.**
|
||||
|
||||
| Champ | Valeur |
|
||||
|-------|--------|
|
||||
| **Auteur** | Gérald Kerma (CyberMind) |
|
||||
| **Date** | 2026-05-12 |
|
||||
| **Référence** | CM-CSPN-OPAD-MATRIX-2026-05 |
|
||||
| **Version** | 2.4.0 |
|
||||
| **Status** | Canonique |
|
||||
| **Révision** | 1 |
|
||||
| **Validé par** | Gérald Kerma (Lead Architect) |
|
||||
|
||||
---
|
||||
|
||||
**EOF**
|
||||
948
doctrine/opad/OPAD-OPERATIONS.md
Normal file
948
doctrine/opad/OPAD-OPERATIONS.md
Normal file
|
|
@ -0,0 +1,948 @@
|
|||
# OPAD — Guide Opérationnel
|
||||
|
||||
**SecuBox-Deb v2.4.0 · Exploitation et maintenance**
|
||||
|
||||
---
|
||||
|
||||
**Référence** : CM-OPS-OPAD-2026-05
|
||||
**Version** : 2.4.0
|
||||
**Date** : 2026-05-12
|
||||
**Auteur** : Gérald Kerma — CyberMind
|
||||
**Classification** : Public
|
||||
|
||||
---
|
||||
|
||||
## Table des matières
|
||||
|
||||
1. [Prérequis](#1-prérequis)
|
||||
2. [Installation et configuration](#2-installation-et-configuration)
|
||||
3. [Opérations courantes](#3-opérations-courantes)
|
||||
4. [Gestion des règles de politique](#4-gestion-des-règles-de-politique)
|
||||
5. [Troubleshooting](#5-troubleshooting)
|
||||
6. [Escalade vers in-path](#6-escalade-vers-in-path)
|
||||
7. [Rollback et récupération 4R](#7-rollback-et-récupération-4r)
|
||||
8. [Monitoring et alertes](#8-monitoring-et-alertes)
|
||||
9. [Maintenance](#9-maintenance)
|
||||
10. [Contacts et support](#10-contacts-et-support)
|
||||
|
||||
---
|
||||
|
||||
## 1. Prérequis
|
||||
|
||||
### 1.1 Matériel supporté
|
||||
|
||||
| Plateforme | Architecture | Statut | Notes |
|
||||
|------------|--------------|--------|-------|
|
||||
| MOCHAbin | arm64 (Armada 7040) | **PRODUCTION** | Cible primaire |
|
||||
| ESPRESSObin v7 | arm64 (Armada 3720) | **BETA** | Lite edition |
|
||||
| ESPRESSObin Ultra | arm64 (Armada 3720) | **BETA** | 2× WAN capable |
|
||||
| VM x86_64 | x86_64 | **DÉVELOPPEMENT** | Tests uniquement |
|
||||
|
||||
### 1.2 Dépendances système
|
||||
|
||||
Installer les paquets Debian requis :
|
||||
|
||||
```bash
|
||||
apt update
|
||||
apt install -y \
|
||||
libpcap-dev \
|
||||
python3-scapy \
|
||||
python3-pydantic \
|
||||
python3-fastapi \
|
||||
python3-uvicorn \
|
||||
bpfcc-tools \
|
||||
linux-headers-$(uname -r)
|
||||
```
|
||||
|
||||
### 1.3 Vérification kernel BPF JIT
|
||||
|
||||
OPAD nécessite BPF JIT activé pour performances optimales :
|
||||
|
||||
```bash
|
||||
# Vérifier BPF JIT
|
||||
sysctl net.core.bpf_jit_enable
|
||||
|
||||
# Si désactivé, activer temporairement
|
||||
sysctl -w net.core.bpf_jit_enable=1
|
||||
|
||||
# Activer de manière permanente
|
||||
echo "net.core.bpf_jit_enable=1" >> /etc/sysctl.d/99-secubox-opad.conf
|
||||
sysctl -p /etc/sysctl.d/99-secubox-opad.conf
|
||||
```
|
||||
|
||||
**Sortie attendue** : `net.core.bpf_jit_enable = 1`
|
||||
|
||||
### 1.4 Vérification des capacités kernel
|
||||
|
||||
```bash
|
||||
# Modules requis
|
||||
lsmod | grep -E 'nf_nat|nf_conntrack|sch_prio|cls_bpf|act_bpf'
|
||||
|
||||
# Charger si manquants
|
||||
modprobe nf_nat nf_conntrack sch_prio cls_bpf act_bpf
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 2. Installation et configuration
|
||||
|
||||
### 2.1 Déploiement initial
|
||||
|
||||
```bash
|
||||
# 1. Installer le paquet
|
||||
apt install secubox-wall
|
||||
|
||||
# 2. Vérifier le service
|
||||
systemctl status secubox-wall
|
||||
|
||||
# 3. Vérifier le mode OPAD
|
||||
curl -s http://localhost:9999/api/v1/wall/status | jq '.mode'
|
||||
# Sortie attendue: "opad"
|
||||
|
||||
# 4. Valider le profil par défaut
|
||||
secubox-params validate --module wall --profile active
|
||||
```
|
||||
|
||||
### 2.2 Configuration profil 3-broche
|
||||
|
||||
Le profil OPAD utilise le système **double-buffer** :
|
||||
|
||||
```
|
||||
/etc/secubox/wall/
|
||||
├── active/ ← Configuration live (lecture seule en production)
|
||||
├── shadow/ ← Édition, validation avant swap
|
||||
└── rollback/
|
||||
├── R1/ ← Snapshot le plus récent
|
||||
├── R2/
|
||||
├── R3/
|
||||
└── R4/ ← Snapshot le plus ancien
|
||||
```
|
||||
|
||||
#### Workflow standard
|
||||
|
||||
```bash
|
||||
# 1. Éditer la configuration dans shadow
|
||||
secubox-params edit --module wall --profile shadow
|
||||
|
||||
# 2. Valider le profil
|
||||
secubox-params validate --module wall --profile shadow
|
||||
|
||||
# 3. Swap shadow → active (crée snapshot automatique)
|
||||
secubox-params swap --module wall
|
||||
|
||||
# 4. Redémarrer le service
|
||||
systemctl restart secubox-wall
|
||||
```
|
||||
|
||||
### 2.3 Configuration des interfaces
|
||||
|
||||
OPAD nécessite les interfaces d'observation en **mode promiscuous** :
|
||||
|
||||
```bash
|
||||
# Configuration netplan (exemple /etc/netplan/00-secubox.yaml)
|
||||
network:
|
||||
version: 2
|
||||
ethernets:
|
||||
eth0:
|
||||
dhcp4: false
|
||||
promisc: true # Mode promiscuous pour observation
|
||||
addresses:
|
||||
- 192.168.1.1/24
|
||||
|
||||
eth1:
|
||||
dhcp4: false
|
||||
promisc: true
|
||||
addresses:
|
||||
- 192.168.2.1/24
|
||||
|
||||
# Appliquer
|
||||
netplan generate && netplan apply
|
||||
|
||||
# Vérifier
|
||||
ip link show eth0 | grep PROMISC
|
||||
```
|
||||
|
||||
### 2.4 Profil minimal (JSON)
|
||||
|
||||
Exemple de profil OPAD `active/opad-profile.json` :
|
||||
|
||||
```json
|
||||
{
|
||||
"mode": "opad",
|
||||
"observation": {
|
||||
"interfaces": ["eth0", "eth1"],
|
||||
"promiscuous": true,
|
||||
"bpf_filter": "not port 22 and not port 9999"
|
||||
},
|
||||
"primitives": {
|
||||
"dns-r": {
|
||||
"enabled": true,
|
||||
"ttl": 0,
|
||||
"spoof_ip": "127.0.0.1"
|
||||
},
|
||||
"dhcp-r": {
|
||||
"enabled": true,
|
||||
"nak_rate_limit": "10/s"
|
||||
},
|
||||
"rst-i": {
|
||||
"enabled": true,
|
||||
"seq_window": 4096
|
||||
},
|
||||
"arp-r": {
|
||||
"enabled": false
|
||||
}
|
||||
},
|
||||
"policy": {
|
||||
"default_action": "observe",
|
||||
"rules_file": "active/policy-rules.json"
|
||||
},
|
||||
"metrics": {
|
||||
"prometheus_port": 9100,
|
||||
"log_level": "info"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. Opérations courantes
|
||||
|
||||
### 3.1 Vérification du statut
|
||||
|
||||
```bash
|
||||
# Status systemd
|
||||
systemctl status secubox-wall
|
||||
|
||||
# Status API détaillé
|
||||
curl -s http://localhost:9999/api/v1/wall/status | jq
|
||||
```
|
||||
|
||||
**Exemple de réponse JSON** :
|
||||
|
||||
```json
|
||||
{
|
||||
"mode": "opad",
|
||||
"status": "active",
|
||||
"uptime_seconds": 86400,
|
||||
"observation": {
|
||||
"interfaces": ["eth0", "eth1"],
|
||||
"packets_observed": 1245678,
|
||||
"packets_matched": 3421
|
||||
},
|
||||
"primitives": {
|
||||
"dns-r": {
|
||||
"enabled": true,
|
||||
"injections_total": 142,
|
||||
"injections_lost": 2
|
||||
},
|
||||
"dhcp-r": {
|
||||
"enabled": true,
|
||||
"naks_sent": 89
|
||||
},
|
||||
"rst-i": {
|
||||
"enabled": true,
|
||||
"resets_sent": 56
|
||||
},
|
||||
"arp-r": {
|
||||
"enabled": false
|
||||
}
|
||||
},
|
||||
"policy": {
|
||||
"rules_count": 8,
|
||||
"matches_total": 3421
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 3.2 Métriques temps réel
|
||||
|
||||
```bash
|
||||
# Métriques Prometheus
|
||||
curl -s http://localhost:9100/metrics | grep secubox_opad
|
||||
|
||||
# Statistiques par primitive
|
||||
curl -s http://localhost:9999/api/v1/wall/metrics | jq '.primitives'
|
||||
```
|
||||
|
||||
### 3.3 Consultation des logs
|
||||
|
||||
```bash
|
||||
# Logs temps réel
|
||||
journalctl -u secubox-wall -f
|
||||
|
||||
# Filtrer par niveau
|
||||
journalctl -u secubox-wall -p warning -n 100
|
||||
|
||||
# Rechercher alertes DEPOT
|
||||
journalctl -u secubox-wall | grep "ALERTE_DEPOT"
|
||||
|
||||
# Exemple de log:
|
||||
# [OPAD] [DNS-R] ALERTE_DEPOT: 3 packets lost in 1s (threshold: 2)
|
||||
|
||||
# Rechercher injections perdues
|
||||
journalctl -u secubox-wall | grep "OPAD_INJECT_LOST"
|
||||
|
||||
# Logs JSON structurés
|
||||
journalctl -u secubox-wall -o json | jq '.MESSAGE'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. Gestion des règles de politique
|
||||
|
||||
### 4.1 Lister les règles
|
||||
|
||||
```bash
|
||||
# Via API
|
||||
curl -s http://localhost:9999/api/v1/wall/policy/rules | jq
|
||||
|
||||
# Via fichier
|
||||
cat /etc/secubox/wall/active/policy-rules.json | jq
|
||||
```
|
||||
|
||||
### 4.2 Ajouter une règle
|
||||
|
||||
#### Exemple 1 : Bloquer un domaine (DNS-R)
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:9999/api/v1/wall/policy/rules \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"id": "block-malware-domain",
|
||||
"primitive": "dns-r",
|
||||
"action": "inject",
|
||||
"match": {
|
||||
"domain": "malware.example.com"
|
||||
},
|
||||
"params": {
|
||||
"ttl": 0,
|
||||
"spoof_ip": "127.0.0.1"
|
||||
},
|
||||
"enabled": true,
|
||||
"priority": 100
|
||||
}'
|
||||
```
|
||||
|
||||
#### Exemple 2 : Quarantaine d'un device (DHCP-R)
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:9999/api/v1/wall/policy/rules \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"id": "quarantine-infected-host",
|
||||
"primitive": "dhcp-r",
|
||||
"action": "nak",
|
||||
"match": {
|
||||
"mac": "aa:bb:cc:dd:ee:ff"
|
||||
},
|
||||
"params": {
|
||||
"reason": "Infected device - contact IT"
|
||||
},
|
||||
"enabled": true,
|
||||
"priority": 200
|
||||
}'
|
||||
```
|
||||
|
||||
#### Exemple 3 : RST vers IP externe (RST-I)
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:9999/api/v1/wall/policy/rules \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"id": "block-c2-server",
|
||||
"primitive": "rst-i",
|
||||
"action": "inject",
|
||||
"match": {
|
||||
"dst_ip": "198.51.100.123",
|
||||
"protocol": "tcp"
|
||||
},
|
||||
"params": {
|
||||
"seq_window": 4096
|
||||
},
|
||||
"enabled": true,
|
||||
"priority": 300
|
||||
}'
|
||||
```
|
||||
|
||||
### 4.3 Modifier une règle
|
||||
|
||||
```bash
|
||||
# 1. Récupérer l'ID de la règle
|
||||
curl -s http://localhost:9999/api/v1/wall/policy/rules | jq '.[] | select(.id=="block-malware-domain")'
|
||||
|
||||
# 2. Modifier (PATCH ou PUT)
|
||||
curl -X PATCH http://localhost:9999/api/v1/wall/policy/rules/block-malware-domain \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"enabled": false
|
||||
}'
|
||||
```
|
||||
|
||||
### 4.4 Supprimer une règle
|
||||
|
||||
```bash
|
||||
curl -X DELETE http://localhost:9999/api/v1/wall/policy/rules/block-malware-domain
|
||||
```
|
||||
|
||||
### 4.5 Recharger les règles
|
||||
|
||||
```bash
|
||||
# Après modification manuelle du fichier policy-rules.json
|
||||
curl -X POST http://localhost:9999/api/v1/wall/policy/reload
|
||||
|
||||
# Ou via systemd
|
||||
systemctl reload secubox-wall
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 5. Troubleshooting
|
||||
|
||||
### 5.1 DNS-R : Problèmes d'injection
|
||||
|
||||
| Symptôme | Cause probable | Solution |
|
||||
|----------|----------------|----------|
|
||||
| Clients reçoivent réponse légitime | Injection trop lente (latence DÉPÔT) | Vérifier `ALERTE_DEPOT` dans logs, réduire charge CPU |
|
||||
| `OPAD_INJECT_LOST` dans logs | Race condition perdue | Activer escalade in-path (INV-08) si critique |
|
||||
| TTL non respecté | Bug client cache | Forcer TTL=0 dans règle primitive |
|
||||
| Injection fonctionne sporadiquement | Interface non promiscuous | `ip link show eth0 \| grep PROMISC` |
|
||||
|
||||
**Commandes de diagnostic** :
|
||||
|
||||
```bash
|
||||
# Capturer trafic DNS
|
||||
tcpdump -i eth0 -nn port 53 -c 100
|
||||
|
||||
# Vérifier latence injection
|
||||
curl -s http://localhost:9100/metrics | grep secubox_opad_dns_latency
|
||||
|
||||
# Tester règle manuellement
|
||||
dig @8.8.8.8 malware.example.com # Devrait recevoir 127.0.0.1
|
||||
```
|
||||
|
||||
### 5.2 DHCP-R : NAK non effectifs
|
||||
|
||||
| Symptôme | Cause probable | Solution |
|
||||
|----------|----------------|----------|
|
||||
| Client obtient IP malgré NAK | Serveur DHCP légitime plus rapide | Escalade in-path pour drop hard |
|
||||
| NAK envoyés mais ignorés | Client stateful DHCPv6 | Ajouter règle pour DHCPv6 (port 547) |
|
||||
| Rate limit atteint | Trop de NAK/s | Augmenter `nak_rate_limit` dans profil |
|
||||
|
||||
**Commandes de diagnostic** :
|
||||
|
||||
```bash
|
||||
# Capturer DHCP
|
||||
tcpdump -i eth0 -nn port 67 or port 68 -v
|
||||
|
||||
# Vérifier NAK count
|
||||
curl -s http://localhost:9999/api/v1/wall/metrics | jq '.primitives["dhcp-r"].naks_sent'
|
||||
|
||||
# Tester règle
|
||||
# (sur client) dhclient -r eth0 && dhclient eth0
|
||||
```
|
||||
|
||||
### 5.3 RST-I : Connexion non coupée
|
||||
|
||||
| Symptôme | Cause probable | Solution |
|
||||
|----------|----------------|----------|
|
||||
| Connexion TCP établie malgré RST | SEQ hors fenêtre | Augmenter `seq_window` à 65535 (max) |
|
||||
| RST envoyés mais ignorés | Client ignore RST (rare) | Escalade in-path pour drop dans nftables |
|
||||
| RST sur mauvais sens | Bug direction detection | Vérifier logs OPAD, reporter bug |
|
||||
|
||||
**Commandes de diagnostic** :
|
||||
|
||||
```bash
|
||||
# Capturer RST
|
||||
tcpdump -i eth0 'tcp[tcpflags] & tcp-rst != 0' -nn -c 20
|
||||
|
||||
# Tester règle
|
||||
curl -v http://198.51.100.123 # Devrait timeout/reset
|
||||
```
|
||||
|
||||
### 5.4 ARP-R : Empoisonnement détecté
|
||||
|
||||
| Symptôme | Cause probable | Solution |
|
||||
|----------|----------------|----------|
|
||||
| Fausses réponses ARP persistent | Race condition ARP | Activer in-path + static ARP sur clients critiques |
|
||||
| Alerts ARP floods | Attaque MITM active | Activer primitive ARP-R + bloquer MAC source |
|
||||
| Réponses ARP non injectées | Interface non promiscuous | Vérifier `ip link show \| grep PROMISC` |
|
||||
|
||||
**Commandes de diagnostic** :
|
||||
|
||||
```bash
|
||||
# Capturer ARP
|
||||
tcpdump -i eth0 arp -nn -e
|
||||
|
||||
# Vérifier table ARP
|
||||
ip neigh show
|
||||
|
||||
# Scanner ARP spoofing (arpwatch)
|
||||
apt install arpwatch
|
||||
systemctl start arpwatch
|
||||
journalctl -u arpwatch -f
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. Escalade vers in-path
|
||||
|
||||
### 6.1 Quand escalader
|
||||
|
||||
Escalader vers **in-path** (mode invasif INV-08) dans ces cas :
|
||||
|
||||
1. **Client ARP statique** : Injection ARP-R inefficace
|
||||
2. **Besoin drop hard** : RST-I ou DNS-R perdent race condition
|
||||
3. **Deep packet inspection** : Besoin modifier payload (WAF)
|
||||
4. **Conformité réglementaire** : Audit exige interception certaine
|
||||
|
||||
**ATTENTION** : Escalade = point unique de défaillance (SPOF). Tester en maintenance window.
|
||||
|
||||
### 6.2 Procédure INV-08
|
||||
|
||||
```bash
|
||||
# 1. Vérifier état actuel
|
||||
curl -s http://localhost:9999/api/v1/wall/status | jq '.mode'
|
||||
# Sortie: "opad"
|
||||
|
||||
# 2. Planifier escalade (dry-run)
|
||||
curl -X POST http://localhost:9999/api/v1/wall/escalate \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"target_mode": "in-path",
|
||||
"dry_run": true
|
||||
}' | jq
|
||||
|
||||
# 3. Activer escalade
|
||||
secubox-wall escalate --mode in-path --confirm
|
||||
|
||||
# 4. Vérifier
|
||||
curl -s http://localhost:9999/api/v1/wall/status | jq '.mode'
|
||||
# Sortie: "in-path"
|
||||
|
||||
# 5. Surveiller
|
||||
journalctl -u secubox-wall -f
|
||||
```
|
||||
|
||||
**Changements effectués** :
|
||||
|
||||
- nftables : ajout hook `PREROUTING` + `FORWARD`
|
||||
- tc : qdisc `prio` remplacé par `htb` avec redirect
|
||||
- Interfaces : mode bridge activé (`brctl addif secubox-br0 eth0`)
|
||||
|
||||
### 6.3 Révocation (retour OPAD)
|
||||
|
||||
```bash
|
||||
# 1. Révoquer escalade
|
||||
curl -X DELETE http://localhost:9999/api/v1/wall/escalate
|
||||
|
||||
# 2. Vérifier
|
||||
curl -s http://localhost:9999/api/v1/wall/status | jq '.mode'
|
||||
# Sortie: "opad"
|
||||
|
||||
# 3. Redémarrer service (recommandé)
|
||||
systemctl restart secubox-wall
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 7. Rollback et récupération 4R
|
||||
|
||||
### 7.1 Actions 4R
|
||||
|
||||
| Action | Mnémotechnique | Description | Commande |
|
||||
|--------|----------------|-------------|----------|
|
||||
| **Run** | Exécuter | Swap shadow → active | `secubox-params swap --module wall` |
|
||||
| **Rollback** | Retour arrière | Restaurer snapshot Rn | `secubox-params rollback --module wall --target R1` |
|
||||
| **Revert** | Annuler | Swap active → shadow | `secubox-params revert --module wall` |
|
||||
| **Rebuild** | Reconstruction | Régénérer depuis source | `secubox-params rebuild --module wall --from-template` |
|
||||
|
||||
### 7.2 Structure snapshots
|
||||
|
||||
```
|
||||
/etc/secubox/wall/rollback/
|
||||
├── R1/
|
||||
│ ├── opad-profile.json
|
||||
│ ├── policy-rules.json
|
||||
│ └── .timestamp # 2026-05-12T14:30:00Z
|
||||
├── R2/
|
||||
│ └── .timestamp # 2026-05-11T09:15:00Z
|
||||
├── R3/
|
||||
│ └── .timestamp # 2026-05-10T16:45:00Z
|
||||
└── R4/
|
||||
└── .timestamp # 2026-05-09T11:00:00Z
|
||||
```
|
||||
|
||||
**Règle de rotation** : Chaque `swap` crée un nouveau snapshot R1, les autres se décalent (R1→R2, R2→R3, R3→R4, R4 supprimé).
|
||||
|
||||
### 7.3 Restauration d'urgence
|
||||
|
||||
#### Scenario 1 : Configuration cassée après swap
|
||||
|
||||
```bash
|
||||
# 1. Identifier le problème
|
||||
systemctl status secubox-wall
|
||||
# Sortie: failed
|
||||
|
||||
# 2. Consulter logs
|
||||
journalctl -u secubox-wall -n 50 --no-pager
|
||||
|
||||
# 3. Rollback immédiat vers R1
|
||||
secubox-params rollback --module wall --target R1
|
||||
|
||||
# 4. Redémarrer
|
||||
systemctl restart secubox-wall
|
||||
|
||||
# 5. Vérifier
|
||||
systemctl status secubox-wall
|
||||
```
|
||||
|
||||
#### Scenario 2 : Tous les snapshots corrompus
|
||||
|
||||
```bash
|
||||
# 1. Rebuild depuis template factory
|
||||
secubox-params rebuild --module wall --from-template
|
||||
|
||||
# 2. Vérifier template source
|
||||
ls -la /usr/share/secubox/wall/templates/
|
||||
|
||||
# 3. Restaurer
|
||||
cp -r /usr/share/secubox/wall/templates/* /etc/secubox/wall/active/
|
||||
|
||||
# 4. Redémarrer
|
||||
systemctl restart secubox-wall
|
||||
```
|
||||
|
||||
### 7.4 Audit trail
|
||||
|
||||
Chaque action 4R est loggée dans `/var/log/secubox/audit.log` :
|
||||
|
||||
```bash
|
||||
# Consulter audit trail
|
||||
tail -f /var/log/secubox/audit.log
|
||||
|
||||
# Exemple d'entrée:
|
||||
# 2026-05-12T14:30:15Z [WALL] ACTION=swap USER=root FROM=shadow TO=active SNAPSHOT=R1
|
||||
# 2026-05-12T14:35:42Z [WALL] ACTION=rollback USER=root FROM=active TO=R1 REASON="config_invalid"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 8. Monitoring et alertes
|
||||
|
||||
### 8.1 Métriques Prometheus
|
||||
|
||||
Endpoint : `http://localhost:9100/metrics`
|
||||
|
||||
#### Métriques principales
|
||||
|
||||
```prometheus
|
||||
# Compteurs injections
|
||||
secubox_opad_injection_total{primitive="dns-r"} 142
|
||||
secubox_opad_injection_total{primitive="dhcp-r"} 89
|
||||
secubox_opad_injection_total{primitive="rst-i"} 56
|
||||
|
||||
# Injections perdues (race condition)
|
||||
secubox_opad_injection_lost_total{primitive="dns-r"} 2
|
||||
|
||||
# Latence injection (ms)
|
||||
secubox_opad_injection_latency_ms{primitive="dns-r",quantile="0.5"} 0.8
|
||||
secubox_opad_injection_latency_ms{primitive="dns-r",quantile="0.99"} 3.2
|
||||
|
||||
# Packets observés
|
||||
secubox_opad_packets_observed_total 1245678
|
||||
|
||||
# Règles de politique matchées
|
||||
secubox_opad_policy_matches_total{rule_id="block-malware-domain"} 89
|
||||
secubox_opad_policy_matches_total{rule_id="quarantine-infected-host"} 12
|
||||
```
|
||||
|
||||
### 8.2 Alertes Prometheus recommandées
|
||||
|
||||
```yaml
|
||||
# /etc/prometheus/alerts/secubox-opad.yml
|
||||
groups:
|
||||
- name: secubox_opad
|
||||
interval: 30s
|
||||
rules:
|
||||
# Alerte 1 : Service dégradé
|
||||
- alert: OPADServiceDegraded
|
||||
expr: up{job="secubox-wall"} == 0
|
||||
for: 1m
|
||||
labels:
|
||||
severity: critical
|
||||
annotations:
|
||||
summary: "OPAD service down on {{ $labels.instance }}"
|
||||
description: "secubox-wall systemd unit not responding"
|
||||
|
||||
# Alerte 2 : Injections perdues (burst)
|
||||
- alert: OPADInjectLostBurst
|
||||
expr: rate(secubox_opad_injection_lost_total[1m]) > 0.1
|
||||
for: 2m
|
||||
labels:
|
||||
severity: warning
|
||||
annotations:
|
||||
summary: "OPAD losing injections on {{ $labels.instance }}"
|
||||
description: "Primitive {{ $labels.primitive }} losing race conditions ({{ $value }}/s)"
|
||||
|
||||
# Alerte 3 : Latence excessive
|
||||
- alert: OPADLatencyHigh
|
||||
expr: secubox_opad_injection_latency_ms{quantile="0.99"} > 5
|
||||
for: 5m
|
||||
labels:
|
||||
severity: warning
|
||||
annotations:
|
||||
summary: "OPAD high latency on {{ $labels.instance }}"
|
||||
description: "P99 latency {{ $value }}ms (threshold: 5ms)"
|
||||
|
||||
# Alerte 4 : Observation arrêtée
|
||||
- alert: OPADObservationDown
|
||||
expr: rate(secubox_opad_packets_observed_total[5m]) == 0
|
||||
for: 2m
|
||||
labels:
|
||||
severity: critical
|
||||
annotations:
|
||||
summary: "OPAD not observing traffic on {{ $labels.instance }}"
|
||||
description: "No packets observed in last 5 minutes - check interfaces"
|
||||
|
||||
# Alerte 5 : Escalade in-path active
|
||||
- alert: OPADEscalationActive
|
||||
expr: secubox_opad_mode{mode="in-path"} == 1
|
||||
for: 10m
|
||||
labels:
|
||||
severity: info
|
||||
annotations:
|
||||
summary: "OPAD escalated to in-path mode on {{ $labels.instance }}"
|
||||
description: "System running in invasive mode - verify if intentional"
|
||||
```
|
||||
|
||||
### 8.3 Grafana dashboard
|
||||
|
||||
Importer le dashboard pré-configuré :
|
||||
|
||||
```bash
|
||||
# Télécharger dashboard JSON
|
||||
curl -o /tmp/opad-dashboard.json \
|
||||
https://raw.githubusercontent.com/CyberMind-FR/secubox-deb/master/monitoring/grafana/opad-dashboard.json
|
||||
|
||||
# Importer dans Grafana
|
||||
grafana-cli admin import-dashboard /tmp/opad-dashboard.json
|
||||
```
|
||||
|
||||
**Panels inclus** :
|
||||
|
||||
- Injections totales (time series)
|
||||
- Injections perdues (gauge)
|
||||
- Latence P50/P95/P99 (heatmap)
|
||||
- Policy matches par règle (bar chart)
|
||||
- Escalations in-path (stat)
|
||||
|
||||
---
|
||||
|
||||
## 9. Maintenance
|
||||
|
||||
### 9.1 Mise à jour
|
||||
|
||||
```bash
|
||||
# 1. Vérifier version actuelle
|
||||
dpkg -l | grep secubox-wall
|
||||
|
||||
# 2. Mettre à jour
|
||||
apt update
|
||||
apt install --only-upgrade secubox-wall
|
||||
|
||||
# 3. Vérifier changelog
|
||||
zcat /usr/share/doc/secubox-wall/changelog.Debian.gz | head -n 20
|
||||
|
||||
# 4. Redémarrer
|
||||
systemctl restart secubox-wall
|
||||
|
||||
# 5. Valider
|
||||
curl -s http://localhost:9999/api/v1/wall/status | jq '.version'
|
||||
```
|
||||
|
||||
### 9.2 Sauvegarde configuration
|
||||
|
||||
```bash
|
||||
# Backup manuel
|
||||
tar -czf /backup/secubox-wall-$(date +%Y%m%d).tar.gz \
|
||||
/etc/secubox/wall/active/ \
|
||||
/etc/secubox/wall/rollback/
|
||||
|
||||
# Restauration
|
||||
tar -xzf /backup/secubox-wall-20260512.tar.gz -C /
|
||||
systemctl restart secubox-wall
|
||||
```
|
||||
|
||||
**Automatisation cron** :
|
||||
|
||||
```bash
|
||||
# /etc/cron.daily/secubox-wall-backup
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
BACKUP_DIR="/backup/secubox-wall"
|
||||
DATE=$(date +%Y%m%d)
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
tar -czf "$BACKUP_DIR/wall-$DATE.tar.gz" /etc/secubox/wall/active/ /etc/secubox/wall/rollback/
|
||||
find "$BACKUP_DIR" -name "wall-*.tar.gz" -mtime +30 -delete
|
||||
```
|
||||
|
||||
### 9.3 Rotation logs
|
||||
|
||||
Configuration logrotate `/etc/logrotate.d/secubox-wall` :
|
||||
|
||||
```
|
||||
/var/log/secubox/wall/*.log {
|
||||
daily
|
||||
rotate 30
|
||||
compress
|
||||
delaycompress
|
||||
missingok
|
||||
notifempty
|
||||
create 0640 secubox-wall secubox-wall
|
||||
sharedscripts
|
||||
postrotate
|
||||
systemctl reload secubox-wall > /dev/null 2>&1 || true
|
||||
endscript
|
||||
}
|
||||
```
|
||||
|
||||
### 9.4 Nettoyage cache BPF
|
||||
|
||||
```bash
|
||||
# Lister objets BPF
|
||||
bpftool prog list
|
||||
|
||||
# Lister maps BPF
|
||||
bpftool map list
|
||||
|
||||
# Nettoyer objets orphelins (après crash)
|
||||
bpftool prog show | awk '/secubox_opad/ {print $1}' | xargs -n1 bpftool prog detach
|
||||
|
||||
# Supprimer maps orphelines
|
||||
bpftool map show | awk '/secubox_opad/ {print $1}' | xargs -n1 bpftool map delete
|
||||
```
|
||||
|
||||
### 9.5 Vérification intégrité
|
||||
|
||||
```bash
|
||||
# Checksum binaires
|
||||
debsums secubox-wall
|
||||
|
||||
# Permissions
|
||||
dpkg-statoverride --list | grep secubox-wall
|
||||
|
||||
# Capabilities binaires
|
||||
getcap /usr/bin/secubox-wall
|
||||
# Sortie attendue: cap_net_admin,cap_net_raw=ep
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 10. Contacts et support
|
||||
|
||||
### 10.1 Documentation
|
||||
|
||||
- **Architecture OPAD** : `/usr/share/doc/secubox-wall/OPAD-ARCHITECTURE.md`
|
||||
- **Threat Model** : `/usr/share/doc/secubox-wall/OPAD-THREAT-MODEL.md`
|
||||
- **Compliance CSPN** : `/usr/share/doc/secubox-wall/OPAD-CSPN.md`
|
||||
- **Site web** : https://secubox.in
|
||||
|
||||
### 10.2 Support technique
|
||||
|
||||
- **Issues GitHub** : https://github.com/CyberMind-FR/secubox-deb/issues
|
||||
- **Email** : support@cybermind.fr
|
||||
- **Matrice** : #secubox:matrix.org
|
||||
|
||||
### 10.3 Reporting bugs
|
||||
|
||||
Template issue GitHub :
|
||||
|
||||
```markdown
|
||||
### Environnement
|
||||
- SecuBox version: [dpkg -l | grep secubox-wall]
|
||||
- Kernel: [uname -r]
|
||||
- Board: [MOCHAbin / ESPRESSObin / VM]
|
||||
|
||||
### Symptôme
|
||||
[Description du problème]
|
||||
|
||||
### Reproduction
|
||||
1. [Étape 1]
|
||||
2. [Étape 2]
|
||||
3. [Étape 3]
|
||||
|
||||
### Logs
|
||||
```
|
||||
[journalctl -u secubox-wall -n 100 --no-pager]
|
||||
```
|
||||
|
||||
### Attendu vs Observé
|
||||
- **Attendu** : [comportement attendu]
|
||||
- **Observé** : [comportement observé]
|
||||
```
|
||||
|
||||
### 10.4 Contribution
|
||||
|
||||
Le projet SecuBox-Deb est **open source** (licence à définir) :
|
||||
|
||||
```bash
|
||||
# Cloner le repo
|
||||
git clone https://github.com/CyberMind-FR/secubox-deb.git
|
||||
|
||||
# Créer une branche feature
|
||||
git checkout -b feature/opad-improvement
|
||||
|
||||
# Soumettre PR
|
||||
gh pr create --title "feat(wall): improve DNS-R latency" --body "..."
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Annexes
|
||||
|
||||
### A. Glossaire
|
||||
|
||||
| Terme | Définition |
|
||||
|-------|------------|
|
||||
| **OPAD** | Out-of-Path Active Defense |
|
||||
| **Primitive** | Mécanisme d'injection (DNS-R, DHCP-R, RST-I, ARP-R) |
|
||||
| **DÉPÔT** | Delay between observation and injection |
|
||||
| **INV-08** | Escalation to in-path mode (invasive) |
|
||||
| **4R** | Run, Rollback, Revert, Rebuild |
|
||||
| **SPOF** | Single Point Of Failure |
|
||||
|
||||
### B. Codes d'erreur API
|
||||
|
||||
| Code | Message | Cause |
|
||||
|------|---------|-------|
|
||||
| 200 | OK | Succès |
|
||||
| 400 | Invalid request | JSON malformé ou champs manquants |
|
||||
| 404 | Rule not found | ID règle inexistant |
|
||||
| 409 | Conflict | Règle duplicate ou escalation déjà active |
|
||||
| 500 | Internal error | Bug ou crash backend |
|
||||
| 503 | Service unavailable | Service en cours de redémarrage |
|
||||
|
||||
### C. Ports réseau
|
||||
|
||||
| Port | Protocole | Service | Notes |
|
||||
|------|-----------|---------|-------|
|
||||
| 9999 | HTTP | API REST OPAD | Localhost uniquement |
|
||||
| 9100 | HTTP | Prometheus metrics | Localhost uniquement |
|
||||
| 53 | UDP/TCP | Observation DNS | Promiscuous mode |
|
||||
| 67-68 | UDP | Observation DHCP | Promiscuous mode |
|
||||
|
||||
---
|
||||
|
||||
**FIN DU DOCUMENT**
|
||||
|
||||
---
|
||||
|
||||
**Changelog**
|
||||
|
||||
| Version | Date | Auteur | Changements |
|
||||
|---------|------|--------|-------------|
|
||||
| 2.4.0 | 2026-05-12 | G. Kerma | Version initiale OPAD operations guide |
|
||||
|
||||
---
|
||||
|
||||
**Licence** : [À définir] — CyberMind · https://cybermind.fr
|
||||
671
doctrine/opad/OPAD.md
Normal file
671
doctrine/opad/OPAD.md
Normal file
|
|
@ -0,0 +1,671 @@
|
|||
# OPAD — Off-Path Active Defense
|
||||
|
||||
**Doctrine WALL SecuBox v2.4.0**
|
||||
|
||||
---
|
||||
|
||||
## Métadonnées
|
||||
|
||||
| Champ | Valeur |
|
||||
|-------|--------|
|
||||
| **Référence** | CM-WALL-OPAD-2026-05 |
|
||||
| **Version** | 2.4.0 |
|
||||
| **Status** | Canonique |
|
||||
| **Date** | 2026-05-12 |
|
||||
| **Auteur** | Gérald Kerma (CyberMind) |
|
||||
| **Portée** | Module WALL (SecuBox-Deb) |
|
||||
| **Révision précédente** | D-2025-IDGP-INLINE (déprécié) |
|
||||
|
||||
---
|
||||
|
||||
## 1. Identité
|
||||
|
||||
### 1.1 Définition
|
||||
|
||||
**OPAD** (Off-Path Active Defense) est la doctrine architecturale du module **WALL** de SecuBox-Deb v2.4.0+. Elle définit un mode de protection réseau où la SecuBox observe le trafic en **position off-path** (hors du chemin de données) et injecte des réponses de disruption ciblée lorsque nécessaire, **sans jamais être un point de passage obligatoire**.
|
||||
|
||||
### 1.2 Doctrine en une ligne
|
||||
|
||||
> **"La SecuBox n'est pas dans le chemin. Elle est à côté du chemin, et elle gagne des courses. Quand elle est là, elle protège par disruption ciblée. Quand elle n'est pas là, le réseau ne le remarque pas."**
|
||||
|
||||
### 1.3 Périmètre
|
||||
|
||||
- **Module concerné** : WALL (protection réseau active)
|
||||
- **Composants** : DNS-R, DHCP-R, RST-I, ARP-R
|
||||
- **Cible** : Certification ANSSI CSPN (critère "fail-silent")
|
||||
- **Contrainte** : Zéro rupture possible du flux utilisateur
|
||||
|
||||
---
|
||||
|
||||
## 2. Contexte et motivation
|
||||
|
||||
### 2.1 Problème avec la doctrine in-path (IDGP)
|
||||
|
||||
La doctrine précédente **D-2025-IDGP-INLINE** (In-line Data Guardian Protocol) plaçait la SecuBox en **bridge transparent** dans le chemin de données :
|
||||
|
||||
**Limites identifiées :**
|
||||
|
||||
| Problème | Impact |
|
||||
|----------|--------|
|
||||
| **Single Point of Failure** | Panne matérielle = coupure réseau totale |
|
||||
| **Latency ajoutée** | Analyse en ligne → délai minimum 2-5ms par paquet |
|
||||
| **Surface d'attaque** | SecuBox devient cible prioritaire (DoS, exploitation kernel) |
|
||||
| **Complexité opérationnelle** | Maintenance = fenêtre de downtime obligatoire |
|
||||
| **Scalabilité** | Goulot d'étranglement à 1 Gbps+ |
|
||||
|
||||
### 2.2 Solution OPAD : observation off-path + injection active
|
||||
|
||||
**Principe :** La SecuBox écoute le trafic en **mode observation** (port mirror, TAP, span) et injecte des réponses **plus rapides** que les réponses légitimes lorsqu'une menace est détectée.
|
||||
|
||||
**Topologie :**
|
||||
|
||||
```
|
||||
┌──────────────┐
|
||||
│ Internet │
|
||||
└──────┬───────┘
|
||||
│
|
||||
┌──────▼───────┐
|
||||
│ Routeur │
|
||||
│ (Opérateur)│
|
||||
└──────┬───────┘
|
||||
│
|
||||
┌───────────────┼───────────────┐
|
||||
│ │ │
|
||||
┏━━━━━▼━━━━━┓ ┌─────▼─────┐ ┌───▼────┐
|
||||
┃ SecuBox ┃ │ Switch │ │ Clients│
|
||||
┃ (OPAD) ┃◄──┤ (SPAN) │ │ LAN │
|
||||
┃ OFF-PATH ┃ └───────────┘ └────────┘
|
||||
┗━━━━━┬━━━━━┛
|
||||
│
|
||||
└─► Injection (DNS-R, DHCP-R, RST-I, ARP-R)
|
||||
|
||||
Legend:
|
||||
━━━ : Off-path observation + injection
|
||||
─── : Data path (aucun forwarding SecuBox)
|
||||
```
|
||||
|
||||
**Avantages :**
|
||||
|
||||
- ✅ **Retrait transparent** : débrancher la SecuBox = aucun impact
|
||||
- ✅ **Zéro latency** : pas dans le chemin de données
|
||||
- ✅ **Surface d'attaque minimale** : pas de forwarding = pas de DoS possible
|
||||
- ✅ **Scalabilité** : observation passive peut suivre 10 Gbps+
|
||||
- ✅ **Maintenance sans downtime** : mises à jour sans coupure réseau
|
||||
|
||||
---
|
||||
|
||||
## 3. Principes fondamentaux
|
||||
|
||||
### PROP-P1 : Observer plus, agir moins
|
||||
|
||||
**Énoncé :**
|
||||
_La SecuBox maximise l'observation passive (logs, stats, détection) et minimise l'injection active (disruption). L'injection est réservée aux menaces confirmées de haute criticité._
|
||||
|
||||
**Implication :**
|
||||
- Logs exhaustifs (DÉPÔT) avant injection
|
||||
- Seuils configurables par primitif (target_success_rate)
|
||||
- Mode **dry-run** disponible pour audit
|
||||
|
||||
---
|
||||
|
||||
### PROP-P2 : Zéro rupture possible
|
||||
|
||||
**Énoncé :**
|
||||
_Aucune configuration OPAD ne peut provoquer une coupure réseau totale. Le retrait physique de la SecuBox doit être sans effet sur la connectivité des clients._
|
||||
|
||||
**Implication :**
|
||||
- Pas de forwarding IPv4/IPv6 (INV-02)
|
||||
- Pas de rôle de gateway
|
||||
- Pas de modification de la table ARP statique des clients
|
||||
|
||||
---
|
||||
|
||||
### PROP-P3 : Surface d'attaque minimale
|
||||
|
||||
**Énoncé :**
|
||||
_La SecuBox en mode OPAD n'expose aucun service directement attaquable depuis le LAN ou le WAN. Elle est invisible au scan réseau._
|
||||
|
||||
**Implication :**
|
||||
- Aucune réponse ICMP echo (INV-05)
|
||||
- Aucune écoute TCP/UDP sur IP LAN (sauf management SSH sur VLAN admin)
|
||||
- Aucune surface WAN (INV-06)
|
||||
|
||||
---
|
||||
|
||||
### PROP-P4 : Escalade explicite et révocable
|
||||
|
||||
**Énoncé :**
|
||||
_Si OPAD est insuffisant (ex: TLS C2), la SecuBox peut passer en mode escaladé (DHCP force-gateway) pour activer l'interception. Ce mode est explicite, journalisé, et révocable sans redémarrage._
|
||||
|
||||
**Implication :**
|
||||
- Mode **opad-with-escalation** disponible
|
||||
- Rollback 4R obligatoire avant escalade
|
||||
- Event OPAD_ESCALATE → journal audit (CSPN)
|
||||
|
||||
---
|
||||
|
||||
## 4. Invariants OPAD
|
||||
|
||||
### Table des invariants
|
||||
|
||||
| ID | Invariant | Description | Conséquence |
|
||||
|----|-----------|-------------|-------------|
|
||||
| **INV-01** | **Retrait sans rupture** | Débrancher physiquement la SecuBox ne provoque aucune coupure réseau | Architecture off-path obligatoire |
|
||||
| **INV-02** | **Aucun forwarding** | La SecuBox ne forward jamais le trafic utilisateur (pas de rôle bridge/router) | Pas de `/proc/sys/net/ipv4/ip_forward=1` |
|
||||
| **INV-03** | **Journalisation systématique** | Toute injection active génère un event **ALERTE·DÉPÔT** avant l'injection | Traçabilité CSPN complète |
|
||||
| **INV-04** | **Marquage des échecs** | Les injections perdues (race échouée) sont loguées avec code **OPAD_INJECT_LOST** | Métrique de taux de succès |
|
||||
| **INV-05** | **Silence LAN** | La SecuBox ne répond jamais à ICMP echo, ARP who-has (sauf injection ARP-R), scan TCP | Invisibilité réseau |
|
||||
| **INV-06** | **Surface WAN nulle** | Aucun port ouvert sur IP WAN (même pas SSH) | Attaque WAN impossible |
|
||||
| **INV-07** | **Fail-silent** | En cas de crash du daemon WALL, le réseau continue sans protection (pas de fail-closed) | Disponibilité > sécurité |
|
||||
| **INV-08** | **Escalade révocable** | Tout mode escaladé (in-path) doit pouvoir revenir en OPAD sans redémarrage | Commande `opad revert` disponible |
|
||||
|
||||
---
|
||||
|
||||
## 5. Primitifs d'injection
|
||||
|
||||
### 5.1 DNS-R (DNS Race)
|
||||
|
||||
#### 5.1.1 Mécanisme
|
||||
|
||||
La SecuBox écoute les requêtes DNS (port 53 UDP) en mode promiscuous. Lorsqu'une requête correspond à une règle de blocage (malware domain, C2, phishing), elle injecte une **réponse DNS falsifiée** avec un TTL court, avant que le resolver légitime ne réponde.
|
||||
|
||||
**Condition de succès :** Réponse OPAD arrive avant la réponse du resolver légitime (typiquement < 10ms).
|
||||
|
||||
#### 5.1.2 Paramètres
|
||||
|
||||
| Paramètre | Type | Valeur par défaut | Description |
|
||||
|-----------|------|-------------------|-------------|
|
||||
| `enabled` | bool | `true` | Activer DNS-R |
|
||||
| `target_success_rate` | float | `0.99` | Taux de race gagnée visé (99%) |
|
||||
| `modes` | list | `["nxdomain", "sinkhole"]` | Modes de réponse |
|
||||
| `sinkhole_ip` | IPv4 | `10.254.254.254` | IP de sinkhole (si mode sinkhole) |
|
||||
| `ttl` | int | `60` | TTL de la réponse injectée (secondes) |
|
||||
| `blocklists` | list | `["crowdsec", "abuse.ch"]` | Sources de domaines malveillants |
|
||||
| `dry_run` | bool | `false` | Log uniquement, pas d'injection |
|
||||
|
||||
#### 5.1.3 Modes de réponse
|
||||
|
||||
- **nxdomain** : RCODE=3 (domain does not exist)
|
||||
- **sinkhole** : IP de sinkhole (captive portal ou honeypot)
|
||||
- **redirect_captive** : Redirection vers page d'avertissement SecuBox
|
||||
|
||||
#### 5.1.4 Journalisation
|
||||
|
||||
```json
|
||||
{
|
||||
"event": "OPAD_DNS_RACE",
|
||||
"timestamp": "2026-05-12T14:32:01.234Z",
|
||||
"src_ip": "192.168.1.42",
|
||||
"query": "evil-c2.example.com",
|
||||
"qtype": "A",
|
||||
"action": "sinkhole",
|
||||
"sinkhole_ip": "10.254.254.254",
|
||||
"result": "success",
|
||||
"race_time_ms": 4.2
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 5.2 DHCP-R (DHCP Race)
|
||||
|
||||
#### 5.2.1 Mécanisme
|
||||
|
||||
La SecuBox écoute les DHCPDISCOVER (broadcast) et injecte un **DHCPOFFER falsifié** avant le serveur DHCP légitime. L'offre OPAD peut :
|
||||
- **Quarantaine** : proposer une IP isolée (VLAN quarantaine)
|
||||
- **Redirect gateway** : forcer la SecuBox comme gateway (mode escaladé)
|
||||
- **Deny** : offre avec bail expiré immédiatement (DoS ciblé)
|
||||
|
||||
#### 5.2.2 Paramètres
|
||||
|
||||
| Paramètre | Type | Valeur par défaut | Description |
|
||||
|-----------|------|-------------------|-------------|
|
||||
| `enabled` | bool | `false` | Activer DHCP-R (désactivé par défaut) |
|
||||
| `target_success_rate` | float | `0.95` | Taux de race gagnée visé |
|
||||
| `quarantine_pool` | CIDR | `192.168.99.0/24` | Pool d'IP quarantaine |
|
||||
| `lease_time_s` | int | `300` | Durée du bail forcé (5 min) |
|
||||
| `escalate_to_gateway` | bool | `false` | Forcer SecuBox comme gateway (escalade) |
|
||||
|
||||
#### 5.2.3 Journalisation
|
||||
|
||||
```json
|
||||
{
|
||||
"event": "OPAD_DHCP_RACE",
|
||||
"timestamp": "2026-05-12T14:35:22.123Z",
|
||||
"src_mac": "aa:bb:cc:dd:ee:ff",
|
||||
"hostname": "suspect-device",
|
||||
"action": "quarantine",
|
||||
"offered_ip": "192.168.99.42",
|
||||
"result": "success",
|
||||
"race_time_ms": 8.1
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 5.3 RST-I (TCP RST Injection)
|
||||
|
||||
#### 5.3.1 Mécanisme
|
||||
|
||||
La SecuBox analyse les flux TCP établis (via observation de SYN/SYN-ACK) et injecte des **segments RST** avec SEQ/ACK corrects pour terminer immédiatement une connexion identifiée comme malveillante (C2, exfiltration, malware callback).
|
||||
|
||||
**Timing critique :** RST doit arriver avant le prochain segment légitime (fenêtre typique : 50-200ms).
|
||||
|
||||
#### 5.3.2 Paramètres
|
||||
|
||||
| Paramètre | Type | Valeur par défaut | Description |
|
||||
|-----------|------|-------------------|-------------|
|
||||
| `enabled` | bool | `true` | Activer RST-I |
|
||||
| `target_success_rate` | float | `0.90` | Taux de disruption réussie |
|
||||
| `double_ended` | bool | `true` | Envoyer RST aux deux endpoints (client+serveur) |
|
||||
| `timing_window_ms` | int | `100` | Fenêtre d'injection (ms) |
|
||||
| `trigger_sources` | list | `["crowdsec", "suricata"]` | Sources de détection malveillante |
|
||||
|
||||
#### 5.3.3 Journalisation
|
||||
|
||||
```json
|
||||
{
|
||||
"event": "OPAD_RST_INJECT",
|
||||
"timestamp": "2026-05-12T14:40:11.456Z",
|
||||
"src_ip": "192.168.1.42",
|
||||
"dst_ip": "1.2.3.4",
|
||||
"dst_port": 443,
|
||||
"reason": "crowdsec_c2_detected",
|
||||
"double_ended": true,
|
||||
"result": "success"
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 5.4 ARP-R (ARP Redirect)
|
||||
|
||||
#### 5.4.1 Mécanisme
|
||||
|
||||
La SecuBox injecte des **réponses ARP falsifiées** (gratuitous ARP ou réponse à ARP who-has) pour rediriger le trafic d'un client suspect vers un captive portal ou un honeypot, sans modifier la configuration du client.
|
||||
|
||||
**Usage typique :** Quarantaine soft d'un device compromis détecté par NAC/AUTH.
|
||||
|
||||
#### 5.4.2 Paramètres
|
||||
|
||||
| Paramètre | Type | Valeur par défaut | Description |
|
||||
|-----------|------|-------------------|-------------|
|
||||
| `enabled` | bool | `false` | Activer ARP-R (désactivé par défaut) |
|
||||
| `target_success_rate` | float | `0.98` | Taux de race gagnée |
|
||||
| `refresh_interval_s` | int | `60` | Intervalle de rafraîchissement (gratuitous ARP) |
|
||||
| `captive_mac` | MAC | `auto` | MAC du captive portal (auto = MAC SecuBox) |
|
||||
| `target_gateway` | bool | `true` | Rediriger les requêtes vers gateway |
|
||||
|
||||
#### 5.4.3 Journalisation
|
||||
|
||||
```json
|
||||
{
|
||||
"event": "OPAD_ARP_REDIRECT",
|
||||
"timestamp": "2026-05-12T14:45:33.789Z",
|
||||
"target_ip": "192.168.1.42",
|
||||
"target_mac": "aa:bb:cc:dd:ee:ff",
|
||||
"spoofed_ip": "192.168.1.1",
|
||||
"captive_mac": "00:11:22:33:44:55",
|
||||
"result": "success"
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. Modes opératoires
|
||||
|
||||
### 6.1 Mode **opad-only** (défaut canonique)
|
||||
|
||||
**Description :** SecuBox en observation pure + injection active (DNS-R, RST-I). Aucun forwarding, aucun rôle de gateway.
|
||||
|
||||
**Configuration :**
|
||||
|
||||
```toml
|
||||
[wall.opad]
|
||||
mode = "opad-only"
|
||||
primitives = ["dns-r", "rst-i"]
|
||||
|
||||
[wall.opad.dns-r]
|
||||
enabled = true
|
||||
target_success_rate = 0.99
|
||||
|
||||
[wall.opad.rst-i]
|
||||
enabled = true
|
||||
target_success_rate = 0.90
|
||||
```
|
||||
|
||||
**Propriétés :**
|
||||
- ✅ INV-01 à INV-07 respectés
|
||||
- ✅ Zéro latency
|
||||
- ✅ Retrait transparent
|
||||
|
||||
---
|
||||
|
||||
### 6.2 Mode **opad-with-escalation**
|
||||
|
||||
**Description :** OPAD par défaut, avec possibilité d'activer ponctuellement DHCP-R ou ARP-R pour forcer la SecuBox comme gateway (interception TLS).
|
||||
|
||||
**Configuration :**
|
||||
|
||||
```toml
|
||||
[wall.opad]
|
||||
mode = "opad-with-escalation"
|
||||
escalation_trigger = "manual" # ou "auto" (si AUTH détecte menace critique)
|
||||
|
||||
[wall.opad.dhcp-r]
|
||||
enabled = false # activé à la demande
|
||||
escalate_to_gateway = true
|
||||
|
||||
[wall.opad.arp-r]
|
||||
enabled = false
|
||||
```
|
||||
|
||||
**Workflow d'escalade :**
|
||||
|
||||
1. Détection menace critique (ex: TLS C2 non blockable par DNS-R)
|
||||
2. Event `OPAD_ESCALATE_REQUEST` → journal audit
|
||||
3. Snapshot 4R de la config active
|
||||
4. Activation DHCP-R avec `escalate_to_gateway=true`
|
||||
5. Nouveau DHCP lease force gateway → SecuBox devient in-path
|
||||
6. Après résolution : `opad revert` → rollback 4R → retour opad-only
|
||||
|
||||
**Propriétés :**
|
||||
- ✅ INV-08 respecté (escalade révocable)
|
||||
- ⚠️ INV-01 temporairement violé (mode in-path)
|
||||
- ✅ Traçabilité CSPN complète (logs escalade/revert)
|
||||
|
||||
---
|
||||
|
||||
### 6.3 Mode **legacy-in-path** (déprécié)
|
||||
|
||||
**Description :** Mode bridge transparent (D-2025-IDGP-INLINE). Conservé pour compatibilité, mais non recommandé.
|
||||
|
||||
**Status :** Déprécié depuis v2.4.0. Sera supprimé en v3.0.0.
|
||||
|
||||
**Migration :** Utiliser `opad-with-escalation` pour cas nécessitant interception.
|
||||
|
||||
---
|
||||
|
||||
## 7. Profil de configuration 3-broche
|
||||
|
||||
### 7.1 Structure
|
||||
|
||||
La configuration OPAD suit le modèle **3-broche** (3-prong) :
|
||||
|
||||
```
|
||||
/etc/secubox/wall/
|
||||
├── active/
|
||||
│ ├── observation.toml ← Broche 1: Observation
|
||||
│ ├── injection.toml ← Broche 2: Injection
|
||||
│ └── policy.toml ← Broche 3: Politique
|
||||
├── shadow/
|
||||
│ ├── observation.toml
|
||||
│ ├── injection.toml
|
||||
│ └── policy.toml
|
||||
└── rollback/
|
||||
├── R1/ (timestamp: 2026-05-12T14:00:00Z)
|
||||
├── R2/ (timestamp: 2026-05-12T13:00:00Z)
|
||||
├── R3/ (timestamp: 2026-05-12T12:00:00Z)
|
||||
└── R4/ (timestamp: 2026-05-12T11:00:00Z)
|
||||
```
|
||||
|
||||
### 7.2 Broche 1 : Observation
|
||||
|
||||
**Responsabilité :** Définir les sources d'observation (interfaces, SPAN ports, TAP).
|
||||
|
||||
**Exemple :**
|
||||
|
||||
```toml
|
||||
[observation]
|
||||
interfaces = ["eth1", "eth2"] # Interfaces LAN à observer
|
||||
mode = "promiscuous"
|
||||
bpf_filter = "not port 22" # Exclure SSH management
|
||||
|
||||
[observation.span]
|
||||
enabled = true
|
||||
span_port = "eth0" # Port SPAN du switch
|
||||
vlan_strip = true
|
||||
```
|
||||
|
||||
### 7.3 Broche 2 : Injection
|
||||
|
||||
**Responsabilité :** Définir les primitifs d'injection actifs et leurs paramètres.
|
||||
|
||||
**Exemple :**
|
||||
|
||||
```toml
|
||||
[injection.dns-r]
|
||||
enabled = true
|
||||
target_success_rate = 0.99
|
||||
modes = ["nxdomain", "sinkhole"]
|
||||
sinkhole_ip = "10.254.254.254"
|
||||
|
||||
[injection.rst-i]
|
||||
enabled = true
|
||||
target_success_rate = 0.90
|
||||
double_ended = true
|
||||
|
||||
[injection.dhcp-r]
|
||||
enabled = false
|
||||
|
||||
[injection.arp-r]
|
||||
enabled = false
|
||||
```
|
||||
|
||||
### 7.4 Broche 3 : Politique
|
||||
|
||||
**Responsabilité :** Définir les règles de décision (quand injecter).
|
||||
|
||||
**Exemple :**
|
||||
|
||||
```toml
|
||||
[policy]
|
||||
mode = "opad-only"
|
||||
escalation_trigger = "manual"
|
||||
|
||||
[policy.triggers]
|
||||
# DNS-R : bloquer domaines malveillants
|
||||
dns_blocklists = ["crowdsec", "abuse.ch", "phishing-army"]
|
||||
dns_custom_block = ["evil.example.com", "*.malware.net"]
|
||||
|
||||
# RST-I : terminer connexions C2
|
||||
rst_on_crowdsec_alert = true
|
||||
rst_on_suricata_alert = true
|
||||
rst_confidence_threshold = 0.85
|
||||
|
||||
# DHCP-R : quarantaine MAC suspects
|
||||
dhcp_quarantine_sources = ["auth-guardian"]
|
||||
|
||||
# ARP-R : rediriger devices compromis
|
||||
arp_redirect_sources = ["nac"]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 8. Intégration avec les modules
|
||||
|
||||
### 8.1 Table d'intégration
|
||||
|
||||
| Module | Rôle OPAD | Event envoyé vers WALL | Event reçu depuis WALL |
|
||||
|--------|-----------|------------------------|------------------------|
|
||||
| **AUTH** | Fournisseur de décision (ban user → RST-I) | `AUTH_BAN_USER` | `OPAD_RST_SUCCESS` |
|
||||
| **WALL** | Exécuteur OPAD (injection) | — | — |
|
||||
| **BOOT** | Configuration réseau (SPAN setup) | — | `OPAD_INIT_STATUS` |
|
||||
| **MIND** | Analyse comportement → détection anomalies | `MIND_ANOMALY_DETECTED` | `OPAD_INJECT_STATS` |
|
||||
| **ROOT** | Journalisation audit CSPN | — | `OPAD_*` (tous events) |
|
||||
| **MESH** | Sync blacklists entre SecuBox (MirrorNet) | `MESH_BLOCKLIST_UPDATE` | — |
|
||||
|
||||
### 8.2 Flux d'événements
|
||||
|
||||
```
|
||||
┌─────────┐ MIND_ANOMALY_DETECTED ┌──────────┐
|
||||
│ MIND │─────────────────────────────────►│ WALL │
|
||||
└─────────┘ │ (OPAD) │
|
||||
└────┬─────┘
|
||||
┌─────────┐ AUTH_BAN_USER │
|
||||
│ AUTH │─────────────────────────────────►────┤
|
||||
└─────────┘ │
|
||||
│
|
||||
Décision interne
|
||||
(policy.toml)
|
||||
│
|
||||
▼
|
||||
┌────────────────┐
|
||||
│ Injection │
|
||||
│ (DNS-R/RST-I) │
|
||||
└────────┬───────┘
|
||||
│
|
||||
┌────────────────────────────┼────────────────┐
|
||||
│ │ │
|
||||
▼ ▼ ▼
|
||||
┌──────────┐ ┌──────────┐ ┌──────────┐
|
||||
│ ROOT │ │ MIND │ │ AUTH │
|
||||
│ (Audit) │ │ (Stats) │ │(Feedback)│
|
||||
└──────────┘ └──────────┘ └──────────┘
|
||||
OPAD_* OPAD_INJECT_STATS OPAD_RST_SUCCESS
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 9. Journalisation et audit
|
||||
|
||||
### 9.1 Types d'événements
|
||||
|
||||
| Event | Criticité | Description |
|
||||
|-------|-----------|-------------|
|
||||
| `OPAD_INIT` | INFO | Démarrage module OPAD |
|
||||
| `OPAD_DNS_RACE` | ALERTE | Injection DNS-R |
|
||||
| `OPAD_DHCP_RACE` | ALERTE | Injection DHCP-R |
|
||||
| `OPAD_RST_INJECT` | ALERTE | Injection RST-I |
|
||||
| `OPAD_ARP_REDIRECT` | ALERTE | Injection ARP-R |
|
||||
| `OPAD_INJECT_LOST` | WARN | Race perdue (injection échouée) |
|
||||
| `OPAD_ESCALATE` | CRITICAL | Passage en mode escaladé (in-path) |
|
||||
| `OPAD_REVERT` | INFO | Retour mode opad-only |
|
||||
| `OPAD_CONFIG_SWAP` | INFO | Swap active/shadow |
|
||||
| `OPAD_ROLLBACK` | WARN | Rollback 4R activé |
|
||||
|
||||
### 9.2 Format de log
|
||||
|
||||
**Standard :** JSON structuré, un event par ligne, conforme CSPN.
|
||||
|
||||
**Exemple :**
|
||||
|
||||
```json
|
||||
{
|
||||
"timestamp": "2026-05-12T14:32:01.234Z",
|
||||
"module": "wall",
|
||||
"component": "opad",
|
||||
"event": "OPAD_DNS_RACE",
|
||||
"severity": "alert",
|
||||
"src_ip": "192.168.1.42",
|
||||
"src_mac": "aa:bb:cc:dd:ee:ff",
|
||||
"query": "evil-c2.example.com",
|
||||
"qtype": "A",
|
||||
"action": "sinkhole",
|
||||
"sinkhole_ip": "10.254.254.254",
|
||||
"result": "success",
|
||||
"race_time_ms": 4.2,
|
||||
"trigger_source": "crowdsec",
|
||||
"session_id": "opad-20260512-143201-abc123"
|
||||
}
|
||||
```
|
||||
|
||||
**Destination :** `/var/log/secubox/wall/opad.log` (rotation journalière, retention 90j).
|
||||
|
||||
---
|
||||
|
||||
## 10. Périmètre déclaré
|
||||
|
||||
### 10.1 Couvert (◉)
|
||||
|
||||
| Menace | Primitif | Efficacité |
|
||||
|--------|----------|------------|
|
||||
| Malware DNS (C2, phishing) | DNS-R | 99% |
|
||||
| Connexion TCP malveillante (C2, exfiltration) | RST-I | 90% |
|
||||
| Device compromis (quarantaine) | DHCP-R / ARP-R | 95% |
|
||||
| Blocklists dynamiques (CrowdSec, Suricata) | DNS-R + RST-I | 98% |
|
||||
|
||||
### 10.2 Partiel (◐)
|
||||
|
||||
| Menace | Limitation | Solution alternative |
|
||||
|--------|-----------|----------------------|
|
||||
| TLS C2 (SNI chiffré) | DNS-R inefficace si IP hardcodée | Mode escaladé + TLS interception |
|
||||
| HTTP/3 QUIC | RST-I incompatible (UDP) | Blocage nftables en amont |
|
||||
| P2P mesh (Tor, I2P) | Pas de DNS resolution | DPI + RST-I sur détection protocole |
|
||||
|
||||
### 10.3 Hors portée (✕)
|
||||
|
||||
| Menace | Raison | Module responsable |
|
||||
|--------|--------|-------------------|
|
||||
| TLS interception (MITM) | Nécessite in-path | Mode escaladé (hors OPAD canonique) |
|
||||
| Hard drop (blocage nftables) | Pas d'injection, juste drop | WALL nftables |
|
||||
| VLAN isolation | Configuration switch | BOOT netplan |
|
||||
| QoS / rate-limiting | Nécessite in-path | QOS module (à venir) |
|
||||
| Protection WAN (DDoS) | Pas de surface WAN | Upstream (opérateur) |
|
||||
|
||||
---
|
||||
|
||||
## 11. Historique doctrinal
|
||||
|
||||
### 11.1 Version actuelle
|
||||
|
||||
**CM-WALL-OPAD-2026-05** (v2.4.0)
|
||||
- Status : Canonique
|
||||
- Date : 2026-05-12
|
||||
- Auteur : Gérald Kerma
|
||||
|
||||
### 11.2 Versions dépréciées
|
||||
|
||||
| Référence | Nom | Date | Raison dépréciation |
|
||||
|-----------|-----|------|---------------------|
|
||||
| D-2025-IDGP-INLINE | In-line Data Guardian Protocol | 2025-03-15 | Single point of failure, latency |
|
||||
| D-2024-BRIDGE-TRANSPARENT | Bridge transparent nftables | 2024-06-10 | Complexité opérationnelle, fail-closed |
|
||||
|
||||
### 11.3 Migration depuis D-2025-IDGP-INLINE
|
||||
|
||||
**Checklist :**
|
||||
|
||||
1. ✅ Désactiver `ip_forward` et bridge nftables
|
||||
2. ✅ Configurer SPAN port ou TAP sur switch
|
||||
3. ✅ Créer profil 3-broche (observation + injection + policy)
|
||||
4. ✅ Activer DNS-R et RST-I
|
||||
5. ✅ Tester retrait physique SecuBox → pas de coupure réseau
|
||||
6. ✅ Auditer logs → vérifier INV-03 (ALERTE·DÉPÔT avant injection)
|
||||
|
||||
---
|
||||
|
||||
## 12. Références
|
||||
|
||||
### 12.1 Spécifications techniques
|
||||
|
||||
- **SPEC-WALL-OPAD-2026-05.md** : Spécification complète du module WALL OPAD
|
||||
- **SCHEMA-OPAD-CONFIG.json** : Schéma JSON de validation des fichiers TOML
|
||||
- **MODELS-OPAD-EVENTS.json** : Modèles d'événements (pour parsing logs)
|
||||
|
||||
### 12.2 Documentation complémentaire
|
||||
|
||||
- **CSPN-MATRIX-WALL.md** : Mapping critères ANSSI CSPN ↔ invariants OPAD
|
||||
- **OPS-GUIDE-OPAD.md** : Guide opérationnel (installation, monitoring, troubleshooting)
|
||||
- **TEST-SUITE-OPAD.md** : Suite de tests de validation (pytest + scapy)
|
||||
|
||||
### 12.3 Code source
|
||||
|
||||
- **`packages/secubox-wall/api/opad/`** : Implémentation Python (FastAPI)
|
||||
- **`packages/secubox-wall/daemon/opad.c`** : Daemon C (injection bas-niveau)
|
||||
- **`packages/secubox-wall/scripts/opad-cli.sh`** : CLI d'administration
|
||||
|
||||
---
|
||||
|
||||
## Signature
|
||||
|
||||
**Document canonique validé pour production SecuBox v2.4.0+.**
|
||||
|
||||
**Auteur :** Gérald Kerma (CyberMind)
|
||||
**Date :** 2026-05-12
|
||||
**Référence :** CM-WALL-OPAD-2026-05
|
||||
**Version :** 2.4.0
|
||||
**Status :** Canonique
|
||||
|
||||
---
|
||||
|
||||
**EOF**
|
||||
Loading…
Reference in New Issue
Block a user