diff --git a/docs/ai/restart/HANDOFF_AGENT_OPERATIVO_20260311.md b/docs/ai/restart/HANDOFF_AGENT_OPERATIVO_20260311.md new file mode 100644 index 0000000..7536df5 --- /dev/null +++ b/docs/ai/restart/HANDOFF_AGENT_OPERATIVO_20260311.md @@ -0,0 +1,170 @@ +# Handoff Operativo Agent - NetGescon (11-03-2026) + +## 1. Stato Attuale (confermato) + +- Host principale: `192.168.0.53` +- Gitea attivo: `http://192.168.0.53:3000` +- SSH Git attivo: `git.netgescon.it:2222` +- DNS interno (Technitium) attivo: `http://192.168.0.53:5380` +- Edge (Caddy) attivo in lab: `8080/8443` +- Condivisione HTTP cartella workspace attiva: `http://192.168.0.53:8000/` + +## 2. Repository richiesto e gia creato + +Repository creato (vuoto, senza README): + +- `michele/netgescon-day0` + +URL clone: + +- SSH: `ssh://git@git.netgescon.it:2222/michele/netgescon-day0.git` +- HTTPS: `https://git.netgescon.it/michele/netgescon-day0.git` + +## 3. Accessi e credenziali + +File credenziali aggiornato da usare: + +- `CREDENZIALI_UI_LOCALI_20260311_121500.md` + +Contenuti principali: + +- DNS Technitium +- Gitea utente principale `michele` +- Gitea utente recovery `admin-recovery` (lasciare attivo) + +Nota operativa: + +- conservare le password nel password manager +- ruotare password dopo i test iniziali + +## 4. Procedura Git minima per macchina sviluppo + +### 4.1 Setup chiave SSH + +```bash +mkdir -p ~/.ssh && chmod 700 ~/.ssh +ssh-keygen -t ed25519 -C "dev-staging-netgescon" -f ~/.ssh/id_ed25519_netgescon -N "" +eval "$(ssh-agent -s)" +ssh-add ~/.ssh/id_ed25519_netgescon +cat ~/.ssh/id_ed25519_netgescon.pub +``` + +Aggiungere la chiave pubblica in Gitea (utente sviluppo), poi: + +```bash +cat >> ~/.ssh/config <<'EOF' + +Host git-netgescon + HostName git.netgescon.it + User git + Port 2222 + IdentityFile ~/.ssh/id_ed25519_netgescon + IdentitiesOnly yes + StrictHostKeyChecking accept-new +EOF +chmod 600 ~/.ssh/config +``` + +Test: + +```bash +ssh -T git-netgescon +``` + +### 4.2 Collegamento repository + +```bash +cd /percorso/progetto +git remote remove origin 2>/dev/null || true +git remote add origin ssh://git@git.netgescon.it:2222/michele/netgescon-day0.git +git push -u origin main +``` + +## 5. Aggiornamento staging dopo sviluppo + +Variabili `.env` minime su staging: + +```env +NETGESCON_UPDATE_URL=https://updates.netgescon.it +NETGESCON_UPDATE_CHANNEL=free +``` + +Per licensed: + +```env +NETGESCON_LICENSED_CODE=CLIENTA +NETGESCON_LICENSED_AUTH=tokenA +``` + +Comandi: + +```bash +cd /var/www/netgescon +php artisan optimize:clear +php artisan config:clear +php artisan route:clear +php artisan netgescon:update --channel=free +php artisan netgescon:update --channel=free --apply +``` + +## 6. DNS interno per siti da gestire + +In Technitium aggiungere record A verso backend corretti (inizialmente anche verso `.53` se serve): + +- `git.netgescon.it` +- `updates.netgescon.it` +- `staging.netgescon.it` +- `www.netgescon.it` +- `demo.netgescon.it` +- `test.netgescon.it` + +Poi impostare i client LAN (o DHCP) a usare il DNS interno. + +## 7. Domanda sicurezza: bastano solo update APT? + +No. `apt update && apt upgrade` e necessario ma non sufficiente. + +Serve anche: + +1. aggiornare immagini/container Docker +2. aggiornare Gitea e DB in modo controllato +3. aggiornare configurazioni TLS/certificati +4. abilitare aggiornamenti automatici di sicurezza (`unattended-upgrades`) +5. riavviare quando richiesto da kernel/libc +6. backup + test restore periodico +7. hardening SSH e monitoraggio log + +## 8. Filtro extra anti brute-force (consigliato) + +Sì, fortemente consigliato visto che questa macchina diventa punto di accesso centrale. + +Implementazione suggerita (ordine): + +1. `fail2ban` per SSH e web auth +2. rate limit su reverse proxy +3. accesso admin solo via VPN +4. SSH solo con chiavi (no password) +5. 2FA su Gitea +6. opzionale: `crowdsec` per protezione avanzata collaborativa + +Regole minime immediate: + +- jail `sshd` +- jail per login Gitea/Nginx (in base ai log) +- ban progressivo su tentativi ripetuti + +## 9. File utili da consultare + +- `AGENT_NETGESCON_GIT_STAGING_192.168.0.53.md` +- `BRIEF_AGENT_PROD_SVILUPPO_192.168.0.53.md` +- `NAS_BACKUP_SOLO_192.168.0.53.md` +- `AGENT_MULTI_PROJECT_EDGE_DNS_TEMPLATE.md` +- `CONDIVISIONE_WORKSPACE_LAN.md` + +## 10. Accesso rapido ai file senza copia/incolla RDP + +Aprire dal browser della macchina remota: + +- `http://192.168.0.53:8000/` + +Da li e possibile scaricare tutti i file `.md` necessari. diff --git a/docs/ai/restart/START-HERE-NETGESCON-DAY0.md b/docs/ai/restart/START-HERE-NETGESCON-DAY0.md new file mode 100644 index 0000000..1992d23 --- /dev/null +++ b/docs/ai/restart/START-HERE-NETGESCON-DAY0.md @@ -0,0 +1,85 @@ +# Start Here - NetGescon Day-0 + +Data aggiornamento: 11-03-2026 + +## Obiettivo di questo file + +Permettere ripresa immediata del lavoro in `netgescon-day0` senza perdere contesto tra un workspace e l'altro. + +## Stato confermato + +- Repository Day-0 attivo: `/home/michele/netgescon/netgescon-day0` +- Remote Git attivo: `ssh://git@192.168.0.53:2222/michele/netgescon-day0.git` +- Branch principale: `main` +- Ultimo commit noto: `f52e56d` + +## Verifica rapida in 30 secondi + +```bash +cd /home/michele/netgescon/netgescon-day0 +git status --short --branch +git log --oneline -n 5 +php artisan list | head -n 30 +php artisan list | grep -E "netgescon:update|distribution:manage" | head -n 20 +``` + +## Documenti da leggere in ordine (ripartenza agent) + +1. `docs/ai/restart/START-HERE-NETGESCON-DAY0.md` (questo file) +2. `docs/ai/restart/HANDOFF_AGENT_OPERATIVO_20260311.md` +3. `docs/RUNBOOK-DISTRIBUZIONE-REMOTA-NETGESCON.md` +4. `docs/distribuzione-update-netgescon.md` +5. `Miki-Bug-workspace/AGENT_GIT.MD` + +## Modifiche chiave gia presenti nel Day-0 + +- `config/distribution.php` +- `app/Console/Commands/NetgesconDistributionPullCommand.php` +- `app/Http/Controllers/Api/DistributionController.php` +- `routes/api.php` +- `bootstrap/app.php` +- `scripts/ops/netgescon-baseline-freeze.sh` +- `scripts/ops/netgescon-publish-manifest.sh` +- fix provider Filament in `app/Providers/Filament/AdminFilamentPanelProvider.php` + +## Flusso operativo da ora + +1. Sviluppo e commit solo in `netgescon-day0`. +2. Push su `origin/main` (Gitea Day-0). +3. Build package update e publish manifest. +4. Apply su staging con `php artisan netgescon:update --channel=free --apply`. +5. Smoke test rete e funzionali minimi. + +## Comandi base sviluppo + staging + +```bash +# sviluppo +cd /home/michele/netgescon/netgescon-day0 +git pull --rebase origin main + +# dopo modifiche +git add -A +git commit -m "feat: " +git push origin main + +# staging +cd /var/www/netgescon +php artisan netgescon:update --channel=free +php artisan netgescon:update --channel=free --apply +``` + +## Nota sicurezza operativa + +- Mantieni `22` chiuso all'esterno e usa VPN/LAN per amministrazione. +- Mantieni `2222` solo per Git/SSH key-based. +- Attiva `fail2ban` su SSH e login web. +- Abilita 2FA su Gitea per account admin/dev. + +## Prossimo step consigliato + +Eseguire un ciclo completo con una modifica piccola reale: + +1. commit su Day-0, +2. publish package, +3. apply staging, +4. checklist smoke test finale.