Hardening an AI Development Environment

security, infrastructure, wsl2, ai-agents, devops

Changes: v1.2 โ†’ v1.3

Architecture layer added: Security. Six components deployed, four automated daily checks registered.

Components Added

ComponentPurposeInstallStatus
fail2banIntrusion prevention โ€” bans IPs on auth failure patternsapt install fail2bansystemctl is-active โœ…
ufwFirewall โ€” default deny incoming, allow outgoingapt install ufw && ufw enableufw status โœ…
AppArmorMandatory access control โ€” confines process resource accessapt install apparmor apparmor-utilsaa-status โœ…
unattended-upgradesAutomated security patchesapt install unattended-upgradessystemctl is-active โœ…
rkhunterRootkit/binary integrity scanningapt install rkhunterrkhunter --version โœ…
Security check registry4 daily automated checks (WSL config, file perms, package updates, Docker bloat)Custom โ€” ~/.claude/security-improvements/registry.jsonActive โœ…

Daily Automated Checks

  1. WSL configuration validation โ€” systemd settings, user permissions
  2. File permission auditing โ€” sensitive path monitoring
  3. Package update monitoring โ€” pending security update detection
  4. Docker bloat detection โ€” container disk usage tracking

Audit Pipeline: audit_map.py

Bidirectional verification โ€” blocks production deploy on any failure.

Phase 1 โ€” Claims โ†’ Reality: Every architecture component verified by shell command. Example: systemctl is-active fail2ban. Fail = flagged fabricated.

Phase 2 โ€” Reality โ†’ Claims: Discovers running services, flags undocumented ones.

Phase 3 โ€” Changelog consistency: Version entries validated. Referenced blog posts checked for existence and non-draft status.

Phase 4 โ€” Stack versions: Declared versions compared against installed versions.

Current Results

โœ… Passed:       31
โŒ Failed:       0
๐Ÿšซ Fabricated:   0
โš ๏ธ  Undocumented: 0

Rationale

AI agents in this stack have filesystem, shell, and network access. Agent-level governance (task registry, permission allowlists, pre-execution hooks) covers the application layer. OS-level hardening covers everything below it. Defense in depth.


Architecture version: v1.2 โ†’ v1.3. All claims verified by scripts/audit_map.py.

Configuration details reflect a production environment at time of writing. Implementation specifics vary based on tooling versions, platform updates, and organizational requirements. Validate approaches against current documentation before deployment.