feat: complete evidence restructuring worktree

This commit is contained in:
Codex
2026-08-26 11:39:02 +02:00
parent a54d4769dd
commit 38f02cfd08
56 changed files with 1981 additions and 1801 deletions
+18 -19
View File
@@ -1,7 +1,7 @@
# Configurazione del provider Authentik
# Authentik provider configuration
Il protocollo browser di ThothII è OIDC generico. Authentik fornisce il catalogo gruppi e il
provider di identità senza introdurre un percorso di login proprietario.
ThothII uses generic OIDC in the browser. Authentik provides the identity provider and group
catalog without adding a proprietary login flow.
```mermaid
sequenceDiagram
@@ -17,26 +17,25 @@ sequenceDiagram
ThothII-->>Browser: Opaque session
```
## Provider OIDC
## OIDC provider
1. Creare applicazione e provider OAuth2/OIDC.
2. Registrare esattamente `PUBLIC_URL/api/auth/oidc/callback`.
3. Abilitare gli scope `openid`, `profile` ed `email`.
4. Configurare un claim diretto `groups` come array di stringhe.
1. Create an OAuth2/OIDC application and provider.
2. Register exactly `PUBLIC_URL/api/auth/oidc/callback`.
3. Enable the `openid`, `profile`, and `email` scopes.
4. Configure a direct `groups` claim as an array of strings.
## Catalogo gruppi
## Group catalog
Creare un account di servizio dedicato con sola lettura dei gruppi. Conservare il token nel
bundle protetto come `THT_AUTHENTIK_API_TOKEN`.
Create a dedicated service account with read-only access to groups. Store its token in the
protected bundle as `THT_AUTHENTIK_API_TOKEN`.
Mappare in `auth.yaml` i nomi esatti dei gruppi aziendali ai ruoli ThothII `user` e `admin`.
Gruppi non mappati vengono ignorati; un gruppo configurato ma assente genera un errore chiuso.
Map the exact enterprise group names to the ThothII `user` and `admin` roles in `auth.yaml`.
Unmapped groups are ignored. A configured group that does not exist produces a closed error.
## Diagnostica
## Diagnostics
`tht auth check` controlla discovery, issuer, JWKS, accesso al catalogo e presenza dei gruppi
configurati. L'opzione `--interactive` aggiunge la verifica dell'identità tramite device flow,
quando il provider la supporta.
`tht auth check` checks discovery, the issuer, JWKS, catalog access, and the configured groups.
The `--interactive` option also verifies identity through device flow when the provider supports it.
Ruotare separatamente secret OIDC e token del catalogo gruppi. Nessuno dei due deve comparire in
YAML, cronologia shell, log o output diagnostico.
Rotate the OIDC secret and group-catalog token separately. Neither may appear in YAML, shell
history, logs, or diagnostic output.
+16 -18
View File
@@ -1,7 +1,7 @@
# Enrollment client per DWH REST
# DWH REST client enrollment
La credenziale `dwh-auth` appartiene a una installazione ThothII e serve soltanto quando il
workspace usa il trasporto `rest_api`.
The `dwh-auth` credential belongs to one ThothII installation and is needed only when the
workspace uses the `rest_api` transport.
| Trasporto | Materiale richiesto |
| --- | --- |
@@ -9,13 +9,13 @@ workspace usa il trasporto `rest_api`.
| `postgres_direct` | Credenziali PostgreSQL e configurazione TLS PostgreSQL |
| `ssh_tunnel` | Credenziali PostgreSQL e materiale SSH |
## Consegna e conservazione
## Delivery and storage
Ricevere chiave e CA attraverso canali protetti separati. Conservare la chiave nel vault
dell'installazione o in un file regolare accessibile soltanto all'account autorizzato. Non
inserirla in Git, file YAML, argomenti, log o schermate condivise.
Receive the key and CA through separate protected channels. Store the key in the installation
vault or in a regular file accessible only to the authorized account. Do not put it in Git, YAML
files, arguments, logs, or shared screens.
## Configurazione ACME Limited
## ACME Limited configuration
Esempio di binding headless per il workspace `acme-ebikes`:
@@ -26,16 +26,14 @@ THT_WS_ACME_EBIKES_DWH_API_KEY_FILE=/run/secrets/acme-ebikes-dwh-api-key
THT_WS_ACME_EBIKES_DWH_TLS_CA_FILE=/run/secrets/acme-ebikes-dwh-ca.pem
```
Il suffisso del workspace deriva dall'ID immutabile trasformando i trattini in underscore e
usando lettere maiuscole. `API_KEY_FILE` contiene il percorso del file montato, non il valore
della chiave.
The workspace suffix comes from the immutable ID, with hyphens changed to underscores and letters
converted to uppercase. `API_KEY_FILE` contains the mounted file path, not the key value.
## Rotazione e revoca
## Rotation and revocation
Durante la rotazione, ricevere la nuova generazione, aggiornare il vault o il file montato e
confermare la connettività sulla route innocua `/rpc/ping`. Solo dopo questa conferma il
responsabile del server revoca la generazione precedente.
During rotation, receive the new generation, update the vault or mounted file, and confirm
connectivity through the harmless `/rpc/ping` route. The server owner revokes the previous
generation only after this confirmation.
Un `401` indica una chiave assente, sconosciuta, scaduta o revocata. Un `503` indica che il
servizio di autorizzazione o il registro non sono disponibili. In entrambi i casi non aggirare
REST e non ridurre la verifica TLS.
A `401` means the key is missing, unknown, expired, or revoked. A `503` means the authorization
service or registry is unavailable. In either case, do not bypass REST or weaken TLS verification.
+20 -22
View File
@@ -1,8 +1,8 @@
# `dwh-auth`: guida server
# `dwh-auth`: server guide
`dwh-auth` protegge la route REST `/dwh/` con una chiave distinta per ogni installazione
ThothII. Il componente gira come servizio Linux separato, non legge i dati del DWH e non si
collega direttamente a PostgreSQL.
`dwh-auth` protects the REST `/dwh/` route with a separate key for each ThothII installation.
It runs as a separate Linux service, does not read DWH data, and does not connect directly to
PostgreSQL.
```mermaid
flowchart LR
@@ -12,14 +12,14 @@ flowchart LR
AUTH -->|"authorized"| REST["DWH REST"]
```
## Confini di sicurezza
## Security boundaries
- Una chiave identifica un'installazione, non una persona.
- Chiavi e backup restano in file protetti e non entrano in Git, log, argomenti o JSON pubblico.
- Il registro conserva digest e metadati, mai la chiave in chiaro.
- La route REST deve essere esposta esclusivamente tramite TLS verificato.
- A key identifies an installation, not a person.
- Keys and backups stay in protected files and never enter Git, logs, arguments, or public JSON.
- The registry stores digests and metadata, never the key in plaintext.
- The REST route must be exposed only through verified TLS.
## Installazione
## Installation
Il servizio usa questi percorsi:
@@ -31,11 +31,10 @@ Il servizio usa questi percorsi:
| Socket | `/run/dwh-auth/verify.sock` |
| Consegne protette | `/root/dwh-auth-provision/` |
Installare binario e unit con owner `root`, creare l'utente di servizio `dwh-auth`, quindi
abilitare l'unità con `systemctl enable --now dwh-auth`. Il socket deve essere accessibile al
gruppo usato da Nginx.
Install the binary and unit with `root` ownership, create the `dwh-auth` service user, and enable
the unit with `systemctl enable --now dwh-auth`. The socket must be accessible to Nginx's group.
## Creazione e revoca delle chiavi
## Creating and revoking keys
Esempio per l'installazione ACME Limited:
@@ -46,9 +45,8 @@ sudo dwh-auth --registry-root /var/lib/dwh-auth key create \
--output /root/dwh-auth-provision/acme-factory-primary.key
```
Consegnare il file attraverso un vault aziendale o un canale autenticato. Per la rotazione,
creare una nuova chiave, distribuirla, aggiornare il client e revocare la precedente usando il
suo ID pubblico:
Deliver the file through an enterprise vault or an authenticated channel. To rotate a key, create
a new one, distribute it, update the client, and revoke the old one using its public ID:
```bash
sudo dwh-auth --registry-root /var/lib/dwh-auth key revoke \
@@ -56,10 +54,10 @@ sudo dwh-auth --registry-root /var/lib/dwh-auth key revoke \
--reason scheduled-rotation
```
La revoca è definitiva. Conservare backup cifrati del registro prima di ogni mutazione.
Revocation is permanent. Keep encrypted registry backups before every mutation.
## Integrazione Nginx
## Nginx integration
Nginx inoltra la chiave al socket di `dwh-auth`. Solo una risposta autorizzata permette il
passaggio verso il DWH REST; chiavi assenti, sconosciute, scadute o revocate ricevono `401`,
mentre indisponibilità del servizio o del registro producono `503`.
Nginx forwards the key to the `dwh-auth` socket. Only an authorized response allows the request
to reach DWH REST. Missing, unknown, expired, or revoked keys receive `401`; an unavailable
service or registry produces `503`.
+18 -20
View File
@@ -1,13 +1,13 @@
# TLS per DWH REST
# TLS for DWH REST
La chiave DWH è accettabile solo sopra TLS verificato. Errori di autorizzazione o disponibilità
non autorizzano mai a disabilitare la verifica del certificato.
The DWH key may be used only over verified TLS. Authorization or availability errors never justify
disabling certificate verification.
## CA privata
## Private CA
Quando il DWH REST usa una CA aziendale, consegnare il certificato separatamente dalla chiave
API. La CA non è una credenziale, ma la sua integrità è un confine di sicurezza: deve restare
fuori da Git e non essere scrivibile da utenti non autorizzati.
When DWH REST uses an enterprise CA, deliver the certificate separately from the API key. The CA
is not a credential, but its integrity is part of the security boundary. Keep it out of Git and
make it unwritable by unauthorized users.
Esempio ACME Limited:
@@ -15,26 +15,24 @@ Esempio ACME Limited:
THT_WS_ACME_EBIKES_DWH_TLS_CA_FILE=/run/secrets/acme-ebikes-dwh-ca.pem
```
## Fingerprint fuori banda
## Out-of-band fingerprint
Calcolare il fingerprint del file ricevuto e confrontarlo attraverso un canale indipendente:
Calculate the fingerprint of the received file and compare it through an independent channel:
```bash
openssl x509 -noout -fingerprint -sha256 \
-in /absolute/protected/acme-ebikes-dwh-ca.pem
```
Il SAN del certificato deve includere il nome esatto usato dal binding, per esempio
`dwh.acme.example`.
The certificate SAN must include the exact name used by the binding, such as `dwh.acme.example`.
## Rinnovo
## Renewal
1. Preparare certificato e chain nuovi.
2. Confermare SAN e fingerprint fuori banda.
3. Distribuire la nuova CA ai client mantenendo temporaneamente la precedente.
4. Aggiornare il binding e confermare la connettività con TLS normale.
5. Installare il certificato server.
6. Ritirare il trust precedente dopo la finestra concordata.
1. Prepare the new certificate and chain.
2. Confirm the SAN and fingerprint out of band.
3. Distribute the new CA to clients while temporarily keeping the old one.
4. Update the binding and confirm connectivity with normal TLS.
5. Install the server certificate.
6. Remove the old trust after the agreed window.
Non usare `curl -k`, non disabilitare TLS e non incorporare certificati o fingerprint completi
nei documenti condivisi.
Do not use `curl -k`, disable TLS, or embed complete certificates or fingerprints in shared documents.