Add the foundation for distributing homelab context to every client (LXCs, VMs, workstations including republic-laptop, mac-mini, ludo-mini) with a single source of truth, structured query layer (MCP), and per-client age-key issuance for secrets: - inventory.yaml — canonical topology (hosts, services, mesh addresses) - hosts/*.yaml — per-host identity files generated from inventory by mcp/build_host_files.py; do not edit by hand - AGENTS.md — orientation doc symlinked to /root/AGENTS.md on every client - bootstrap.sh — one-shot enroll (Linux + macOS), clones repo, fetches age key from issuance, installs sync timer/launchd job, drops the homelab CLI - bin/homelab — single-binary Python CLI: whoami, list, ssh, pct, logs, restart, open, status, secret, sync, mcp, client add/remove, nuke - mcp/server.py — FastMCP server: context tools + read-only management tools (no mutations exposed); shell-outs use mcp-reader restricted ssh key - mcp/deploy/ — claudio-monitor-style gitea webhook deploy scaffold for the MCP service on LXC 105 (ports 9810 mcp, 9811 webhook) - secrets-issuance/ — per-client age key auto-provisioning over the mesh; source-IP gated against inventory, with denylist for revoked clients (ports 9820 issue, 9821 webhook) - secrets/, .sops.yaml — SOPS recipient scaffolding; the operator fills in age public keys after Phase 3a generates them - scripts/sync/ — systemd timer (Linux) + launchd plist (macOS) pulling /opt/homelab-context every 5 min Mesh: both Netbird (preferred, 100.122.0.0/16) and Tailscale accepted during the in-flight migration; no client is gated on completing the move. Plan reference: /root/.claude/plans/lets-make-a-plan-fluttering-trinket.md Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
58 lines
2.1 KiB
Bash
Executable File
58 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# Install/update secrets-issuance on LXC 105 (apps). Idempotent.
|
|
set -euo pipefail
|
|
|
|
REPO_DIR=${REPO_DIR:-/opt/secrets-issuance}
|
|
|
|
cd "$REPO_DIR"
|
|
echo "[deploy] git pull"
|
|
git pull --ff-only
|
|
|
|
echo "[deploy] ensure python venv + deps"
|
|
if [ ! -d /opt/secrets-issuance/.venv ]; then
|
|
python3 -m venv /opt/secrets-issuance/.venv
|
|
fi
|
|
/opt/secrets-issuance/.venv/bin/pip install --quiet --upgrade pip
|
|
/opt/secrets-issuance/.venv/bin/pip install --quiet pyyaml
|
|
|
|
echo "[deploy] verify dependencies (age, shred)"
|
|
command -v age-keygen >/dev/null || { echo "age-keygen not installed: apt install -y age" >&2; exit 1; }
|
|
command -v shred >/dev/null || { echo "shred not installed: apt install -y coreutils" >&2; exit 1; }
|
|
|
|
echo "[deploy] state dir"
|
|
install -d -m 700 /var/lib/secrets-issuance
|
|
install -d -m 700 /var/lib/secrets-issuance/keys
|
|
|
|
echo "[deploy] admin token dir"
|
|
install -d -m 700 /etc/secrets-issuance
|
|
if [ ! -s /etc/secrets-issuance/admin-token ]; then
|
|
head -c 32 /dev/urandom | base64 > /etc/secrets-issuance/admin-token
|
|
chmod 600 /etc/secrets-issuance/admin-token
|
|
echo "[deploy] generated admin token at /etc/secrets-issuance/admin-token"
|
|
fi
|
|
|
|
echo "[deploy] install systemd units"
|
|
install -m 644 secrets-issuance/server.service \
|
|
/etc/systemd/system/secrets-issuance.service
|
|
install -m 644 secrets-issuance/deploy/webhook/secrets-issuance-deploy.service \
|
|
/etc/systemd/system/secrets-issuance-deploy.service
|
|
|
|
if [ ! -d /opt/homelab-context/.git ]; then
|
|
echo " /opt/homelab-context is not a git clone — run bootstrap.sh first." >&2
|
|
exit 1
|
|
fi
|
|
|
|
systemctl daemon-reload
|
|
if systemctl is-active --quiet secrets-issuance.service; then
|
|
systemctl restart secrets-issuance.service
|
|
fi
|
|
if systemctl is-active --quiet secrets-issuance-deploy.service; then
|
|
systemctl restart secrets-issuance-deploy.service
|
|
fi
|
|
|
|
echo "[deploy] done"
|
|
echo "First-time enable:"
|
|
echo " systemctl enable --now secrets-issuance.service secrets-issuance-deploy.service"
|
|
echo "Webhook first-time setup:"
|
|
echo " $REPO_DIR/secrets-issuance/deploy/webhook/install.sh"
|