Commit Graph

3121 Commits

Author SHA1 Message Date
Dmitri Dolguikh
4d1d7edbc9 fix combined server config around sync message versioning
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-14 14:54:39 +02:00
Dmitri Dolguikh
28d8a19331 fix tests
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-14 14:23:11 +02:00
Dmitri Dolguikh
9160873f94 Merge remote-tracking branch 'origin/main' into components-impl-drop-indexes-use-xids
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-14 14:17:53 +02:00
Dmitri Dolguikh
c15e1cec1d added support for per-account sync message versions
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-14 14:16:35 +02:00
Dmitri Dolguikh
bbe62e0223 more linter fixes
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-14 12:57:47 +02:00
Dmitri Dolguikh
300981db04 fix linter issues
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-14 12:56:11 +02:00
Dmitri Dolguikh
47a99768a4 propagate client-side DisableComponentNetworkMap flag
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-14 12:44:01 +02:00
Dmitri Dolguikh
5d793985d4 add support for sync message version negotiation
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-14 12:12:49 +02:00
Riccardo Manfrin
a48618c074 [client] Fix forwarder peers never excluded from lazy connections (#6674)
* [client] Extract peerRoutesAddr helper in toExcludedLazyPeers

Refactor: pull the AllowedIPs match into a named
peerRoutesAddr helper and document why forward-target peers are excluded
from lazy connections. No behavior change; the existing address match is
preserved as-is.

* [client] Add failing test for lazy-conn forward-target exclusion

toExcludedLazyPeers compares AllowedIPs (CIDR) against the unmasked
TranslatedAddress, so forward-target peers are never excluded. This test
asserts the peer is excluded and fails on the current behavior; the fix
follows.

* [client] Fix lazy-conn exclusion for ingress forward peers

peerRoutesAddr compared AllowedIPs (CIDR, e.g. a peer's overlay IP as /32)
against the unmasked TranslatedAddress string, so the match never fired and
forward-target peers were never excluded from lazy connections. Use prefix
containment so a routed address matches the peer's AllowedIP

* [client] Reuse parsed AllowedIPs from peerStore in lazy exclusion

Instead of re-parsing the network map AllowedIPs strings, look up the
already-parsed []netip.Prefix from peerStore.AllowedIPs (the same typed
value the lazy manager itself consumes). A down/lazy peer still has its
conn in the store, so exclusion is unaffected by connection state. Extract
a pure prefixesContain helper and unit-test it.
2026-07-14 12:12:37 +02:00
Riccardo Manfrin
39193396f5 [client] Fix WGWatcher silently failing to restart on fast disconnect/reconnect (#6664)
* Stick new watcher creation to actual existence of af the conn

and its removal to the removal of such same conn.
Avoid debouncing and cross lock dead locking

* Discriminate not updated from timeout handshakes

* [Recheck watcher ctx cancellation under conn.mu in onWGDisconnected

onWGDisconnected only checked conn.ctx (the engine-scoped context), never
the watcher's own context. disableWgWatcherIfNeeded cancels the wgWatcherCtx,
not conn.ctx, so a disabled watcher's timeout callback did not see the
cancellation.

handshakeCheck runs lock-free, so between the ctx check in periodicHandshakeCheck
and acquiring conn.mu a fast disconnect/reconnect can slip in: the stale watcher
then acquires the lock and tears down the *new*, healthy connection based on the
old timeout, forcing the guard into an unnecessary reconnect (flap).

Recheck watcherCtx.Err() under conn.mu so a superseded watcher exits without
touching the connection that replaced it.

* Remove verbose comments

* Fixup merge conflict leftovers

* Fixup context brought by onWGDisconnected
2026-07-14 10:21:59 +02:00
Riccardo Manfrin
5343402385 [client, relay] Increase early-message buffer cap to 10000 to avoid dropping relayed handshakes 2026-07-13 22:46:03 +02:00
Pascal Fischer
62703ca23e [management] add logs to ephemeral delete (#6747) v0.75.0-rc.6 2026-07-13 19:06:22 +02:00
Viktor Liu
cc64a93953 [client] Include system events in ToProtoFullStatus conversion (#6746) 2026-07-13 18:49:17 +02:00
Maycon Santos
831325d6e2 [management] require dashboard_features.agent_network when enabling agent_network_only (#6750)
Adds a settings constraint: enabling `agent_network_only` requires `dashboard_features.agent_network` to be `true` in the same account update. Without the Agent Network menu flag, a focused account that later turns the focused view off would lose access to the Agent Network menu entirely, so the two must be set together.

The check runs in `updateAccountRequestSettings` against the parsed request state: if the resulting settings have `agent_network_only == true` but `dashboard_features.agent_network` is not `true`, the update is rejected with `status.InvalidArgument` (HTTP 422) before anything is persisted.

The OpenAPI field descriptions for `agent_network_only` and `dashboard_features.agent_network` document the requirement. Only the descriptions changed — `required` and the schema `$ref` are untouched — and `types.gen.go` was regenerated from the spec (diff is the two comment lines).
2026-07-13 17:28:19 +02:00
Maycon Santos
8f64173574 [client] Enable launch-on-login by default on fresh GUI installs (#6738)
* [client] Add autostart preference marker and MDM disableAutostart key

Adds the autostartInitialized marker to the Wails UI preferences store so
the one-time autostart default decision can persist per OS user, and a
UI-only disableAutostart MDM policy key that suppresses the default and
flows into GetConfigResponse.mDMManagedFields like disableAutoConnect.

* [client] Enable launch-on-login by default on fresh GUI installs

On the first interactive run the GUI persists the autostartInitialized
marker before any enable attempt, then enables autostart only when the
platform supports it, MDM policy does not disable it, the process was not
relaunched by an installer/updater (--post-update), and the installer's
fresh-install breadcrumb is present. Upgrading users have no breadcrumb,
so an update can never write login items, and a user's disable in
Settings is never overridden.

* [release] Write fresh-install breadcrumb from installers

Installers write a .fresh-install breadcrumb on fresh installs only and
delete stale breadcrumbs on upgrade; none of them writes login items or
registry Run keys. Windows NSIS detects upgrades via the uninstall
registry entry or an existing installed executable; the macOS pkg via the
previous pkgutil receipt; Linux deb/rpm via the standard postinstall
arguments. Post-update GUI relaunches (macOS open, Linux
ui-post-install.sh) pass --post-update so the first-run autostart default
cannot fire on updates.

* Revert installer breadcrumb changes

The real Windows installer does uninstall-then-install and deletes
$INSTDIR, so a breadcrumb written there cannot survive or discriminate
a fresh install from an upgrade. Restore the three installer files to
their main versions; no installer or updater writes an autostart entry.

* Detect fresh install from NetBird footprint instead of installer breadcrumb

Replace the installer-written breadcrumb discriminator with a GUI-side
check. netbirdFootprintExists inspects the daemon config/state files
(default.json, legacy config.json, state.json) under profilemanager's
default config dir; combined with whether the UI preferences file already
existed, this tells a genuinely fresh machine from an existing or
upgrading user. Only the signed GUI, via Wails, ever enables
launch-on-login, and a user's later manual disable is never overridden.
The preferences store now exposes ExistedAtLoad and the --post-update
flag is dropped.

* Update tests for footprint-based autostart default

Table tests for shouldEnableAutostartDefault now cover supported,
mdmDisabled, and priorInstall guards plus precedence; breadcrumb and
post-update cases are removed. Add a store test asserting ExistedAtLoad
is false with no file and true after persisting and reopening.
2026-07-13 13:39:57 +02:00
Maycon Santos
76877e83c4 [client] Bring the connection up in Go after SSO login (#6744)
* [client] Bring the connection up in Go after SSO login

The post-login Up ran as a frontend promise continuation after WaitSSOLogin
resolved. During SSO the tray window is hidden and the webview is suspended
(macOS App Nap / hidden-window timer throttling), so that continuation didn't
run until the user woke the window (e.g. hovering the tray icon), leaving the
client not connected for a long time. Combine WaitSSOLogin and Up in a single
Go method so the daemon connects the moment SSO completes, independent of
webview state. The frontend no longer issues a separate Up on the SSO path.

* [client] unexport waitSSOLogin and move below exported methods
2026-07-13 13:32:47 +02:00
Maycon Santos
ecd398d895 [management] Add dashboard_features account setting (#6742)
Introduce a nullable dashboard_features object on account settings, serialized
to a single JSON column so new dashboard sections can be added without schema
changes. Starts with agent_network (show the Agent Network menu for an account
without the deployment flag). Wires the API handler mapping, the pgx GetAccount
loader, and adds store round-trip and handler tests.
2026-07-12 21:16:37 +02:00
Maycon Santos
aa92ad3fb1 [management] Add agent_network_only account setting (#6736)
* [management] Add agent_network_only account setting

* [management] Load agent_network_only in pgx account loader and cover persistence
2026-07-12 14:46:08 +02:00
Sufiyan Khan
fd94fdb42b [management] fix duplicate operationId in OpenAPI spec (#6734) 2026-07-12 14:15:55 +02:00
Maycon Santos
30d15ecc3d [client,management] sync 0.74.4 changes (#6727)
* [management] fix: prevent reverse proxy domain from being pushed as DNS search domain by @blaugrau90 in https://github.com/netbirdio/netbird/pull/6498
* [client] Recover from rosenpass key desync by @lixmal in https://github.com/netbirdio/netbird/pull/6714
* [client] Bump golang.org/x/crypto to v0.54.0 by @lixmal in https://github.com/netbirdio/netbird/pull/6709
* [client] fix MDM managementURL conflict on default-port URL echo by @riccardomanfrin in https://github.com/netbirdio/netbird/pull/6672
* [client] Update gopsutil to v4 by @mlsmaycon in https://github.com/netbirdio/netbird/pull/6688
* [client] Fix hanging status command during relay dial by @theodorsm in https://github.com/netbirdio/netbird/pull/6694

---------

Co-authored-by: Theodor Midtlien <theodor@midtlien.com>
Co-authored-by: blaugrau90 <61945343+blaugrau90@users.noreply.github.com>
Co-authored-by: Viktor Liu <17948409+lixmal@users.noreply.github.com>
2026-07-11 11:03:55 +02:00
Dmitri Dolguikh
d5178416af fix tests around encoding of minimal NetworkMapComponents
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-11 00:31:33 +02:00
Dmitri Dolguikh
0cb27ac4ad include the target peer in the minimal NetworkMapEnvelope's Peers field
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-11 00:03:12 +02:00
Dmitri Dolguikh
6ea97a8d6b support ComponentSyncResponse in affected peers sync path
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-10 21:21:55 +02:00
Dmitri Dolguikh
315ac71e64 use version helper
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-10 20:32:39 +02:00
Dmitri Dolguikh
6830777d65 updated comments in management.proto
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-10 20:26:54 +02:00
Dmitri Dolguikh
ff33942c52 do not instantiate cache to benchmark ToProtocolDNSConfig() without cache
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-10 20:17:16 +02:00
Dmitri Dolguikh
9383b6b0f5 fix field tag
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-10 20:12:48 +02:00
Dmitri Dolguikh
aff723e3bb add migrations for public_id column
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-10 19:23:14 +02:00
Dmitri Dolguikh
4aa486fde8 handle nil components consistently
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-10 17:12:51 +02:00
Maycon Santos
8e02154bf5 [client] Add SSO login flow timing instrumentation (#6717)
Users reported long delays between finishing browser authentication and
the client connecting. Logs could not attribute the time: the PKCE and
device flows were silent between issuing the auth URL and returning the
token, and nothing recorded when the GUI issued the Up request after
WaitSSOLogin completed.

Add log lines covering the full chain: PKCE callback arrival and token
exchange duration, device-flow polling and approval timing, GUI-side
brackets around WaitSSOLogin and Up, daemon-side Up arrival and
WaitSSOLogin return, and a frontend stall detector that reports when
webview timers were suspended (macOS App Nap / hidden-window
throttling), which delays the WaitSSOLogin-to-Up handoff.
2026-07-10 16:11:27 +02:00
Dmitri Dolguikh
8803a58f12 inject agent network services when injecting proxy policies
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-10 15:46:33 +02:00
Dmitri Dolguikh
42c0cb5398 sort lookup inconsistencies when processing routes when computing components
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-10 12:58:49 +02:00
Dmitri Dolguikh
384b057f07 use return from GetValidatedPeerWithComponents when computing ComponentSyncResponse to prevent config drift
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-10 10:59:30 +02:00
Dmitri Dolguikh
35e339b6a9 set session expiry in ToComponentSyncResponse(), same as ToSyncResponse() path
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-10 10:45:54 +02:00
Dmitri Dolguikh
fc40eb9231 fixed a flaky test
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-10 10:37:52 +02:00
Dmitri Dolguikh
5941b267d2 responding to coderabbit comments
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-09 18:40:33 +02:00
Dmitri Dolguikh
395bdf82b6 removed unused code
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-09 18:28:02 +02:00
dmitri-netbird
e0c25ba4ba [client] fix flaky test around event aggregation (#6710)
* fix flaky test around event aggregation: control time.Now() from the test

Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>

* actually use passed in func to generate time

Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>

---------

Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-09 18:17:28 +02:00
Dmitri Dolguikh
ee7806ba7d Merge remote-tracking branch 'origin/main' into components-impl-drop-indexes-use-xids
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-09 17:27:11 +02:00
Dmitri Dolguikh
db231fd6ca updated decoder
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-09 17:18:57 +02:00
Dmitri Dolguikh
7cae1b9dd1 replaced sequential IDs with xids (random, uuid-like)
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-09 16:15:58 +02:00
Pascal Fischer
2560c6bd6c [management] add traffic filters for source and dest id (#6697) 2026-07-09 14:37:31 +02:00
Viktor Liu
96ac15d292 [client] Fix js relay WebSocket close, raise RDP dial timeout, adjust WASM log levels (#6684) 2026-07-09 13:21:08 +02:00
Dmitri Dolguikh
5edc168ff1 use policy ids deduping policies during union
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-09 12:22:29 +02:00
Dmitri Dolguikh
9b9f396391 removed unused func
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-09 12:00:17 +02:00
Dmitri Dolguikh
7c83c090be fixed encoder tests
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-08 22:28:03 +02:00
Dmitri Dolguikh
7cde2c46e6 regenerated sql store mock
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-08 21:47:54 +02:00
Dmitri Dolguikh
a36a1a3c26 cleaned up wire representation of components
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
2026-07-08 21:29:14 +02:00
Misha Bragin
488bbcb22b [doc] Update Agent Network Readme (#6699) 2026-07-08 17:53:55 +02:00
Theodor Midtlien
b7bbb44286 [client] Merge v0.74.x branch (#6700)
* [client] Update gopsutil to v4 (#6688)
* [client] Fix hanging status command during relay dial (#6694)

---------

Co-authored-by: Maycon Santos <mlsmaycon@gmail.com>
2026-07-08 17:52:50 +02:00