mcp-nas audit manche 4: rotation credentials fuités (Portainer/Gitea/n8n/Baserow/Hermes/NyoraNotes/DSM/tokens) + pièges méthode
This commit is contained in:
parent
07995fdec3
commit
a1f84721a9
|
|
@ -3,7 +3,7 @@
|
|||
**Tags** : infra, securite, mcp-nas, rce, docker-socket, secrets, rotation
|
||||
**Périmètre** : conteneur `linux-mcp-nas` (`mcp-nas.nd.i234.me`, port hôte 3042→8000, réseau Docker `n8n`).
|
||||
**Complète** : `common/audit-securite-reseau-nas-20260703.md` (couche réseau/WAN). Ici = **couche applicative**.
|
||||
**Statut** (MàJ 2026-07-09) : **P0 fermés** (exposition anonyme, docker.sock, clés SSH Contabo) + **durcissement non-disruptif manche 3 fait** (rédaction audit.log, scrub historique, token Gitea scopé). **Reste** : rotation des credentials fuités (disruptif, à séquencer) + run non-root. Détail en bas.
|
||||
**Statut** (MàJ 2026-07-09 manche 4) : **P0 fermés** + durcissement manche 3 + **ROTATION des credentials fuités faite** (Portainer, Gitea bolbol, n8n, Baserow, 3 logins web Hermes, NyoraNotes, DSM/sudo, tokens Gitea). **Reste** : SMTP OVH (externe), Bifrost VKs (différé), nettoyage docs/skills agents, run non-root. Détail en bas.
|
||||
|
||||
## Verdict
|
||||
|
||||
|
|
@ -83,3 +83,19 @@ curl -s -o /dev/null -w "%{http_code}\n" -X POST https://mcp-nas.nd.i234.me/mcp
|
|||
curl -s -X POST https://mcp-nas.nd.i234.me/<secret>/mcp -H 'Content-Type: application/json' \
|
||||
-H 'Accept: application/json, text/event-stream' -d '{...initialize...}'
|
||||
```
|
||||
|
||||
## Manche 4 (2026-07-09) — ROTATION des credentials fuités (piloté service par service)
|
||||
|
||||
Le préfixe réutilisé couvrait **~11 familles** (pas 5) + fuite dans **context-hub/.env** (2e magasin central, `root:root 600` → invisible au `grep` en Best0f, lisible via SMB Mac ou `sudo`) et dans les **docs/skills d'agents Hermes**. **Piège grep réutilisable** : un `find`/`grep` lancé en Best0f sur le NAS **rate les fichiers root-600** ; scanner depuis le Mac (SMB) OU en `sudo`.
|
||||
|
||||
**Rotés + vérifiés (services healthy)** :
|
||||
- **Portainer** : API `PUT /api/users/1` avec champ **`newPassword`** (pas `password` → 400). Auth `POST /api/auth`.
|
||||
- **Gitea bolbol** : `docker exec -u git gitea gitea admin user change-password -u bolbol -p <new>` (en 1.21, **PAS** de flag `--must-change-password`).
|
||||
- **n8n / Baserow** : compte **owner en base** (pas de basic-auth env) → changés en UI ; les `*_PASSWORD` des `.env` ne sont que des copies de référence à répercuter.
|
||||
- **NyoraNotes** : `authenticate()` fait un `secrets.compare_digest` **plaintext** sur `NYORA_PASS_{TT,NYORA,PERSO}` (env) ; les agents utilisent le **Bearer token**, pas le mdp → rotation = MAJ `.env` + restart.
|
||||
- **3 logins web Hermes** : var interne `HERMES_PASSWORD` = `${HERMES_<i>_PASSWORD}` via le **compose RACINE** `hermes-platform/docker-compose.yml`. **Piège** : les conteneurs n'ont **aucun label compose** → `compose up --force-recreate <workspace>` **cascade sur l'agent** (a mis agent-tt down). **Méthode fiable = `docker stop <c> && docker rm <c>` puis `docker compose up -d --no-deps <service>`** depuis le racine.
|
||||
- **DSM/sudo Best0f** : `sudo /usr/syno/sbin/synouser --setpw Best0f <new>` (**chemin complet** requis, sinon `command not found`). `ssh` étant **par clé**, aucun lockout. Mdp hardcodé dans ~23 fichiers (dsm_auth.py liste de spray, ssh_dsm.py, dsm_check_*.py, context-hub/.env, docs) → tous mis à jour.
|
||||
- **Tokens Gitea** : 13 tokens bolbol (plusieurs `all`/`write:admin`). `GITEA_TOKEN_NYORA` fuité (`10ccc28dc`) roté → token scopé neuf ; **7 tokens révoqués** (`DELETE /api/v1/users/bolbol/tokens/<id>`). Scripts deploy migrés vers `GITEA_DEPLOY_TOKEN`.
|
||||
- **Scrub** : 648 secrets masqués dans 100 fichiers de log (sessions/cron/claude_contexte) via `sudo python3`.
|
||||
|
||||
**Nouvelles valeurs** : PAS dans ce runbook — remises à Nabil (Bitwarden). **Reste** : SMTP OVH (externe), **Bifrost VKs** (différé : DB fragile + réimport workflow n8n), SSH_PASS_NYORA, re-scoper token `nyora-notes-claude-code`, nettoyer docs/skills, run non-root.
|
||||
|
|
|
|||
Loading…
Reference in New Issue