Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SSH target config (contains host/user/port — no credentials, but host-specific)
config/target.json

# Reportes: escaneos, evidencia y reportes generados
# Generated scan data, evidence and reports
reportes/

# Current run id marker (temporary state)
Expand All @@ -26,7 +26,7 @@ __pycache__/
*.tmp
*.bak

# ── Secrets / credentials (defensivo) ─────────────────────────────────────
# ── Secrets / credentials (defensive exclusions) ─────────────────────────

*.key
*.pem
Expand Down
7 changes: 4 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ See `SAFETY.md`.
6. **Migration rule.** A migration objective does NOT start with the migration plan. It starts with fully understanding the current state.
7. **Skill economy.** Discovering a technology is never, by itself, a reason to create a skill. Reuse existing capabilities and bounded ad-hoc checks first. Persist only capabilities that are necessary, non-overlapping, host-agnostic, and expected to be reused across targets or runs.
8. **Single execution path.** Every remote command is executed through `scripts/ssh_exec.sh`. Command blocks in skills describe remote payloads; never run their literal `ssh` examples directly or write raw output to evidence.
9. **English narrative output.** Write analysis, findings, recommendations and executive summaries in English. Preserve captured target output verbatim after redaction; do not translate evidence or rename existing storage paths.

## How to run an audit (operator)

Expand All @@ -36,8 +37,8 @@ See `SAFETY.md`.

## How to run a diagnosis (operator)

