[GH-ISSUE #5863] 99-netbird.conf ProxyCommand does not activate for peers running without SSH auth (--disable-ssh-auth) #11856

Open
opened 2026-08-05 01:31:21 -04:00 by saavagebueno · 0 comments
Owner

Originally created by @renne on GitHub (Apr 12, 2026).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/5863

Summary

When a Netbird peer runs with --disable-ssh-auth (or DisableSSHAuth: true in config), the auto-generated /etc/ssh/ssh_config.d/99-netbird.conf ProxyCommand is never used, making ssh peer.nb.example.com fail with "User authentication failed" instead of transparently proxying through Netbird.

Root Cause

99-netbird.conf uses a Match exec guard:

Match exec "netbird ssh detect %h %p"

netbird ssh detect returns:

  • exit 0 → Netbird SSH server with JWT required (ProxyCommand activates )
  • exit 1 → Netbird SSH server without JWT (--disable-ssh-auth) (ProxyCommand skipped )
  • exit 2 → Regular SSH server (ProxyCommand skipped, correct )

So peers with --disable-ssh-auth are indistinguishable from "not a Netbird host" from the SSH config perspective, and the ProxyCommand never fires.

Impact

Users who set --disable-ssh-auth to simplify access (no browser/device-code flow) find that ssh peer.nb.example.com silently falls through to regular SSH and fails, even though the Netbird SSH server is running and reachable.

Expected Behavior

99-netbird.conf should activate the ProxyCommand for both exit 0 (JWT) and exit 1 (no-auth) cases — i.e. any peer confirmed to be running a Netbird SSH server.

Suggested Fix

Change the Match exec condition (or add a second Host block) that covers exit code 1 as well:

# Activate for both JWT (exit 0) and no-auth (exit 1) Netbird SSH servers
Match exec "netbird ssh detect %h %p; [ 0 -le 1 ]"
    ProxyCommand netbird ssh proxy --host %h --port %p

Or alternatively, have netbird ssh detect exit 0 for both cases and return the auth mode via stdout/a different mechanism.

Workaround

Create /etc/ssh/ssh_config.d/98-netbird-nojwt.conf (loads before 99) with an unconditional ProxyCommand for known no-auth peers:

Host *.nb.example.com
    ProxyCommand netbird ssh proxy --host %h --port %p
    StrictHostKeyChecking no

This is fragile and requires manual maintenance as peers are added.

Environment

  • Netbird client: 0.68.x
  • OS: Linux (Ubuntu 24.04, Alpine 3.x)
  • Affected config: /etc/ssh/ssh_config.d/99-netbird.conf
Originally created by @renne on GitHub (Apr 12, 2026). Original GitHub issue: https://github.com/netbirdio/netbird/issues/5863 ## Summary When a Netbird peer runs with `--disable-ssh-auth` (or `DisableSSHAuth: true` in config), the auto-generated `/etc/ssh/ssh_config.d/99-netbird.conf` ProxyCommand is **never used**, making `ssh peer.nb.example.com` fail with "User authentication failed" instead of transparently proxying through Netbird. ## Root Cause `99-netbird.conf` uses a `Match exec` guard: ``` Match exec "netbird ssh detect %h %p" ``` `netbird ssh detect` returns: - **exit 0** → Netbird SSH server with JWT required (ProxyCommand activates ✅) - **exit 1** → Netbird SSH server without JWT (`--disable-ssh-auth`) (ProxyCommand skipped ❌) - **exit 2** → Regular SSH server (ProxyCommand skipped, correct ✅) So peers with `--disable-ssh-auth` are indistinguishable from "not a Netbird host" from the SSH config perspective, and the ProxyCommand never fires. ## Impact Users who set `--disable-ssh-auth` to simplify access (no browser/device-code flow) find that `ssh peer.nb.example.com` silently falls through to regular SSH and fails, even though the Netbird SSH server is running and reachable. ## Expected Behavior `99-netbird.conf` should activate the ProxyCommand for **both** exit 0 (JWT) and exit 1 (no-auth) cases — i.e. any peer confirmed to be running a Netbird SSH server. ## Suggested Fix Change the `Match exec` condition (or add a second `Host` block) that covers exit code 1 as well: ``` # Activate for both JWT (exit 0) and no-auth (exit 1) Netbird SSH servers Match exec "netbird ssh detect %h %p; [ 0 -le 1 ]" ProxyCommand netbird ssh proxy --host %h --port %p ``` Or alternatively, have `netbird ssh detect` exit 0 for both cases and return the auth mode via stdout/a different mechanism. ## Workaround Create `/etc/ssh/ssh_config.d/98-netbird-nojwt.conf` (loads before 99) with an unconditional ProxyCommand for known no-auth peers: ``` Host *.nb.example.com ProxyCommand netbird ssh proxy --host %h --port %p StrictHostKeyChecking no ``` This is fragile and requires manual maintenance as peers are added. ## Environment - Netbird client: 0.68.x - OS: Linux (Ubuntu 24.04, Alpine 3.x) - Affected config: `/etc/ssh/ssh_config.d/99-netbird.conf`
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#11856