aegis-host-secrets
REDACTION RULE — applies to every phase of this module and to the final report. When any sweep surfaces a real secret value, the report prints exactly the first four characters followed by
…REDACTED(shape:sk-l…REDACTED). Never transcribe full values into reports, tickets, chat, shell transcripts, or evidence archives. All examples in this document use deliberate fakes such asEXAMPLE_NOT_A_REAL_TOKEN. If a command would echo a secret (e.g.,systemctl show -p Environment), capture only hit counts or redacted previews.
Scope & Objectives
Audit secrets and sensitive material stored on one Linux host (or rendered onto it from its config-as-code repo). Seven objectives, in execution order:
- Inventory sweep (read-only) — locate every place credentials actually live in practice:
.envfiles in app directories, config files (application.yml/.properties,settings.py,config.json, PHP.env), systemdEnvironment=/EnvironmentFile=,/etc/<app-name>/*,docker-compose.ymlenvironment blocks plus sibling.env, crontab inline creds, shell rc exports, ops history files, backup scripts with embedded DB passwords. - Permission audit per location — verify owner/mode against the expected-state table; hunt group/world-readable secret files; flag group/world-writable configs; enforce 750-not-755 home dirs for service accounts.
- Private keys & certs on disk — SSH host + client keys, the sshd
StrictModespermission chain, TLS key pairs, application signing/JWT secrets in configs, GPG material. - Database credential exposure chains — DSN strings with inline passwords,
.my.cnfclient sections,.pgpass, replication configs, backup scripts, and where dumps land. - Environment-variable reality check — establish honestly what
/proc/<pid>/environdoes and does not expose, enumerate real leak channels, and issue a scoped verdict. - Rotation posture — detect "unchanged since forever" credential files as Needs-Review culture flags (not auto-findings).
- Backup & snapshot hygiene — unencrypted copies of secret-bearing dirs, dump placement, encryption presence.
Out of scope (cross-references): token storage design inside applications and token-rotation mechanics → TOK module (skills/server/api-token-security/SKILL.md, which owns the zero-downtime rotation runbook); secrets baked into container images or build layers → supply-chain module; network exposure of the services holding these secrets → FW/TLS modules; SELinux/AppArmor label analysis beyond noting its existence → SANDBOX module.
Operating rules: