diff --git a/README.md b/README.md index 274b76b..064d849 100644 --- a/README.md +++ b/README.md @@ -56,11 +56,18 @@ Poi apri `http://:8888`: - *autofirmato* (RSA 4096, 10 anni, SAN con hostname, alias e IP: LAN e demo; **non** per WhatsApp, che richiede un certificato valido). 4. **Intelligenza artificiale** โ€” provider del modello testuale: `fake` (demo, nessuna - chiave), OpenAI o Anthropic con API key. Modificabile dal portale. + chiave) oppure OpenAI con API key (Anthropic e' stato rimosso da IRIDE 0.100.58). + Modificabile dal portale; ogni Azienda puo' avere il proprio abbonamento. 5. **Utente admin** โ€” primo accesso al portale (password โ‰ฅ 12 caratteri, hash bcrypt). 6. **Installa** โ€” riepilogo e avvio; il log dell'installazione scorre nella pagina. A fine wizard la porta 8888 viene chiusa e `/opt/iride-setup-pkg` rimosso. + +Dalla 0.3.0 l'installazione nasce allineata a IRIDE 0.100.93 e successive: chiave master in +`/etc/iride/master.key` con `credentials.json` sigillato (**conservarne subito una copia fuori +dal server**), sito nginx completato con le location del modello del prodotto (cache della +console, service worker), aggiornamento dalla console attivo (`iride-updater.path`) e +`iride-health` che controlla anche readiness, chiave master e aggiornamento dalla console. Aggiornamenti successivi: `sudo bash /opt/iride/app/scripts/update.sh` (usa il token della licenza, mai credenziali personali). Verifica rapida: `iride-health`. diff --git a/VERSION b/VERSION index 0c62199..0d91a54 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.1 +0.3.0 diff --git a/checks/health.sh b/checks/health.sh index 7b63509..0804695 100755 --- a/checks/health.sh +++ b/checks/health.sh @@ -11,6 +11,8 @@ echo "IRIDE health check" for svc in iride-api iride-worker iride-scheduler; do systemctl is-active --quiet "$svc" && pass "$svc attivo" || fail "$svc non attivo (journalctl -u $svc -n 50)" done +systemctl is-active --quiet iride-updater.path && pass "aggiornamento dalla console attivo" || fail "iride-updater.path non attivo" +[[ -f /etc/iride/master.key ]] && pass "chiave master presente" || fail "chiave master assente: /etc/iride/master.key" systemctl is-active --quiet nginx && pass "nginx attivo" || fail "nginx non attivo" nginx -t >/dev/null 2>&1 && pass "configurazione nginx valida" || fail "nginx -t fallito" @@ -23,6 +25,12 @@ if [[ -n "${HEALTH:-}" ]]; then else fail "API non risponde su http://127.0.0.1:8080/api/health" fi +READY="$(curl -fsS http://127.0.0.1:8080/api/health/ready 2>/dev/null)" +if [[ -n "$READY" ]] && echo "$READY" | python3 -c 'import json,sys; sys.exit(0 if json.load(sys.stdin).get("ready") else 1)'; then + pass "readiness: pronta" +else + fail "readiness: non pronta ($(echo "$READY" | python3 -c 'import json,sys; d=json.load(sys.stdin); print(d.get("failed"))' 2>/dev/null))" +fi [[ -f /opt/iride/data/iride.db ]] && pass "database presente" || fail "database assente in /opt/iride/data" PERM="$(stat -c '%a %U' /opt/iride/config/iride.json 2>/dev/null)" diff --git a/setup.html b/setup.html index 120d297..efb98f9 100644 --- a/setup.html +++ b/setup.html @@ -209,7 +209,7 @@ html,body{height:100%;background:var(--bg);color:var(--text);font-family:var(--s
๐Ÿง  Intelligenza artificiale
Provider del modello testuale. "Fake" รจ deterministico e senza costi: va bene per demo e collaudo; la chiave si puรฒ inserire o cambiare dopo dal portale.
-
+
@@ -366,8 +366,7 @@ function onProviderChange() { const p = g('ai_provider'); document.getElementById('ai-key-block').style.display = p === 'fake' ? 'none' : 'block'; const m = document.getElementById('ai_model'); - if (p === 'openai' && (!m.value || m.value.startsWith('claude'))) m.value = 'gpt-4.1-mini'; - if (p === 'anthropic' && (!m.value || m.value.startsWith('gpt'))) m.value = 'claude-sonnet-4-6'; + if (p === 'openai' && (!m.value || m.value.startsWith('claude') || m.value === '')) m.value = 'gpt-4.1-mini'; } async function uploadSsl(input, type) { diff --git a/setup_server.py b/setup_server.py index 2240044..40da406 100644 --- a/setup_server.py +++ b/setup_server.py @@ -42,7 +42,7 @@ _LICENSE_PUBLIC_KEY_B64 = "GMRsZMoxOlCBiJU66EsQcj0ZO0gVd0GHB5LelEo/hns=" # โ”€โ”€ Clone: username Basic Auth del bot Gitea al quale appartiene il token. # Le licenze IRIDE lo portano nel payload (gitea_user); fallback al bot ARGOS. -GITEA_BOT_USER = "argos-portal-bot" +GITEA_BOT_USER = "iride-portal-bot" GITEA_REPO_PATH = "/tecnotel/iride.git" # โ”€โ”€ Heartbeat verso il portale vendor (stessa chiave di registrazione ARGOS) โ”€โ”€ @@ -164,7 +164,7 @@ def generate_iride_json(data): hostname = data.get("domain", "").strip().lower() aliases = [a.strip().lower() for a in data.get("aliases", "").split() if a.strip()] provider = data.get("ai_provider", "fake") or "fake" - if provider not in ("fake", "openai", "anthropic"): + if provider not in ("fake", "openai"): # Anthropic rimosso da IRIDE 0.100.58 provider = "fake" api_key = data.get("ai_api_key", "").strip() cfg = { @@ -196,7 +196,6 @@ def generate_iride_json(data): "realtime": {"provider": "openai", "options": {"model": ""}}, "providers": { "openai": {"api_key": api_key if provider == "openai" else "", "base_url": "https://api.openai.com/v1"}, - "anthropic": {"api_key": api_key if provider == "anthropic" else ""}, }, "limits": {"max_ai_turns": 20, "daily_budget_micros": 5000000}, }, @@ -417,10 +416,38 @@ extendedKeyUsage = serverAuth run("nginx -t && systemctl restart nginx") log("Nginx configurato") + # 10b. Segreti a riposo (IRIDE B-200): chiave master fuori da /opt/iride, poi + # credentials.json sigillato. Stessi permessi e stesso script di update.sh. + log("โ”€โ”€ Chiave master e sigillo dei segreti โ”€โ”€") + key_dir, key_file = Path("/etc/iride"), Path("/etc/iride/master.key") + if not key_file.exists(): + key_dir.mkdir(parents=True, exist_ok=True) + run(f"chown root:{APP_USER} {key_dir} && chmod 750 {key_dir}") + run(f"umask 027 && head -c 32 /dev/urandom | base64 > {key_file}") + run(f"chown root:{APP_USER} {key_file} && chmod 640 {key_file}") + log(f"Chiave master creata in {key_file}: conservarne una copia fuori dal server") + res = run(f"sudo -u {APP_USER} env IRIDE_CONFIG_DIR={CONFIG_DIR} IRIDE_DATA_DIR={DATA_DIR} IRIDE_MASTER_KEY_FILE={key_file} " + f"{APP_DIR}/backend/venv/bin/python {APP_DIR}/scripts/seal_secrets.py --seal", check=False) + log("credentials.json sigillato con la chiave master" if res.returncode == 0 else + "ATTENZIONE: credentials.json NON sigillato: rilanciare scripts/update.sh dopo l'installazione") + + # 10c. Sito nginx allineato al modello del prodotto: aggiunge le location che il + # sito generato qui non ha (cache della console, service worker, pagine pubbliche). + if (APP_DIR / "deploy/nginx/iride.conf").exists() and (APP_DIR / "scripts/nginx_sync.py").exists(): + res = run(f"{APP_DIR}/backend/venv/bin/python {APP_DIR}/scripts/nginx_sync.py --site /etc/nginx/sites-available/iride " + f"--template {APP_DIR}/deploy/nginx/iride.conf --no-reload", check=False) + if res.returncode == 0 and run("nginx -t && systemctl reload nginx", check=False).returncode == 0: + log("Sito nginx allineato al modello di IRIDE") + else: + log("ATTENZIONE: sito nginx non allineato al modello: lo fara' il primo aggiornamento (update.sh)") + # 11. Servizi systemd (unit dal repo: update.sh le tiene allineate) log("โ”€โ”€ Creazione e avvio servizi โ”€โ”€") for svc in SERVICES: shutil.copy(APP_DIR / "deploy/systemd" / f"{svc}.service", f"/etc/systemd/system/{svc}.service") + for unit in ("iride-updater.service", "iride-updater.path"): + if (APP_DIR / "deploy/systemd" / unit).exists(): + shutil.copy(APP_DIR / "deploy/systemd" / unit, f"/etc/systemd/system/{unit}") if (APP_DIR / "deploy/logrotate/iride").exists(): shutil.copy(APP_DIR / "deploy/logrotate/iride", "/etc/logrotate.d/iride") run("systemctl daemon-reload") @@ -428,6 +455,9 @@ extendedKeyUsage = serverAuth chown(LOGS_DIR) for svc in SERVICES: run(f"systemctl enable --now {svc}") + if Path("/etc/systemd/system/iride-updater.path").exists(): + run("systemctl enable --now iride-updater.path") + log("Aggiornamento dalla console attivo (iride-updater.path)") log(f"{svc} avviato") # 12. Licenza in posizione finale