Commit graph

139 commits

Author SHA1 Message Date
Dan 278017efe3 Consolidate scattered sops.* keys into single block
Fixes statix W20 warning. No functional change.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 12:42:57 -08:00
Dan 99927712c5 Add VM integration test and shellcheck linting to flake checks
- VM test boots a VM and verifies PostgreSQL, conduwuit, dnsmasq, nginx
- Shellcheck runs on all shell scripts (errors and warnings)
- Fix unused variables in sanitize-files.sh
- Use initialHashedPassword for root in VM config

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 11:04:00 -08:00
Dan 92d7646d52 Migrate Slack tokens to sops-nix, improve egress rate limits
- Remove beads from VPS deployment (kept locally for dev workflow)
- Add slack-bot-token and slack-app-token secrets with devs group access
- Remove dead acme-email secret reference
- Increase egress limits from 30/min to 150/min (burst 60→300)
- Change egress blocking from REJECT to DROP for better app behavior
- Add egress-status script for user self-diagnosis
- Update dev-slack-direct.md with new /run/secrets access patterns

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 11:14:19 -08:00
Dan df2cb13f9b Remove redundant olm permission from VM config
VM imports configuration.nix which already has the permission.
Clarified comments explaining why both flake.nix and configuration.nix
need the permission (different pkgs sources).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 22:53:07 -08:00
Dan 2aa005b300 Pin beads and opencode flake inputs to commit hashes
Prevents unexpected breakage from upstream changes.
To update: nix flake update beads opencode

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 20:56:25 -08:00
Dan 80ac34fc5c Make dev-add.sh idempotent
Safe to re-run: updates SSH key and config if user exists,
creates new user if not. Matches NixOS declarative model.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 20:35:10 -08:00
Dan cbda7aee2b Fix dev-add.sh to check file readability, not just existence
Change [ -f /etc/slack-dev.env ] to [ -r ... ] so users not in
devs group don't get permission denied errors on login.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 19:44:36 -08:00
Dan 812ffb9802 Add --dry-run flag to dev-remove.sh
Preview mode shows what would be removed without making changes.
Skips confirmation prompt and outputs cyan-colored dry-run messages.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 19:40:21 -08:00
Dan 2dd5684a8b Remove unused Nix lambda patterns (deadnix cleanup) 2026-01-05 18:23:54 -08:00
Dan d3151b39ed Add mosh alternative to dev onboarding doc 2026-01-05 17:38:42 -08:00
Dan 7ea56904d4 Add mosh for mobile shell access
- mosh package in systemPackages
- UDP ports 60000-60010 for mosh sessions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 17:30:57 -08:00
Dan bcfdf962f3 Disable security modules pending fixes, patch ssh-hardening
ssh-hardening.nix had fatal bugs:
- UsePAM=false breaks NixOS SSH auth
- Protocol=2 deprecated, crashes modern sshd
- AllowUsers defaulted to ["admin"], locks out all users

Partial fixes applied but module still unsafe to enable.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 17:09:07 -08:00
Dan a25abda825 Add Unix social tools section to dev onboarding doc
Documents who, w, finger, write, wall, ytalk and .plan files.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 15:34:55 -08:00
Dan 7832e74110 Add classic Unix social tools and fortune on login
- bsd-finger, ytalk, fortune in systemPackages
- Fortune displays on interactive shell login via programs.bash.interactiveShellInit
- Avoids breaking nix copy/rsync/scp (loginShellInit was wrong approach)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 15:32:29 -08:00
Dan 7519c88134 Sync beads 2026-01-05 09:15:25 -08:00
Dan 955b6e91b4 Fix killswitch paths in watchdog scripts, remove replaceStrings workaround 2026-01-05 09:12:46 -08:00
Dan 22f405f995 Add dev tools checks to smoke test (bun, zig) 2026-01-04 17:09:56 -08:00
Dan 39a161ce79 Sync beads 2026-01-04 16:45:26 -08:00
Dan c236deb480 Add zig to AGENTS.md available tools 2026-01-04 16:43:44 -08:00
Dan e1e9e2d635 Add zig to system packages 2026-01-04 16:38:11 -08:00
Dan 1158f3a37b Add bun as preferred JS package manager for faster installs 2026-01-04 13:49:56 -08:00
Dan a2c994b1d1 Set COLORTERM for truecolor terminals in SSH sessions 2026-01-04 10:02:25 -08:00
Dan 79d278ba61 Add terminfo for ghostty and kitty terminals
Source ghostty.terminfo from nixpkgs-unstable since it's not
available in nixos-24.05 stable.
2026-01-03 18:02:40 -08:00
Dan 74cf842afd Improve dev onboarding: devs group, npm setup, AGENTS.md
- Add users.groups.devs for shared resources
- dev-add: check devs group exists before creating user
- dev-add: use .profile for login shell PATH setup
- dev-add: configure npm prefix and .npm-global directory
- dev-add: create AGENTS.md with friendly capability guide
- Update onboarding message with npm install examples
- Add docs/server-AGENTS.md for reference

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 17:11:03 -08:00
Dan bd49ea001a Add documentation for adding dev tools
Covers four methods: system-wide, per-user nix profile,
per-project devShell, and external flakes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 11:00:15 -08:00
Dan bc81b4ec15 Rename learner to dev across codebase
- scripts/learner-*.sh → scripts/dev-*.sh
- docs/learner-*.md → docs/dev-*.md
- tests/test-learner-env.sh → tests/test-dev-env.sh
- Update all internal references

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 10:42:34 -08:00
Dan 26be2b1548 Add per-user resource limits via activation script
Creates drop-in at /run/systemd/system/user-.slice.d/50-limits.conf
to enforce per-user limits (vs slice-wide):
- MemoryMax=50% (~1GB per user)
- TasksMax=200 per user
- CPUQuota=200% (max 2 cores sustained)