If you are reporting a **symptom** (not asking for a full audit) — e.g. "el sitio da 502",
"el disco se llenó", "un contenedor se reinicia solo" — the agent follows
If you are reporting a **symptom** (not asking for a full audit) — e.g. "the site returns 502",
"the disk is full", "a container keeps restarting" — the agent follows
`workflows/incident-triage.md` and reads `lib/diagnosis.yaml` (symptom -> hypotheses ->
evidence -> skills). It runs only the skills needed to find the root cause and the
remediation, and it never fixes anything without Level 3 approval.
Expand Down Expand Up @@ -91,7 +92,7 @@ infrastructure-expert/
│ ├── observability/ <- monitoring stack health
│ ├── backup/ <- backup mechanisms detection
│ └── migration/ <- A->B migration assessment
├── workflows/ <- entry points: audit (por modo) + incident triage
├── workflows/ <- entry points: audit (by mode) + incident triage
├── templates/ <- report templates
└── reportes/ <- scan data + reports (gitignored)
```
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ All scan data and reports are stored in `reportes/<run-id>/`:
- `reportes/<run-id>/informe-<run-id>.html` — self-contained offline HTML report
- Executive summary printed to the console.

Documentation, agent-authored findings and generated report labels use English.
The existing `reportes/`, `evidencia/` and `informe-*.html` storage names are retained
for compatibility with existing runs; they are path identifiers, not a report
language setting. Captured target output is preserved as evidence in its original
language rather than translated.

## Safety

| Level | Description | Default |
Expand Down
5 changes: 5 additions & 0 deletions REPORTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

`reportes/<run-id>/informe-<run-id>.html` — single, offline, self-contained HTML (no external CDN; all CSS/JS inline).

Use English for report headings, analysis, findings, remediation and summaries.
The renderer declares `lang="en"`. Keep captured evidence in its original language
after redaction; translating it would alter the source record. Retain existing
storage path names for compatibility with earlier runs.

## Sections (in order)

1. **Executive Summary** — overall state, top risks, top recommendations.
Expand Down
4 changes: 2 additions & 2 deletions config/target.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"connect_timeout": 15,
"command_timeout": 60
},
"objective": "Analizar completamente la infraestructura.",
"context": "Nivel de seguridad: L1+L2 solamente (no corras ningun comando que pueda modificar algo en el servidor, solo verificar).",
"objective": "Analyze the infrastructure comprehensively.",
"context": "Safety level: L1+L2 only. Do not run commands that could modify the server; observe and verify only.",
"mode": "FULL"
}
408 changes: 204 additions & 204 deletions lib/diagnosis.yaml

Large diffs are not rendered by default.

204 changes: 102 additions & 102 deletions scripts/gen_report.py

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions skills/_index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ skills:
# ============================================================
workflows:
full:
description: "Analisis completo de infraestructura (read-only)"
description: "Comprehensive infrastructure analysis (read-only)"
sequence:
- "system_inventory"
- "systemd_analysis"
Expand Down Expand Up @@ -505,7 +505,7 @@ workflows:
- "migration_assessment"

quick:
description: "Triage rapido de salud (inventario + systemd + CPU/mem/disk/io + red + DNS/firewall + web/TLS + logs + seguridad)"
description: "Rapid health triage (inventory + systemd + CPU/memory/disk/I/O + network + DNS/firewall + web/TLS + logs + security)"
sequence:
- "system_inventory"
- "systemd_analysis"
Expand All @@ -528,15 +528,15 @@ workflows:
- "capacity_analysis"

discovery:
description: "Solo descubrimiento e inventario"
description: "Discovery and inventory only"
sequence:
- "system_inventory"
- "systemd_analysis"
- "process_analysis"
- "network_analysis"

container:
description: "Enfocado en hosts con contenedores (Docker/K8s)"
description: "Container host focus (Docker/K8s)"
sequence:
- "system_inventory"
- "systemd_analysis"
Expand All @@ -562,7 +562,7 @@ workflows:
- "ssh_hardening_analysis"

security:
description: "Auditoria de seguridad completa"
description: "Comprehensive security audit"
sequence:
- "system_inventory"
- "systemd_analysis"
Expand All @@ -577,7 +577,7 @@ workflows:
- "log_analysis"

forensic:
description: "Investigacion forense de robo de credenciales (.env / GitHub keys)"
description: "Credential theft forensic investigation (.env / GitHub keys)"
sequence:
- "system_inventory"
- "systemd_analysis"
Expand Down
54 changes: 27 additions & 27 deletions skills/_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,44 +19,44 @@ optional:
- references

parameter_types:
string: "texto libre (path, hostname)"
integer: "numero entero (PID, puerto, nucleos)"
float: "numero decimal (umbral % CPU, GB RAM)"
string: "free text (path, hostname)"
integer: "integer (PID, port, core count)"
float: "decimal number (CPU percentage threshold, RAM in GB)"
datetime: "timestamp ISO 8601"
duration: "intervalo (1h, 30m, 7d)"
duration: "interval (1h, 30m, 7d)"
boolean: "true/false"
enum: "lista cerrada de valores"
filepath: "ruta validada en filesystem remoto"
regex: "expresion regular"
enum: "closed set of values"
filepath: "validated remote filesystem path"
regex: "regular expression"

block_risk_levels:
ro: "readonly — solo lectura, cero modificacion al servidor"
info: "readonly — consulta de metadata inofensiva"
probe: "readonly — mediciones repetidas en el tiempo (snapshots), sin carga artificial"
ro: "read-only — no server modifications"
info: "read-only — non-mutating metadata query"
probe: "read-only — repeated measurements (snapshots), without artificial load"

execution_modes:
auto: "ejecucion automatica sin confirmacion (solo ro/info/probe)"
confirm: "requiere confirmacion explicita (acciones no read-only)"
manual: "no automatizable, requiere intervencion humana"
auto: "automatic execution without confirmation (ro/info/probe only)"
confirm: "requires explicit confirmation (non-read-only actions)"
manual: "not automated; requires human intervention"

severity_levels:
CRITICAL: "puede causar caida, perdida de datos, indisponibilidad"
HIGH: "problema importante, resolverse pronto"
MEDIUM: "optimizacion recomendable o gap de buenas practicas"
LOW: "mejora menor o de conveniencia"
INFO: "observacion sin accion inmediata"
CRITICAL: "may cause an outage, data loss or unavailability"
HIGH: "significant issue requiring prompt resolution"
MEDIUM: "recommended optimization or best-practice gap"
LOW: "minor or convenience improvement"
INFO: "observation without immediate action"

confidence_levels:
HIGH: "evidencia directa y reproducible"
MEDIUM: "evidencia indirecta o de un solo snapshot, requiere validacion"
LOW: "indicio debil, no concluyente"
INSUFFICIENT_DATA: "no hay datos suficientes para afirmar nada"
HIGH: "direct, reproducible evidence"
MEDIUM: "indirect or single-snapshot evidence; requires validation"
LOW: "weak, inconclusive indication"
INSUFFICIENT_DATA: "insufficient data to support a claim"

capacity_status:
NORMAL: "consumo esperado y estable"
WATCH: "monitorear, sin accion inmediata"
WARNING: "acercandose a limite o con tendencia negativa"
CRITICAL: "en o mas alla del limite, accion inmediata"
NORMAL: "expected, stable usage"
WATCH: "monitor; no immediate action"
WARNING: "approaching a limit or trending negatively"
CRITICAL: "at or beyond a limit; immediate action required"

output_schema:
type: object
Expand All @@ -67,7 +67,7 @@ output_schema:
risk_level: { type: string, enum: [ro, info, probe] }
evidence_files:
type: array
items: { type: string, description: "rutas a artefactos de evidencia" }
items: { type: string, description: "paths to evidence artifacts" }
findings:
type: array
items:
Expand Down
78 changes: 39 additions & 39 deletions skills/_template.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
id: "skill_id"
name: "Skill: Nombre descriptivo"
name: "Skill: Descriptive name"
version: "1.0"
category: "cpu"
phase: "analyze"
Expand All @@ -9,94 +9,94 @@ execution_mode: "auto"
depends_on: []
provides: []
triggers:
- "Condicion 1 que activa esta skill"
- "Condicion 2"
- "Condition 1 that triggers this skill"
- "Condition 2"
false_positives:
- "FP 1: descripcion y como descartarlo"
- "FP 1: description and how to rule it out"
references:
- "URL / doc de kernel o tuning"
- "URL / kernel or tuning documentation"
parameters:
SAMPLE_INTERVAL:
type: "duration"
default: "30s"
required: false
description: "Intervalo entre snapshots para analisis temporal"
description: "Interval between snapshots for temporal analysis"
SAMPLE_COUNT:
type: "integer"
default: 4
required: false
description: "Cantidad de snapshots (T0, T+30, T+60, T+120...)"
description: "Number of snapshots (T0, T+30, T+60, T+120...)"
output:
format: "json"
schema: "output_schema"
---

# Skill: Nombre descriptivo
# Skill: Descriptive name

## Objetivo
Descripcion concisa (1-2 frases) de que mide y para que esta skill.
## Objective
A concise description (1–2 sentences) of what the skill measures and why.

## Cuando usarla
## When to use
- Trigger 1
- Trigger 2

## Parametros
## Parameters

| Variable | Tipo | Requerido | Default | Descripcion |
| Variable | Type | Required | Default | Description |
|----------|------|-----------|---------|-------------|
| `{{SAMPLE_INTERVAL}}` | duration | no | 30s | Intervalo de snapshot |
| `{{SAMPLE_COUNT}}` | integer | no | 4 | Nro de snapshots |
| `{{SAMPLE_INTERVAL}}` | duration | no | 30s | Snapshot interval |
| `{{SAMPLE_COUNT}}` | integer | no | 4 | Number of snapshots |

## Pre-flight (validacion de entorno, read-only)
## Pre-flight (environment validation, read-only)
```bash
# [risk:info] [mode:auto]
for c in <TOOL_LIST>; do command -v "$c" >/dev/null 2>&1 && echo "OK $c" || echo "MISSING $c"; done
```

Los bloques describen el payload remoto. El agente los ejecuta exclusivamente con
Blocks describe remote payloads. The agent executes them exclusively through
`scripts/ssh_exec.sh <evidence-id> <category> <L1|L2> <payload> [evidence-dir]`;
no ejecutar los ejemplos con `ssh` directo ni redirigir salida remota sin redaccion.
Las series temporales son la excepcion de orquestacion local: usan
`helpers.snapshot_loop`, que invoca el wrapper una vez por muestra para no exceder timeouts.
never execute literal `ssh` examples directly or redirect unredacted remote output.
Time series are the local orchestration exception: use `helpers.snapshot_loop`,
which invokes the wrapper once per sample to stay within command timeouts.

## Comandos
## Commands

### 1. Snapshot T0
```bash
# [risk:ro] [mode:auto]
<COMANDO_READ_ONLY>
<READ_ONLY_COMMAND>
```

### 2. Serie temporal (T+30s ... T+N)
### 2. Time series (T+30s ... T+N)
```bash
# [risk:probe] [mode:auto]
snapshot_loop "{{SKILL_ID}}-trend" "<category>" '<COMANDO_READ_ONLY>'
snapshot_loop "{{SKILL_ID}}-trend" "<category>" '<READ_ONLY_COMMAND>'
```

### 3. Bloque condicional (si componente presente)
### 3. Conditional block (if the component is present)
```bash
# [risk:ro] [mode:auto] [requires:COMPONENT_DETECTED]
<COMANDO>
<COMMAND>
```

## Analisis / Interpretacion
- Hallazgo A -> conclusion X
- Hallazgo B -> conclusion Y
## Analysis / interpretation
- Finding A -> conclusion X
- Finding B -> conclusion Y

## Falsos positivos
- FP 1: descripcion y como descartarlo
- FP 2: descripcion y como descartarlo
## False positives
- FP 1: description and how to rule it out
- FP 2: description and how to rule it out

## Umbrales (referenciales, ajustar por contexto)
| Metrica | NORMAL | WATCH | WARNING | CRITICAL |
## Thresholds (reference values; adjust to context)
| Metric | NORMAL | WATCH | WARNING | CRITICAL |
|---------|--------|-------|---------|----------|
| (%) | < 50 | 50-70 | 70-85 | > 85 |

## Evidencia producida
- `<evidence-id>.yml` en `{{RUN_DIR}}/evidencia/`, generado por `scripts/ssh_exec.sh`
## Evidence produced
- `<evidence-id>.yml` in `{{RUN_DIR}}/evidencia/`, generated by `scripts/ssh_exec.sh`

## Seguridad
Todos los bloques son read-only. Si aparece algo sospechoso (miner, proceso desconocido): FLAG + COLLECT + REPORT, no modificar.
## Security
All blocks are read-only. If something looks suspicious (miner, unknown process): FLAG + COLLECT + REPORT; do not modify it.

## Referencias
## References
- doc / URL
4 changes: 2 additions & 2 deletions skills/analysis/configuration-analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ ssh {{SSH_TARGET}} 'echo "=== /etc/security/limits.conf ==="; grep -v "^#" /etc/
### Nginx config (if present)
```bash
# [risk:ro] [mode:auto] [requires:nginx]
ssh {{SSH_TARGET}} 'nginx -T 2>/dev/null | grep -E "worker_connections|worker_processes|keepalive|gzip|error_log|access_log|listen|server_name|proxy_pass" | head -60 || echo "nginx -T no disponible"'
ssh {{SSH_TARGET}} 'nginx -T 2>/dev/null | grep -E "worker_connections|worker_processes|keepalive|gzip|error_log|access_log|listen|server_name|proxy_pass" | head -60 || echo "nginx -T unavailable"'
```

### Apache config (if present)
```bash
# [risk:ro] [mode:auto] [requires:apache2]
ssh {{SSH_TARGET}} 'apachectl -S 2>/dev/null || apache2ctl -S 2>/dev/null || httpd -S 2>/dev/null || echo "apache no disponible"'
ssh {{SSH_TARGET}} 'apachectl -S 2>/dev/null || apache2ctl -S 2>/dev/null || httpd -S 2>/dev/null || echo "apache unavailable"'
```

### Ulimits per running process (top memory consumers)
Expand Down
Loading
Loading