homelab-mcp.service: SSH as root, the restricted shell is the boundary

Unit was hard-coding HOMELAB_MCP_SSH_USER=mcp-reader, overriding the new
code's 'root' default. No mcp-reader user exists on hubris — the key is
authorized for root, with a strict command= wrapper. Also pin
HOMELAB_MCP_HUBRIS_HOST + KNOWN_HOSTS env so the service doesn't depend
on the python defaults staying in sync with the unit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
root
2026-05-20 20:23:49 +02:00
parent 3f41416805
commit a5ee017291

View File

@@ -8,7 +8,12 @@ Type=simple
WorkingDirectory=/opt/homelab-context
Environment=HOMELAB_CONTEXT_DIR=/opt/homelab-context
Environment=HOMELAB_MCP_SSH_KEY=/etc/homelab-mcp/mcp-reader.key
Environment=HOMELAB_MCP_SSH_USER=mcp-reader
# SSH user is `root` on hubris — the restricted shell at command="..." in
# authorized_keys (see mcp/mcp-reader-shell) provides the access boundary,
# not a separate user account.
Environment=HOMELAB_MCP_SSH_USER=root
Environment=HOMELAB_MCP_HUBRIS_HOST=192.168.8.77
Environment=HOMELAB_MCP_SSH_KNOWN_HOSTS=/etc/homelab-mcp/known_hosts
ExecStart=/opt/homelab-mcp/.venv/bin/python /opt/homelab-mcp/mcp/server.py
Restart=on-failure
RestartSec=5