You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating a preauth key in a configuration where headscale would log a warning, the auth key written to stdout is polluted by these warning log messages. This affects the human-readable output format, but also -o json.
Environment
Version of headscale used v0.22.3
Version of tailscale client: N/A
OS (e.g. Linux, Mac, Cygwin, WSL, etc.) and version: NixOS 23.11
Kernel version 6.1.72
The relevant config parameters you used: see below; notice absence of ip_prefixes
Log output from running headscale preauth create --user basic --reusable -e 24h 2>/dev/null: see below
Headscale is behind a (reverse) proxy
Headscale runs in a container
To Reproduce
Generate a config like above, where ip_prefixes isn't set
Run headscale users create basic and headscale preauthkeys create --reusable -e 24h -u basic > /tmp/preauth-key
Observe that /tmp/preauth-key contains log messages, followed by the preauth key, like:
2024-02-27T15:21:33Z WRN 'ip_prefixes' not configured, falling back to default: [100.64.0.0/10]2024-02-27T15:21:33Z WRN 'ip_prefixes' not configured, falling back to default: [100.64.0.0/10]67ba496fdb8f7cda2bd3e682f976e7087bbbdd1844a6dcff
You're right, there is a way to avoid having headscale print that warning. What I'm trying to get at is that whenever headscale used as a CLI program that is meant to emit machine-readable output logs a warning, that warning corrupts the machine-readable output (and the output doesn't go anywhere that a human could pick it up, like stderr).
The config-example.yaml in main gives prefixes rather than ip_prefixes ... that might explain it. The config example for v0.22.3 gives ip_prefixes appropriately however.
Thank you, again, I know why the warning gets written.
What I would like to see fixed is that if a (any!) warning gets written, that warning goes to stderr, which then pollutes the (otherwise usable) output.
Bug description
When creating a preauth key in a configuration where
headscale
would log a warning, the auth key written to stdout is polluted by these warning log messages. This affects the human-readable output format, but also-o json
.Environment
Version of headscale used v0.22.3
Version of tailscale client: N/A
OS (e.g. Linux, Mac, Cygwin, WSL, etc.) and version: NixOS 23.11
Kernel version 6.1.72
The relevant config parameters you used: see below; notice absence of
ip_prefixes
Log output from running
headscale preauth create --user basic --reusable -e 24h 2>/dev/null
: see belowHeadscale is behind a (reverse) proxy
Headscale runs in a container
To Reproduce
ip_prefixes
isn't setheadscale users create basic
andheadscale preauthkeys create --reusable -e 24h -u basic > /tmp/preauth-key
/tmp/preauth-key
contains log messages, followed by the preauth key, like:Logs and attachments
config file:
The text was updated successfully, but these errors were encountered: