Project

General

Profile

Actions

Task #3805

closed

Expand Vectra IaC test coverage and harden wrappers

Added by Fredrick Amnehagen 10 minutes ago. Updated 10 minutes ago.

Status:
Done
Priority:
High
Target version:
-
Start date:
2026-11-30
Due date:
% Done:

100%

Estimated time:
Spent time:

Description

Value: the Vectra deployment should be proven by tests that detect drift between the repo, the live LXC and the security assumptions, not just by a successful Ansible run.

Acceptance criteria:

  • Add offline tests for env.sh failure modes, script hygiene, rendered nginx/systemd/env semantics, OpenTofu LXC safety settings, cross-file VMID/IP/node/domain consistency, app env defaults and worker deployment.
  • Add opt-in live tests for rendered-file drift, effective nginx config, systemd hardening, pinned Python deps, models-dir writability, DHCP/MAC agreement, IPAM metadata, auth boundary, Authelia backend reachability and the app upload contract.
  • Fix issues the tests expose: swallowed credential lookup errors in env.sh, brittle HTTP status matching and missing DHCP/internal/Authelia checks in verify, and nginx version disclosure.
  • Re-apply Ansible, run verify and both test modes green.

MoSCoW: S. Points: 3. Follows #3803.

Actions #1

Updated by Fredrick Amnehagen 10 minutes ago

  • Status changed from To do to In Progress
  • Assignee set to Fredrick Amnehagen

Claimed by fredrick on feature/3803-iac-cleanup-tests. Adding offline and live drift tests, then re-applying the deployment and running both modes.

Actions #2

Updated by Fredrick Amnehagen 10 minutes ago

  • Status changed from In Progress to Done
  • % Done changed from 0 to 100

Test expansion complete. Commit 8188178a3f4d1762ab36283b5b966984b8b60a63 (Refs #3805), pushed to PR https://forgejo.loopaware.com/Vectra/meta/pulls/2.

Coverage added:

  • Offline (41 passed, 14 live skipped): env.sh missing config/key/node and node overrides; wrapper strictness and no hardcoded /home paths; verify script layer checks; provisioning duplicate-LXC guard; nginx auth/SSE/upload/error-handler/version semantics; systemd hardening; env-file key allowlist; upload-limit headroom; OpenTofu LXC safety settings; state/plan gitignore; tfvars/inventory/wrapper/domain consistency; app env defaults; worker deployment; YAML parsing; README entrypoints; Authelia proposal not deployed; released duplicate IP not active.
  • Live (55 passed): tofu plan no-op; full verify PASS; live rendered files exactly match Jinja templates; effective nginx config; LXC unprivileged/features/datastore/IP; systemd hardening; pinned Python deps; models dir writable by vectra; DHCP MAC/name matches container; IPAM metadata; health/auth boundary/redirect target; internal _authelia_verify hidden; nginx version hidden; Authelia backend 401; app root/job-404/unsupported-upload/26MB-413 contract.

Fixes made while testing:

  • env.sh previously ignored a failed credential lookup (command substitution left an empty secret and continued); it now exits nonzero with a clear message. Covered by three failure-mode tests.
  • verify-vectra.sh now uses protocol-neutral 302 matching (HTTP/1.x and HTTP/2), checks DHCP hostname, effective nginx server_name, Authelia verify backend (401), and internal /_authelia_verify (404).
  • nginx now sets server_tokens off; live test asserts the version is not advertised.
  • Fixed a test helper that matched location / against location /events.

Deployment re-applied via provision wrapper: Ansible ok=25 changed=3 failed=0; [verify] PASS. Live suite run after deployment: 55 passed in 33.75s.

Actions

Also available in: Atom PDF