Repository navigation
Description
The Traefik static configuration is created with accessLog: {}. With this default Traefik drops all request headers, so the User-Agent field of every access log line is "-".
Why: log-based detection cannot use the User-Agent.
- ns8-crowdsec installs
crowdsecurity/base-http-scenarios, buthttp-bad-user-agentand the other User-Agent based scenarios never match. - External SIEMs (e.g. Wazuh) cannot detect scanners or Shellshock payloads in the User-Agent, nor ignore legitimate crawlers.
Purpose: give CrowdSec and SIEMs the User-Agent, without logging any other request header.
Proposed solution
Keep only the User-Agent request header in the access log; every other header stays dropped. Referer may contain tokens or OAuth codes, and Authorization/Cookie must never be logged.
accessLog:
fields:
headers:
defaultMode: drop
names:
User-Agent: keepcreate-module: new default.update-module.d/15upgrade_v3: an idempotent step, likeadd_metrics, that only replaces the defaultaccessLog: {}. A missing (disabled) or customizedaccessLogis left untouched.
Alternative solutions
- An opt-in action, like
set-trusted-proxies/get-trusted-proxies, also handled byrestore-module. - Editing
traefik.yamlby hand: it survives module updates, because15upgrade_v3reloads and rewrites the YAML keeping the keys, but it is lost onrestore-module.
Additional context
Tested on an NS8 node on 2026-10-14 (NS8 Core 3.19.0, traefik module 4.2.1, Traefik 3.6.10), by editing traefik.yaml and restarting the module: the User-Agent appears in the access log lines, the Referer is still "-", and the routes answer as before. The only error at startup is the already existing core.defaultRuleSyntax deprecation. On 2026-10-15 the same node was updated to Core 3.23.0 (traefik module 4.2.1 → 4.2.4) and the hand-edited accessLog was kept, as expected from 15upgrade_v3.
The ns8-wazuh module and CrowdSec would both use the field (see the community discussion).
See also
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsIn Progress
Activity
fix: handle a bare accessLog in the update step