Commit graph

59 commits

Author SHA1 Message Date
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
Dan f6540cfbd5 Add direnv to system packages for per-project devshells 2026-01-02 12:32:32 -08:00
Dan d387b0b910 Add learner environment integration tests
- test-learner-env.sh: SSH, nix-ld, Slack tokens, Python, API connectivity
- test-slack-bolt.py: Socket Mode connection test
- Makefile: test runner with env/slack-bolt/vscode targets
- Add python3 + uv to system packages

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 12:16:58 -08:00
Dan 21c356979e Enable nix-ld for VS Code Remote-SSH 2026-01-02 10:22:07 -08:00
Dan 1ca39f2923 Add direct Slack path epic (ops-jrz1-2bu) 2025-12-29 18:57:08 -05:00
Dan 0ad7ca7b98 Add direct Slack bot path for learners
- learner-add.sh: add users to learners group, source Slack env
- New design doc comparing direct Slack vs maubot/Matrix approach

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 18:56:03 -05:00
Dan 29ce3a9fa5 Fix learner-add.sh for NixOS compatibility
- Use 'users' group instead of per-user groups
- Remove shell specification (NixOS has different paths)
- Use 'ip' command instead of 'hostname -I' for IP detection
2025-12-29 00:08:18 -05:00
Dan 3d33a45cc9 Add learner dev environment, testing infrastructure, and skills
Learner account management:
- learner-add.sh: create accounts with SSH, plugin skeleton
- learner-remove.sh: remove accounts with optional archive
- plugin-skeleton template: starter maubot plugin

Testing:
- flake.nix: add checks output for pre-deploy validation
- smoke-test.sh: post-deploy service verification

Documentation:
- learner-onboarding.md: VS Code Remote-SSH setup guide
- learner-admin.md: account management procedures

Skills:
- code-review.md: multi-lens code review skill
- orch, worklog: symlinks to shared skills
2025-12-28 22:23:06 -05:00
Dan abe2adfead refactor: standardize agent instruction files
- AGENTS.md: Consolidated source of truth (159 lines)
- CLAUDE.md: Thin wrapper (@AGENTS.md import)
- GEMINI.md: New, with skills pointer for Gemini CLI

Previously CLAUDE.md had 477 lines duplicating/extending AGENTS.md content.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 01:12:27 -05:00
Dan b40b88bb7f Add docs, ignore local dev config 2025-12-08 16:31:40 -08:00
Dan acfee9fea9 Add maubot spec artifacts (research, data-model, checklists) 2025-12-08 16:31:10 -08:00
Dan 8826d62bcc Add maubot integration and infrastructure updates
- maubot.nix: Declarative bot framework with plugin deployment
- backup.nix: Local backup service for Matrix/bridge data
- sna-instagram-bot: Instagram content bridge plugin
- beads: Issue tracking workflow integrated
- spec 004: Browser-based dev environment design
- nixpkgs bump: Oct 22 → Dec 2
- Fix maubot health check (401 = healthy)
2025-12-08 15:55:12 -08:00
Dan f25a8b06ef Production hardening and technical debt cleanup
Priority 1 - Production Quality:
- Revert Matrix homeserver log level from debug to info
- Reduces log volume by ~70% (22k+ lines/day to <7k)
- Improves performance and reduces disk usage

Priority 2 - Technical Debt:
- Automate sender_localpart fix in mautrix-slack.nix
- Eliminates manual sed command on fresh deployments
- Fix verified working (tested 2025-10-26)
- Update CLAUDE.md to document automated solution

Priority 3 - Project Hygiene:
- Remove unused mautrix-whatsapp and mautrix-gmessages imports
- Archive old configurations to docs/examples/alternative-deployments/
- Remove stale staging/ directories from 001 extraction workflow
- Update deployment documentation in tasks.md and quickstart.md
- Add deployment status notes to spec files

Files Modified:
- modules/dev-services.nix: log level debug → info
- modules/mautrix-slack.nix: automatic sender_localpart fix
- hosts/ops-jrz1.nix: remove unused bridge imports
- CLAUDE.md: update Known Issues, add Resolved Issues section
- specs/002-*/: add deployment status notes
- configurations/ → docs/examples/alternative-deployments/

Tested and Verified:
- All services running (matrix, bridge, forgejo, postgresql, nginx)
- Bridge authenticated and message flow working
- sender_localpart fix generates correct registration file
2025-10-26 15:59:05 -07:00
Dan fb27e5b709 Add Trunk-Based Development workflow documentation to CLAUDE.md 2025-10-26 15:21:14 -07:00
Dan 2dfe4ea829 Document current architecture, manual fixes, and QA checklist
Added comprehensive documentation:
- Manual workaround for sender_localpart registration bug
- QA testing checklist for untested features
- Future monitoring/alerting requirements
- Current architecture diagram and data flow
- Security model and operational notes
2025-10-26 14:52:31 -07:00
Dan 0b1751766b Ignore worklogs directory for security
Worklogs may contain sensitive troubleshooting information, error messages,
tokens, or infrastructure details that should not be in version control.
2025-10-26 14:37:26 -07:00
Dan bce31933ed Add platform vision and spec-kit integration docs 2025-10-26 14:36:52 -07:00
Dan ca379311b8 Add Slack bridge integration feature specification
Includes spec, plan, research, data model, contracts, and quickstart guide
for mautrix-slack Socket Mode bridge deployment.
2025-10-26 14:36:44 -07:00
Dan d69f8a4ac8 Add Forgejo repository setup worklog 2025-10-26 14:36:42 -07:00
Dan 3337175436 Ignore VM disk images 2025-10-26 14:34:50 -07:00
Dan 406dda9960 Untrack spec-kit framework files
These files are maintained in ~/proj/spec-kit repo and should not be
tracked here. Added to .gitignore to prevent future tracking.
2025-10-26 14:34:18 -07:00
Dan a00a5fe312 Deploy mautrix-slack bridge with IPv4 networking fixes
Changes:
- Fix nginx proxy_pass directives to use 127.0.0.1 instead of localhost
- Fix bridge homeserverUrl to use explicit IPv4 address
- Enable debug logging on conduwuit
- Add spec-kit framework files to .gitignore
- Document deployment in comprehensive worklog

Resolves connection refused errors from localhost resolving to IPv6 [::1]
while services bind only to IPv4 127.0.0.1. Bridge now fully operational
with bidirectional Slack-Matrix message flow working.
2025-10-26 14:33:00 -07:00
Dan 8d51f6f16e Fix bridge homeserver URL to use IPv4 (127.0.0.1) instead of localhost 2025-10-25 21:48:38 -07:00
Dan 776a5a71eb Update nixpkgs-unstable for conduwuit 0.5.0-rc.8 2025-10-25 17:50:37 -07:00
Dan 7ca9770e14 Remove TOML appservice config - conduwuit uses admin command registration 2025-10-25 17:40:47 -07:00
Dan d6e0df31ae Fix mautrix-slack configuration and Matrix integration
- Add bridge.permissions for clarun.xyz to fix crash loop
- Configure Matrix homeserver to load appservice registration
- Update workspace from delpadtech to chochacho
- Remove duplicate matrix-homeserver service config
- Fix sops secret permissions for DynamicUser services
2025-10-25 17:36:07 -07:00
Dan c4a00356fc Add comprehensive security & validation test report for Generation 31
Performed full security audit including:
- Matrix API endpoint validation
- TLS/nginx reverse proxy verification
- sops-nix secrets management testing
- Firewall and network security analysis
- SSH hardening verification
- Database connectivity and permissions
- System integrity and log review

Results: All critical tests PASSED
- Excellent network isolation (Matrix/PostgreSQL localhost-only)
- Proper secrets encryption with sops-nix
- Strong SSH hardening (key-only authentication)
- Valid TLS with HSTS enabled
- Minimal attack surface (only SSH/HTTP/HTTPS exposed)

Known issues documented:
- mautrix-slack exit code 11 (non-critical)
- fail2ban not enabled (optional enhancement)
- Forgejo migrations in progress (temporary)

System validated as PRODUCTION READY.

Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-21 22:25:08 -07:00
Dan 64246a6615 Deploy Generation 31 with sops-nix secrets management
Successfully deployed ops-jrz1 Matrix platform to production VPS using
extracted modules from ops-base. Validated deployment workflow following
ops-base best practices: boot -> reboot -> verify.

Changes:
- Pin sops-nix to June 2024 version for nixpkgs 24.05 compatibility
- Configure sops secrets for Matrix registration token and ACME email
- Add encrypted secrets.yaml (safe to commit, encrypted with age)
- Document deployment process and lessons learned

All services verified running:
- Matrix homeserver (matrix-continuwuity): conduwuit 0.5.0-rc.8
- nginx: Proxying Matrix and Forgejo
- PostgreSQL 15.10: Database services
- Forgejo 7.0.12: Git platform

Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-21 21:32:23 -07:00
Dan 40e5501dd5 Fix: Add olm permission to pkgs-unstable in production config
- Configure pkgs-unstable with permittedInsecurePackages in flake.nix
- Matches VM configuration approach
- Allows mautrix bridges to build successfully
2025-10-21 18:38:42 -07:00
Dan 0cbbb19da2 Allow olm-3.2.16 for mautrix bridges in production
- Add permittedInsecurePackages for deprecated olm library
- Required by mautrix-slack, mautrix-whatsapp, mautrix-gmessages bridges
- Acceptable risk for Matrix bridge functionality until alternatives available
2025-10-21 18:37:03 -07:00
Dan 982d2886e4 Add ACME configuration for Let's Encrypt certificates
- Accept Let's Encrypt terms of service
- Configure email for certificate notifications (dlei@duck.com)
- Nginx virtual hosts already configured with enableACME and forceSSL

Ready for deployment to VPS.
2025-10-21 18:34:13 -07:00