Self-hosted monitoring for homelabs: host and container metrics and uptime checks from all your machines in one dashboard, with an optional AI agent that diagnoses incidents and suggests fixes.
Python ai-agentsaiopsdashboarddockerfastapihomelabincident-managementllmmonitoringopenaireactroot-cause-analysisself-hosteduptime-monitoring
Checklist: infrastructure, repository, dependencies
Read docker/* (Dockerfiles, nginx*.conf, Caddyfile, postgres/init/*.sql),
compose.yml, docker-compose.server.yml, collector-compose.yml, example.env,
.dockerignore, .gitignore, .github/workflows/*.yml, requirements*.txt,
src/frontend/package.json + lockfile.
1. Dockerfiles
-
USERis unprivileged in every image that allows it (docker-proxy and system-helper are exceptions because of the socket/capabilities: check that these are the only places and that they are justified). - Base images: pinned (digest or at least an exact version), not
latest; minimal. - No secrets in layers (
ARG/ENVwith tokens,COPY .env,.git,dev.db, keys);.dockerignoreexcludes.env*,.git,venv,*.db, tests,node_modules. - No
curl | sh, nopip installwithout pins/hashes for production dependencies, noaptwithout--no-install-recommendsand cleanup; the build does not execute untrusted code from the network. -
HEALTHCHECK/CMDdoes not start debug mode (--reload,--debug). - Frontend image: built multi-stage; production has no
node_modules, dev server, or source maps exposing the source code unless intended.
2. Compose files
For every service, record: user, cap_drop/cap_add, read_only,
security_opt: no-new-privileges, privileged, network_mode, pid, ports, volumes,
environment/secrets.
- Published ports are bound to a specific address (
127.0.0.1:or the VPN address), not0.0.0.0, except for the intentionally public frontend. Docker bypassesufw: a firewall rule is not protection. The backend, Postgres and docker-proxy have no published ports in the server stack. -
/var/run/docker.sockis mounted only into docker-proxy, nowhere else (backend, collector, frontend, helper). The same goes for/,/etc,/root,/home,/var/lib/docker. - Host mounts are
:rowherever possible;/hostfsis read-only; norwmounts of sensitive directories. - The volume holding the docker-proxy Unix socket is shared only by the proxy and the collector.
-
cap_drop: [ALL]by default; everycap_addjustified (onlyCAP_SYSLOGfor the helper). Noprivileged,pid: host,network_mode: host,ipc: hostordeviceswithout a reason. -
read_only: true+tmpfswhere needed;no-new-privilegeson everything. - Network segmentation: the collector gate is not on the reverse proxy's network; the
backend is not on a network that other apps can reach; Postgres only on an internal
network;
internal: truewhere egress is not needed. - Default/placeholder secrets: compose/
example.envcontain no real or weak default passwords (changeme,postgres,admin) that would remain in production; required values use${VAR:?message}so the stack does not start without them. - Images in compose for remote hosts are pinned by digest (
COLLECTOR_IMAGE,DOCKER_PROXY_IMAGE), and the panel does not generate a command without them. - Postgres: passwords not in plaintext in compose if
secrets:/env from.envis possible; no published 5432. - Healthchecks do not reveal secrets; restart policies do not hide a crash loop.
3. nginx (nginx.conf, nginx.strict.conf, nginx.collector.conf)
- The public side returns 404 for all collector endpoints (register, poll, enroll,
ingest, helper). Check the exact
locationblocks: prefix vs. exact, regex, trailing slash differences, upper/lower case,//,/./,%2f,..;/. Worst case: a path that nginx does not recognize as forbidden but that the backend normalizes into a collector endpoint. -
X-Collector-Via(and similar internal headers) is set only by the gate, and the public side clears/overwrites it (proxy_set_header X-Collector-Via "";). -
real_ip/X-Forwarded-For:set_real_ip_fromonly for private/Docker ranges,real_ip_recursivecorrect; no trust in XFF from the public side; the backend gets the real client IP for rate limiting. -
add_headerinheritance: anadd_headerin alocationblock discards alladd_headerdirectives from theserver/httplevel. Check that everylocationwith its ownadd_header(cache, CORS) repeats the security headers (CSP, nosniff, frame, HSTS), and that they are added withalwaysso they apply to errors too. - CSP: no
unsafe-inline/unsafe-evalforscript-src,default-src 'self',frame-ancestors 'none',object-src 'none',base-uri 'self',form-action 'self'; allowing inlinestyleis a known cost (React style attributes). - HSTS only on the strict/public configuration;
server_tokens off. -
client_max_body_sizelimited per location;client_body_timeout,proxy_*_timeout,limit_req/limit_connon sensitive routes (login, enroll) as a second layer. -
proxy_pass: watch the trailing slash (it changes path normalization); only the necessary headers are forwarded;proxy_set_header Hostis correct (the backend usesHostfor the Origin check); WebSocket upgrade only where needed. - No
autoindex on, noaliaswithout a trailing slash (traversal); is anything served besides the SPA's static files (.map,.env,.git)?try_filesdoes not expose hidden files. - TLS configuration (if nginx terminates it): protocols ≥ TLS 1.2, no weak ciphers. If Traefik terminates TLS, state that as an assumption, not a finding.
-
Caddyfile: is it a leftover/dev configuration? If it is on the production path, review it as strictly as nginx.
4. Postgres (docker/postgres/init/*.sql)
- The application connects as a user with minimal privileges (not superuser, not the schema owner if migrations are not needed at runtime), separate from the administrative one.
- Passwords in init scripts are not committed to the repository; no
trustauthentication from all addresses;pg_hbadoes not allow external connections. - No
CREATE EXTENSIONorGRANT ALLwithout a reason.
5. GitHub Actions (.github/workflows/images.yml)
This is the supply chain for images that hosts run with root-equivalent access.
-
permissions:least required (contents: read,packages: write,id-token: writeonly for the signing job); no broad default permissions. - Actions pinned to a full commit SHA, not a tag (
@v4), for actions that touch secrets or signing; check who maintains them. - No
pull_request_targetwith a checkout of PR code; the trigger is only av*tag and/or manual, not every push/PR from a fork. - Script injection: no
${{ github.event.* }}/${{ github.head_ref }}/ branch names or commit messages inserted directly intorun:(pass them viaenv:). - cosign signing: keyless identity bound to the workflow and ref; the digest output is
correct; images are built from the tagged commit; the build does not pull unpinned
dependencies without verification. Describe how the host verifies the signature
(documented; if
cosign verifyis not part of the generated command, that is a weakness: a signature nobody verifies protects nothing). - Secrets are not printed (
set -x,echo); nosecrets: inheritwithout a reason.
6. Repository and history
-
.gitignorecovers.env,*.db,*.sqlite, keys,venv,node_modules.git ls-files | grep -Ei '\.env$|\.db$|\.sqlite|\.pem$|\.key$|id_rsa|secret|credential': what is tracked by git? (dev.dbwas at one point.) Both.envandexample.envexist: check thatexample.envcontains no real values. - History:
git log --all --diff-filter=A --name-only | grep -Ei '\.env|\.db|key|secret'and a search for secret patterns (git log -p --all -S'SECRET' -S'PASSWORD' -S'TOKEN'over a reasonable range). A secret that was ever in the history is considered compromised even if it was later deleted; report it with a recommendation to rotate. Do not print values. - Pattern search in the working tree: keys (
AKIA,ghp_,sk-,-----BEGIN), passwords in code, hardcoded tokens,localhostauthentication bypasses,TODO/FIXME/HACKnext to the wordsauth,security,bypass,skip. -
TESTS.md,docs/,README.mdcontain no real secrets/domains/IP addresses of the owner. -
SECURITY.mdhas a vulnerability reporting path (it does) and accurate claims.
7. Dependencies
-
requirements*.txtandpackage-lock.json: pinned? Is the lockfile in sync withpackage.json? - If the tools are available (
pip-audit,npm audit --omit=dev), run them only with the user's confirmation (they send the package list to the registry). If they were not run, say so in the coverage section: do not claim the dependencies have "no known vulnerabilities". - Unnecessary/abandoned dependencies, dependencies from a URL/git,
postinstallscripts, typosquat names. Dev dependencies do not end up in the production image.