Improve error message for bad enrollment server URLs

Open Beginner friendly
#9 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
go

Research direction

Start at auth/manager.go:139 and reproduce the enrollment attempt with the endpoint shown in the issue, first without and then with the /graylog proxy path. Trace the JWKS decoding failure and improve the resulting error description so it points users toward an incorrect enrollment server URL or missing proxy path.

Written by the indexing model from the issue text.

Description

While testing the MSI installer, I've forgotten to add the proxy path my test cluster is using:

PS C:\Program Files\Graylog\Collector> $env:GLC_SERVER__AUTH__ENROLLMENT_ENDPOINT = "https://hostname"
PS C:\Program Files\Graylog\Collector> $env:GLC_SERVER__AUTH__ENROLLMENT_TOKEN = "<redacted>"
PS C:\Program Files\Graylog\Collector> & "C:\Program Files\Graylog\Collector\graylog-collector-windows-amd64.exe" supervisor
{"level":"info","ts":1776769833.1377687,"logger":"supervisor","caller":"supervisor/supervisor.go:304","msg":"Starting supervisor","instance_uid":"fcaa1475-c0f6-441e-9a6f-dc6a1fe90d00","endpoint":"https://hostname/v1/opamp"}
{"level":"info","ts":1776769833.1396508,"logger":"supervisor","caller":"supervisor/supervisor.go:780","msg":"Preparing enrollment"}
{"level":"info","ts":1776769833.1401725,"logger":"supervisor.auth","caller":"auth/manager.go:139","msg":"Preparing enrollment","instance_uid":"fcaa1475-c0f6-441e-9a6f-dc6a1fe90d00","endpoint":"https://hostname"}
Error: failed to start supervisor: authentication initialization failed: enrollment preparation failed: failed to fetch JWKS: failed to decode JWKS: invalid character '<' looking for beginning of value
PS C:\Program Files\Graylog\Collector> $env:GLC_SERVER__AUTH__ENROLLMENT_ENDPOINT = "https://hostname/graylog"

The error message is likely not helpful for a user, we should include a better description of what might be the issue here.

Dominant language
Go
Stars
1
Forks
0
Avg merge
3d 1h
Merged PRs (30d)
7

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Graylog2/collector

All issues in Graylog2/collector

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.