32 lines
2.6 KiB
Markdown
32 lines
2.6 KiB
Markdown
# Veille Infra v2 — montée + fix activation n8n "Version not found"
|
|
|
|
**Date** : 15/07/2026 · **Sphère** : infra · **Statut** : opérationnel
|
|
|
|
## Objectif
|
|
Digest infra quotidien unique : **santé** (conteneurs, disques, SMART, certs, VPS Contabo, backup USB) + **veille techno/CVE** (releases GitHub, CVE NVD), synthèse par **LLM gratuit** (Bifrost/gemini-2.5-flash), livré **Email + Telegram**.
|
|
|
|
## Architecture
|
|
- **Collecteur** `/volume1/docker/veille-infra/veille_infra.py` (py3.8 + requests, aucun secret dans le script).
|
|
- Santé : `docker ps` (Best0f, sans sudo) ; `df -Ph /volume1 /` ; SMART best-effort → `need_root` si non-root ; certs `acme/*bolbol*` (glob échappé) ; VPS via `tailscale ping` sinon "non vérifié" (jamais de faux "injoignable") ; backup `/volumeUSB1`.
|
|
- Veille : GitHub `releases/latest` (n8n, gitea, portainer, crowdsec, baserow) ; CVE NVD par mot-clé.
|
|
- Verdict OK/ATTENTION/CRITIQUE + alertes. Synthèse LLM si `/volume1/docker/veille-infra/.bifrost_vk` (chmod 600) présent → POST `http://192.168.100.33:3085/v1/chat/completions` header `x-bf-vk`, model `gemini-2.5-flash`.
|
|
- Rendu HTML (navy #1A1A2E / or #B8862A, footer Nyora) + Telegram, POST `https://n8n.nd.i234.me/webhook/veille-infra`.
|
|
- Debug : `VEILLE_DUMP=1` → écrit `last_payload.json`, pas de POST.
|
|
- **Workflow livraison** n8n `X51xQsOpXeedaBKt` : Webhook POST `veille-infra` → Email (IK.ME SMTP `7eBO8ta5EiZOVufh`) + Telegram (ND_Telegram `OyOHh6jAzCDsiBux`, chat 2084513684). Creds auto-assignées. E2E OK (exec 32550 success).
|
|
- **Ordonnancement** : tâche DSM Planificateur **root**, quotidienne 08:00 Tunis, `python3 /volume1/docker/veille-infra/veille_infra.py` (root requis pour SMART). À créer via UI web DSM.
|
|
|
|
## FIX RÉUTILISABLE — publish n8n "Version not found"
|
|
Depuis la coupure/purge, `workflow_entity.versionId` peut pointer vers une version **absente** de `workflow_history` (les updates MCP changent versionId sans historiser) → `publishVersion` échoue en FK. **La recréation NE corrige PAS. Le restart n8n NON PLUS.**
|
|
|
|
Correctif (DB Postgres `n8n-DB`, rayon d action = 1 ligne) :
|
|
```sql
|
|
select "versionId" from workflow_history where "workflowId"='<WF>' order by "createdAt" desc limit 1;
|
|
update workflow_entity set "versionId"='<versionId-historisée>' where id='<WF>';
|
|
```
|
|
puis `publish_workflow` MCP → actif (`active=t`, `activeVersionId==versionId`).
|
|
|
|
## Dette sécu (rotation)
|
|
- Token Telegram **en clair** dans le node Code de "INFRA | OpenHuman Watch" (`9MkE8Fx3ZlY485Y5`) → roter + passer sur credential ND_Telegram.
|
|
- Mot de passe Postgres n8n faible (`n8npass`).
|
|
- VK Bifrost `bfk-0c…` (déjà flaggée, transitée en clair).
|