Skip to content

Changes on top of v0.7.4 (rebased, for upstream) - #11

Closed
CorentinFelten wants to merge 13 commits into
masterfrom
feat/upstream-next
Closed

CorentinFelten wants to merge 13 commits into
masterfrom
feat/upstream-next

Conversation

@CorentinFelten

Copy link
Copy Markdown
Owner

Fork-internal PR to run CI on the rebased branch before the upstream PR. Supersedes #10.

LounnM and others added 13 commits October 27, 2026 14:32
Build and publish multi-arch Docker images (amd64, arm64)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r observability

Instancer:
- Add optional instancer.compose_project_prefix. Unset keeps upstream
  names; set, it prefixes team and unique instance projects.
- Load numbered challenge definition files (challenge-*.yml) and keep
  walking a directory after a match, parse error, duplicate or non-zync
  file instead of skipping its remaining siblings.
- Add deploy_parameters.instance_group so several challenge entries
  share one deployment; deployments, locks and jobs use InstanceKey(),
  including the admin unique-challenge endpoints.
- Case-insensitive category lookups in the index and deployment queries.
- Infer published_ports / http_port from deploy_parameters.port.
- Keep services on the compose default network when attaching Traefik.
- Extend/Terminate resolve the challenge before the deployment lookup.

Playbooks / image:
- Rename the compose_definition fact (it collided with the extra-var),
  tolerate kill failures on delete, add kill step to tcp delete, and
  install community.docker in the instancer image.

Monitoring / extras:
- Worker cAdvisor + Traefik scrape jobs, Loki, Promtail, TCP access
  logger, AI-usage and worker-traffic Grafana dashboards.
- School scoreboard service and CTFd theme header/footer snippets.
Connection info normally stops at the first Traefik HTTP URL, hiding
every published TCP port of the instance. deploy_parameters.show_tcp_ports
lists the HTTP URL first, then each published port (sorted, deduplicated,
IPv6 binds skipped), one per line.

Also update the AI-usage Grafana dashboard to the version used live
(markdown links to instances).
- monitoring/worker: the worker-side compose (Traefik with JSON access
  log keeping User-Agent/Referer, Prometheus metrics on :8082, DNS-01
  wildcard cert via Cloudflare; docker-stats-exporter; tcp-access-logger;
  Promtail), dynamic/tls.yml for the wildcard cert, cf.env.example.
- monitoring/docker-stats-exporter: small exporter reading the Docker
  socket, exposing per-container CPU/memory/network with cAdvisor-style
  names. This is what the worker-cadvisor scrape job targets on :8088.
… theme

- compose_project_prefix defaults to "ctf-event" and applies to both team
  and unique instances (<prefix>-global-...). No PolyCyber-specific default.
- Instances named by v0.7.2-v0.7.4 (polypwn-/global- names) are added to the
  upgrade cleanup next to the v0.7.1 names: playbooks now loop over
  legacy_compose_projects.
- Remove school-scoreboard/ and theme/, which are event-specific.
Instance groups, configurable compose prefix, deploy fixes, and worker observability
GetConnectionInfo returned at the first container that had a Traefik
router label or a published port, so an instance with several
user-facing services (e.g. a web front end and an SSH service, both
exposed with expose:) reported only one of them, whichever Ansible
listed first. To find a route, it also took the first
traefik.http.routers.* label of a map, in random order: with
author-written router labels besides the rule (entrypoints, tls,
middlewares), the route was found or missed at random.

It now goes through every container, ordered by compose service then
name, and lists each Host() of each router rule as https://<host>/,
then each published IPv4 port as <scheme>://<host>:<port> (the port's
protocol hint, or its protocol), one per line without duplicates.
Only .rule labels are read, and containers with traefik.enable=false
are skipped. An instance with a single endpoint reports it as before.
Zync needs Galvanize's version to check that the two are compatible.
The project is open source, so a version also tells anyone which known
issues a deployment has: it is reported to admins only.

GET /admin/version returns {"version": "..."}, the version set at
startup (ServerOpts.Version, from the binary's Version). Like every
route but /health and /metrics, it requires a valid HS256 token signed
with the JWT secret, and the handler refuses any role but admin, so
requests without a valid token get 401 and player tokens 403, without
the version. /health is unchanged.

The JWT middleware setup moves to jwtMiddleware, so tests send real
requests through it: no token, a wrong key, an unsigned (alg none)
token, an expired admin token, player and role-less tokens.
The API served /metrics on its own port, skipped by the JWT
middleware, so anyone who could reach the API read every metric:
challenge names, team IDs, deployment counts. The route predates the
metrics server on :5001 (basic auth when metrics.password is set),
added later with the Prometheus and Grafana stack, which scrapes
instancer:5001 as the README documents.

Nothing else uses the API port's route: not the monitoring stack, the
load test, Zync, nor ctfd-management, whose Traefik router already
excludes /metrics. It is removed, along with its JWT exemption: the API
port now answers /metrics with 401, or 404 with a token. Request
metrics are still gathered and served on :5001, unchanged.
@CorentinFelten

Copy link
Copy Markdown
Owner Author

Superseded: merged upstream as 28Pollux28#8, released in v0.7.5.

@CorentinFelten
CorentinFelten deleted the feat/upstream-next branch November 12, 2026 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants