Trilha de auditoria encadeada por hash e comando guara audit

Cada ação sobre a evidência (inspect, scan, recover, image, hash, search, verify,
exportações e sessões) vira uma linha JSON com usuário, máquina, hora UTC e detalhes,
encadeada por SHA-256. guara audit lista e --verify aponta a entrada onde a cadeia
quebra. Senhas e chaves nunca entram no registro.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas RayanandClaude Sonnet 5.5 committed 2026-10-22 16:04:43 -03:00
1 parent 213a5a3df5
commit 26e5ebb592
9 files changed
+706 -45

No files matched your search

+1
View File
@@ -43,6 +43,7 @@ recover copies with MD5, SHA-1 and SHA-256 and writes the
| `source`, `device` | Open devices and images read-only; list disks |
| `image` | Raw image tolerant of bad sectors, with an error map |
| `ewf`, `aff4` | Read and write E01/Ex01 and AFF4 |
| `audit` | Hash-chained audit trail of every examiner action |
| `vdisk/` | Read QCOW2, VMDK, VHD, VHDX and DMG as the disk they contain |
| `assemble` | Builds the virtual disk: image, RAID, LVM and encrypted volume |
| `raid`, `raid_detect`, `lvm` | RAID reassembly (with automatic parameter discovery) and LVM2 |
+13
View File
@@ -20,6 +20,7 @@ Reading a raw disk requires privileges: administrator on Windows, `sudo` on Linu
| `search <source> <terms...>` | Text across the whole disk, UTF-8 and UTF-16 |
| `export <session> <csv>` | Spreadsheet of the findings |
| `report <session> <html>` | Printable HTML report |
| `audit` | Audit trail of every action (who, when, what); `--verify` checks the hash chain |
| `sessions` | Automatically saved sessions |
| `ui` | Interface in the browser (127.0.0.1, with token) |
@@ -99,6 +100,18 @@ guara verify /mnt/other-disk/sdb.E01
For E01: `--segment-mib` (size of each segment, default 1500, 0 for a single file) and `--compression` (0 to 9, default 1).
## Audit trail
Every action that touches evidence is appended to `auditoria.jsonl` in the configuration folder (or to the file named by `GUARA_AUDIT_LOG`): opening a source (`inspect`, `scan`), `recover`, `image`, `hash`, `search`, `verify`, exports and sessions. Each line has the time (UTC), the system user (the one behind `sudo`), the host, the Guará version and the details; set `GUARA_EXAMINER` to also record the examiner's name. Passwords and keys are never written.
```bash
guara audit # lists the entries
guara audit --tail 20 --json
guara audit --verify # checks the chain; exits with an error if it is broken
```
The lines are chained: each one carries the SHA-256 of the previous hash plus its own content, so editing, removing or reordering an entry is detected and `--verify` says which one. Cutting the end of the file cannot be detected by the file alone: keep the hash printed by `--verify` somewhere else (for example in the case notes).
## Video without an index (MP4 without moov)
Pass an **intact video from the same camera or drone** so Guará can rebuild the index:
+1
View File
@@ -43,6 +43,7 @@ recover copia com MD5, SHA-1 e SHA-256 e grava o manifesto
| `source`, `device` | Abrir dispositivos e imagens somente para leitura; listar discos |
| `image` | Imagem bruta tolerante a setores ruins, com mapa de erros |
| `ewf`, `aff4` | Ler e gravar E01/Ex01 e AFF4 |
| `audit` | Trilha de auditoria encadeada por hash de cada ação do perito |
| `vdisk/` | Ler QCOW2, VMDK, VHD, VHDX e DMG como o disco que contêm |
| `assemble` | Monta o disco virtual: imagem, RAID, LVM e volume cifrado |
| `raid`, `raid_detect`, `lvm` | Remontagem de RAID (com descoberta automática de parâmetros) e LVM2 |
+13
View File
@@ -20,6 +20,7 @@ Ler disco bruto exige privilégios: administrador no Windows, `sudo` no Linux e
| `search <origem> <termos...>` | Texto no disco inteiro, UTF-8 e UTF-16 |
| `export <sessão> <csv>` | Planilha dos achados |
| `report <sessão> <html>` | Relatório HTML imprimível |
| `audit` | Trilha de auditoria de cada ação (quem, quando, o quê); `--verify` confere o encadeamento por hash |
| `sessions` | Sessões salvas automaticamente |
| `ui` | Interface no navegador (127.0.0.1, com token) |
@@ -99,6 +100,18 @@ guara verify /mnt/outro-disco/sdb.E01
Para E01: `--segment-mib` (tamanho de cada segmento, padrão 1500, 0 para um arquivo só) e `--compression` (0 a 9, padrão 1).
## Trilha de auditoria
Toda ação que mexe na evidência é acrescentada a `auditoria.jsonl` na pasta de configuração (ou ao arquivo indicado em `GUARA_AUDIT_LOG`): abrir uma origem (`inspect`, `scan`), `recover`, `image`, `hash`, `search`, `verify`, exportações e sessões. Cada linha traz a hora (UTC), o usuário do sistema (o que está por trás do `sudo`), a máquina, a versão do Guará e os detalhes; defina `GUARA_EXAMINER` para registrar também o nome do perito. Senhas e chaves nunca são gravadas.
```bash
guara audit # lista as entradas
guara audit --tail 20 --json
guara audit --verify # confere a cadeia; sai com erro se estiver quebrada
```
As linhas são encadeadas: cada uma leva o SHA-256 do hash anterior mais o próprio conteúdo, então editar, remover ou reordenar uma entrada é detectado e o `--verify` diz qual. Cortar o fim do arquivo não é detectável só pelo arquivo: guarde o hash que o `--verify` imprime em outro lugar (por exemplo nas notas do caso).
## Vídeo sem índice (MP4 sem moov)
Passe um vídeo **íntegro da mesma câmera ou drone** para o Guará refazer o índice: