---
title: "n8n — Automatisation de Workflows SOC"
domain: security
subdomain: soc
phase: 03-response
type: snippet
tags: [n8n, soar, automation, workflow, soc, low-code]
difficulty: beginner
status: stable
updated: "Fri Jun 19 2026 00:00:00 GMT+0000 (Coordinated Universal Time)"
---
## n8n vs Shuffle

```
n8n    → Low-code/no-code général, 400+ intégrations, UI très accessible
Shuffle → SOAR spécialisé sécu, apps security natives, VQL support

Usage SOC :
  n8n    → Workflows simples, notifications, enrichissement rapide
  Shuffle → Orchestration complexe, réponse automatisée avancée
  Les deux peuvent coexister dans un SOC
```

---

## Déploiement Docker

```yaml
# docker-compose.yml
services:
  n8n:
    image: n8nio/n8n:latest
    ports:
      - "5678:5678"
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=admin
      - N8N_BASIC_AUTH_PASSWORD=ChangeMe!2026
      - N8N_HOST=localhost
      - N8N_PORT=5678
      - N8N_PROTOCOL=http
      - WEBHOOK_URL=http://localhost:5678/
      - GENERIC_TIMEZONE=Europe/Paris
      - N8N_ENCRYPTION_KEY=votre_cle_32_chars_aleatoire
    volumes:
      - n8n_data:/home/node/.n8n

volumes:
  n8n_data:
```

```
# Accès : http://localhost:5678
# Login : admin / ChangeMe!2026
```

---

## Concepts n8n

```
Workflow → Séquence de nodes connectés
Node     → Bloc d'action (HTTP request, IF, Webhook, Email...)
Trigger  → Node de départ (Webhook, Schedule, Email...)
Credential → Config sécurisée d'accès aux APIs
```

---

## Workflow 1 — Alerte Wazuh → Slack + TheHive

```
Trigger : Webhook
  URL : http://n8n:5678/webhook/wazuh-alerts
  Method : POST
  ↓
Node : IF (Condition)
  Level >= 10 ?
  ↓ Oui                    ↓ Non
Node : TheHive (HTTP)      Node : Slack (message simple)
  POST /api/v1/case          #soc-info
  title: Alert...            "ℹ️ Alerte niveau {{level}}"
  ↓
Node : Slack (#soc-alerts)
  "🚨 Case créé #{{case_id}}"
```

```json
// Configuration node HTTP Request → TheHive
{
  "method": "POST",
  "url": "http://thehive:9000/api/v1/case",
  "authentication": "predefinedCredentialType",
  "nodeCredentialType": "httpHeaderAuth",
  "sendHeaders": true,
  "headerParameters": {
    "Authorization": "Bearer {{$credentials.token}}"
  },
  "sendBody": true,
  "contentType": "json",
  "body": {
    "title": "Wazuh: {{$json.rule.description}}",
    "severity": 2,
    "tags": ["wazuh", "auto"],
    "description": "Agent: {{$json.agent.name}}\nRule: {{$json.rule.id}}\nLevel: {{$json.rule.level}}"
  }
}
```

---

## Workflow 2 — Schedule : Rapport quotidien SOC

```
Trigger : Schedule (tous les jours à 08h00)
  ↓
Node : HTTP Request → Wazuh API
  GET /security/events?limit=100&level=10
  (alertes niveau 10+ des dernières 24h)
  ↓
Node : HTTP Request → TheHive API
  GET /api/v1/case?status=Open
  (cases ouverts)
  ↓
Node : HTTP Request → MISP API
  GET /events/restSearch?last=1d
  (nouveaux events MISP)
  ↓
Node : Code (JavaScript)
  Assembler le rapport :
  "📊 Rapport SOC — {{$today}}
  Alertes Wazuh (lvl 10+) : {{alertes.length}}
  Cases TheHive ouverts   : {{cases.length}}
  Nouveaux events MISP    : {{misp.length}}"
  ↓
Node : Email / Slack
  Envoyer le rapport à #soc-daily
```

---

## Workflow 3 — Enrichissement IOC automatique

```
Trigger : Webhook (TheHive crée un observable)
  ↓
Node : Switch (type d'observable)
  ip → AbuseIPDB + VirusTotal
  domain → URLScan.io + VirusTotal
  hash → VirusTotal
  ↓
Node : HTTP Request → API enrichissement
  ↓
Node : Code — Calculer score de risque
  score = 0
  if vt_positifs > 5: score += 50
  if abuse_score > 70: score += 30
  if urlscan_malicious: score += 20
  ↓
Node : IF score > 60
  ↓ Oui                        ↓ Non
TheHive : Update observable    TheHive : Add tag "benign"
  tag: "malicious"
  note: "Score: {{score}}"
  ↓
Slack : "#soc-ioc — IOC {{value}} score {{score}}/100"
```

---

## Credentials — Configuration sécurisée

```
# Dans n8n : Settings > Credentials > Add Credential

TheHive :
  Type : Header Auth
  Name : X-Organisation-API-Key ou Authorization
  Value : Bearer THEHIVE_API_KEY

MISP :
  Type : Header Auth
  Name : Authorization
  Value : MISP_API_KEY

Wazuh :
  Type : Basic Auth
  User : wazuh-wui
  Password : WAZUH_PASSWORD

Slack :
  Type : OAuth2 ou Webhook URL
  Webhook URL : https://hooks.slack.com/services/XXX

VirusTotal :
  Type : Header Auth
  Name : x-apikey
  Value : VT_API_KEY
```

---

## Workflow 4 — Réponse phishing automatisée

```
Trigger : Email (IMAP — boîte phishing@company.com)
  ↓
Node : Extract Email Data
  from, subject, body, attachments, URLs
  ↓
Node : HTTP → URLScan.io (analyser chaque URL)
  ↓
Node : IF URL malveillante
  ↓ Oui
  Node : MISP — Créer event (domain malveillant)
  Node : TheHive — Créer case "Phishing signalé"
  Node : Email — Répondre à l'utilisateur
    "Merci pour le signalement. Email confirmé malveillant.
     Ne pas cliquer sur les liens. Rapport en cours."
  ↓ Non
  Node : Email — Répondre
    "Merci. Email analysé, aucune menace détectée."
```

---

## Templates de nodes utiles

```javascript
// Node Code — Parser une alerte Wazuh
const alert = $input.first().json;
return [{
  json: {
    title: `Wazuh Alert: ${alert.rule?.description}`,
    agent: alert.agent?.name || 'unknown',
    ip: alert.data?.srcip || alert.agent?.ip,
    level: alert.rule?.level,
    ruleId: alert.rule?.id,
    timestamp: alert.timestamp,
    severity: alert.rule?.level >= 12 ? 3 : alert.rule?.level >= 8 ? 2 : 1,
  }
}];
```

```javascript
// Node Code — Formatter rapport Markdown
const alerts = $('Wazuh-Alerts').all();
const cases = $('TheHive-Cases').all();

const report = `## 📊 Rapport SOC — ${new Date().toLocaleDateString('fr-FR')}

**Alertes critiques (24h):** ${alerts.length}
**Cases ouverts:** ${cases.length}

### Top alertes:
${alerts.slice(0,5).map(a =>
  `- [${a.json.rule?.level}] ${a.json.rule?.description}`
).join('\n')}`;

return [{ json: { report } }];
```
