Repository navigation
Name an http:// server and the server's 401 reason in the log - #48
Merged
Merged
Conversation
Forum topic 18320: an agent pointed at an http:// server logged "could
not ask the server which features it offers ... Check that the server
is reachable", then "server refused this certificate" forever. Neither
line named the cause.
- The directory feature check sends nothing to a non-https address.
The agent now says the address is not https:// and leaves directory
rejoin off without retrying, instead of blaming reachability.
- A 401 carries the server's reason. The refusal lines now print it
(no_client_certificate, server_error, ambiguous_certificate) with what
to check. The reason is logged only if it matches [a-z_]{1,64}.
unknown_certificate keeps its own sentinel and behavior.
- protocol-v1.md: the 401 rows now split by reason, and the feature
check paragraph covers the non-https case and the retry.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Forum topic 18320. An agent pointed at an
http://FOG server logged two lines that named no cause:directory rejoin: could not ask the server which features it offers ... Check that the server is reachable. The check sends nothing to a non-https address, so reachability was never the issue.server refused this certificate (Ns); keeping it and retrying, forever. The server sent a reason with the 401 (no_client_certificate), and the agent dropped it.Change
internal/enroll/directory_features.go: a non-https address returns the newErrDirectoryFeaturesNeedHTTPS.cmd/fog-agent/directory_rejoin.gologs the configured address as the cause and leaves directory rejoin off, with no retry.internal/enroll/client.go: a 401 with a reason returns arefusedErrorthaterrors.Ismatches toErrUnauthorizedonly.UnauthorizedReason()reads it. The reason is kept only if it matches^[a-z_]{1,64}$.unknown_certificateis unchanged.cmd/fog-agent/facts.go,main.go: both refusal lines print the reason and what to check.docs/design/protocol-v1.md: the poll and renew 401 rows split by reason. The feature-check paragraph covers the non-https case and the retry of an unavailable server.Verified
cmd/fog-agentandinternal/enroll. Each one fails with the old behavior put back and passes with the fix.gofmt -l .,go vet(linux, windows, darwin),go test ./... -count=1, and the build.🤖 Generated with Claude Code