87339da1b2
SECURITY /api/agent/ws authenticated nothing. There was no agent registry, so any client reaching the SSO could register as a node, publish discovery and telemetry into the admin view, and receive commands -- including a signed arbitrary_bash -- addressed to a token it guessed. Tokens were generated in the BROWSER and never recorded server-side, so there was nothing to validate against and no way to revoke one. Agents are now rows in a new Agent table, authenticated by SHA-256 token hash before the connection is registered or the welcome payload is sent. Tokens are minted by POST /api/agent/enroll and shown once. Revoke and rotate drop the live socket immediately. All agent actions are audited. The Ed25519 command-signing key was generated in the AgentManager constructor, so it changed on every restart and the public_key pinned in an agent's agent.yml stopped matching. It now lives in OpenBao at secret/agent/signing-key; if it cannot be loaded the SSO refuses to send high-risk commands rather than signing with a key no agent has seen. DIRECTORY Agents bind to a host resource instead of being matched by hostname, and a bound agent's discovery is written onto that resource -- previously the one source running ON the host contributed nothing to the directory. The resource tree is collapsible, with state persisted per browser. DISCOVERY The Proxmox plugin zipped MACs and IPs from two flat lists by index, attributing addresses to the wrong NIC on multi-NIC guests. NICs are now keyed by MAC. Adds an endpoint resource parenting each node, sourceId/ vmid/node identity, container-interface filtering, node IP/MAC, and offline-node handling. The reconciler could make a resource its own parent, named hosts after their MAC address, had a dead isIp() regex (\\. matches a backslash), merged across kinds, and re-read the whole inventory per resource. Dockerfile.test-runner never copied nodejs/plugins, so every plugin test suite failed in CI as "Cannot find module". Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
53 lines
1.7 KiB
Docker
53 lines
1.7 KiB
Docker
# Test-runner image for SSO Manager.
|
|
#
|
|
# Installs all dependencies (including dev) and bundles the app code plus
|
|
# the seed script. The entrypoint waits for LDAP + Redis, seeds the test
|
|
# user, then runs whatever command is given (default: npm test).
|
|
|
|
FROM node:20-alpine
|
|
|
|
# Install OpenLDAP clients (ldapadd, ldapsearch) and bash for the seed script
|
|
RUN apk add --no-cache openldap-clients bash
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy and install dependencies (including devDependencies for jest/supertest)
|
|
COPY nodejs/package*.json ./
|
|
RUN npm ci
|
|
|
|
# Copy the application source
|
|
COPY nodejs/app.js ./
|
|
COPY nodejs/bin ./bin
|
|
COPY nodejs/conf ./conf
|
|
COPY nodejs/controller ./controller
|
|
COPY nodejs/middleware ./middleware
|
|
COPY nodejs/models ./models
|
|
# Without this the discovery/plugin suites cannot even load their subject and
|
|
# fail as "Cannot find module ../plugins/discovery/..." -- plugin code was
|
|
# effectively untested in CI.
|
|
COPY nodejs/plugins ./plugins
|
|
COPY nodejs/routes ./routes
|
|
COPY nodejs/services ./services
|
|
COPY nodejs/utils ./utils
|
|
COPY nodejs/views ./views
|
|
COPY nodejs/public ./public
|
|
COPY nodejs/tests ./tests
|
|
|
|
# SQLite database directory (config/inventory.sqlite for Resource model's ORM)
|
|
RUN mkdir -p /app/config
|
|
|
|
# Files expected at the flattened /app path (see Dockerfile.openldap notes)
|
|
COPY tos.md /tos.md
|
|
COPY README.md /README.md
|
|
COPY CHANGELOG.md /CHANGELOG.md
|
|
COPY API.md /API.md
|
|
COPY directory_spec.md /directory_spec.md
|
|
|
|
# Seed script and utility
|
|
COPY test_seed.js ./test_seed.js
|
|
COPY test/seed-test-user.sh /usr/local/bin/seed-test-user
|
|
RUN chmod +x /usr/local/bin/seed-test-user
|
|
|
|
# Default command: seed the test user, then run the test suite
|
|
CMD ["sh", "-c", "seed-test-user && npm test"]
|