Prevents one user from starving others.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 10:02:37 -08:00
Dan f8e77c44b1 Fix code review items from security scripts
- egress-watchdog: Use process substitution to avoid subshell gotcha
- killswitch: Rename USER to TARGET_USER (avoid shadowing builtin)
- Add documentation comments for UID range and grep -P dependency

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 09:35:40 -08:00
Dan cd534a09f2 Declarative script deployment via writeShellApplication
- Package watchdog scripts (killswitch, cpu-watchdog, egress-watchdog)
  with proper runtimeInputs, referenced directly by systemd
- Package admin scripts (learner-add, learner-remove) in systemPackages
- Fix ShellCheck issues in scripts (SC2129, SC2155, SC2115, SC2162)
- Remove manual /usr/local/bin deployment, scripts deploy with nixos-rebuild
- Update AGENTS.md with new deployment workflow

Closes epic ops-jrz1-gwk

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 09:21:47 -08:00
Dan fb7d6d03a2 Add egress-watchdog for rate limit abuse detection
Monitors EGRESS-LIMIT kernel log entries, tracks strikes per user,
triggers killswitch after 3 consecutive violations within a minute.
Runs every minute via systemd timer.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 06:02:34 -08:00
Dan fed449a4f7 Sync beads 2026-01-02 21:17:22 -08:00
Dan 5c4b2aac84 Add egress logging and rate limiting
- Log all new outbound connections from users (EGRESS: prefix)
- Rate limit: 30/min sustained, burst 60
- Over-limit connections logged (EGRESS-LIMIT:) and rejected
- Closes ops-jrz1-p2d, ops-jrz1-cmv

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 21:12:18 -08:00
Dan 9083f06669 Sync beads 2026-01-02 21:03:39 -08:00
Dan 89f2987f1e Add cgroups limits and CPU watchdog
- User slice: MemoryMax 80%, TasksMax 500, CPUWeight 100
- CPU watchdog: detects sustained abuse (>180% for 5 min), kills user
- Fixed scripts for NixOS (shebang, PATH)
- Closes ops-jrz1-8m7, ops-jrz1-1bk

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 21:02:18 -08:00
Dan 9c3ebaf9f9 Sync beads 2026-01-02 20:26:58 -08:00
Dan 8e266b5e82 Add killswitch script for emergency user termination
- Kills all processes for a user
- Terminates login session
- Logs to syslog with reason
- Refuses to kill system users (uid < 1000)
- Closes ops-jrz1-396

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 20:23:31 -08:00
Dan 8c1d1ad49e Sync beads 2026-01-02 19:51:33 -08:00
Dan 3b91f37975 Add security posture analysis and fix home dir permissions
- docs/security-posture.md: Threat model, risk assessment, recommendations
- Make home directories private (chmod 700)
- Update learner-add.sh to create private homes
- Closes ops-jrz1-k2a

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 19:14:07 -08:00
Dan 219a38b7aa Update tests for user-managed AI tools
- Check opencode (system package) instead of claude
- Add nodejs check for npm-based tool installation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 19:07:04 -08:00
Dan 1b1a91f9cb Switch to user-managed npm for AI coding tools
- Remove manual /usr/local/bin/claude install
- Remove claude symlink setup from learner-add.sh
- Update onboarding docs with npm install instructions
- Users choose their AI coder: claude, opencode, gemini, codex

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 19:03:35 -08:00
Dan 21d3038aca Add opencode and nodejs to system packages
- opencode (v1.0.224) via flake input from github:sst/opencode
- nodejs_22 for npm-based AI tools (gemini-cli, codex)
- Closes ops-jrz1-ecw

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 17:41:48 -08:00
Dan 0ce7bc73d9 Add tmux and beads to system packages
- tmux for session persistence
- beads (bd CLI) via flake input from github:steveyegge/beads
- Closes ops-jrz1-d38, ops-jrz1-jvt

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 17:26:11 -08:00
Dan 221600160d Sync beads 2026-01-02 16:48:43 -08:00
Dan 89cedfb4c6 Clean up: update tests for claude, remove dead maubot code 2026-01-02 16:46:11 -08:00
Dan 498f5279c4 Remove maubot plugin setup from user creation (Direct Slack path) 2026-01-02 15:14:13 -08:00
Dan 5732205758 Add onboarding doc for dan user 2026-01-02 15:05:41 -08:00
Dan a63565a775 Sync beads 2026-01-02 14:46:35 -08:00
Dan 67bde45cf8 Update onboarding instructions for Claude Code workflow 2026-01-02 14:46:19 -08:00
Dan bd7bdda2b3 Add Claude Code CLI to dev environment
- Install claude binary to /usr/local/bin
- Symlink to ~/.local/bin for users (in PATH)
- Update learner-add.sh to set up symlink for new users
- Add /usr/local/bin to PATH via shellInit
2026-01-02 14:45:49 -08:00
Dan 33db9417ca Sync beads 2026-01-02 12:35:11 -08:00