Commit Graph
3396 Commits
Author SHA1 Message Date
Theodor S. Midtlien cda3da5ed1 Fix tests for denial errors 2026-09-18 17:08:06 +02:00
Theodor S. Midtlien 1a74019161 Fix status before up 2026-09-18 14:52:25 +02:00
Theodor S. Midtlien 5d9e791626 Fix comments 2026-09-18 14:19:59 +02:00
Theodor S. Midtlien 3d6591b053 Fix status and up cli output 2026-09-18 13:17:21 +02:00
Theodor S. Midtlien 64c84df357 Remove race reload test 2026-09-18 12:22:57 +02:00
Theodor S. Midtlien 29be224cdf Cleaup profile parsing 2026-09-18 12:22:04 +02:00
Theodor S. Midtlien cb9d2ee3bb Small refactor of Authz 2026-09-18 11:28:16 +02:00
Theodor S. Midtlien 6dcb1374e9 Move profile resolution to the authz gate 2026-09-18 11:19:35 +02:00
Theodor S. Midtlien 96f9ea7428 Move active migration to OwnsProfile 2026-09-17 19:57:40 +02:00
Theodor Midtlien cec9ee6699 [Client] Surface readable Authz errors and add profile claim command (#7540)
* [client] Surface error messages for IPC authz in UI (#7553)
2026-09-17 14:36:56 +02:00
Theodor Midtlien 801557e21b Merge branch 'main' into profile-ownership 2026-09-17 14:33:58 +02:00
Theodor S. Midtlien 499b5a8cd0 Fix service test for windows 2026-09-17 13:21:05 +02:00
Bethuel Mmbaga f8c3e565f3 [management] Read X-Real-IP when extracting the peer connection IP (#7561) 2026-09-17 12:45:03 +03:00
Theodor Midtlien 90052cbefb [client] Profile ownership console user tofu (#7529)
* Add consoleuser and stamp default profile on known username in migration

* Refactor consoleuser to verify Id, fix seats on linux and default stamp

* Add default profile claim

* Add disable auto-claim of default profile and always fail close

* Add disable auto-claim flag to migration

* Adding timeout to console user on Linux and close library load on darwin

* Fixed failed close test

* Close both Dlopen for darwin

* Replace RegisterFunc with purego.Dlsym to avoid possible panic

* Fix freebsd tty enumeration

* Fix active profile migration logic and add test

* Log defaultClaimDisabled error once

* Guard against panicking console user lookup.

* Fix merge conflict

* Fix broken tests
2026-09-17 11:20:13 +02:00
Theodor Midtlienandcubic-dev-ai[bot] 52b16e7a5c [client] Profile ownership migration (#7508)
* Implement OwnsProfile on Server

* (WIP) List profiles based on ownership by Identity

* (WIP) Migrate active_profile

* Fix status and list profiles

* Add profile stamping as active migration

* Add one-shot migration

* Only default profile fail open

* Use restricted write for config json

* Fix stale server config after stamp

* Fix OwnsProfile fallback to active profile

* Fix config concurrent reload during OwnsProfile check

* Move known check to inside stamp owner

* Update client/internal/profilemanager/service.go

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>

* Recover from dup active profiles that cannot be resolved with username.

* Add test for already owned profile during migration

* Improve stamping of fields in the config

* Apply suggestion from @cubic-dev-ai[bot]

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>

* Fix codespell and test comment

---------

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2026-09-17 11:20:12 +02:00
Misha Bragin 85a3913331 [client] Fix - Add RPM metadata required for Red Hat software certification (#7562)
Declare the runtime dependencies, generate the changelog from git tags with
chglog at release time, and ship LICENSE, README.md and an example
/etc/sysconfig/netbird as %license, %doc and %config(noreplace). The unit
generated by "netbird service install" already reads that path via
EnvironmentFile, so post_install.sh is unchanged.
2026-09-17 09:24:55 +02:00
Viktor Liu 15ed6f8f15 Add an optional --allow-group flag restricting the daemon sockets (#7478) 2026-09-16 13:30:10 +02:00
Theodor Midtlienandcubic-dev-ai[bot] abb94ad2d2 Update client/internal/debug/debug.go
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 258a20c433 Fix empty active state read 2026-09-16 10:37:59 +02:00
Theodor Midtlienandcubic-dev-ai[bot] fa3689c079 Update client/internal/debug/debug.go
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 331c490326 Fix typo 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 2d5ee900d0 Replace RequireFlowInitiator with AuthzLevel and clear flow on switch profile 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 7705645492 Remove double error log 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 1538d5f11c Add profile owners to debug bundle 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 5f7d869426 Fix status and list profiles 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 45e8bd8af4 Let unimplemented RequireFlowInitiator pass 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien b620173f51 Clarify the Rule comment 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien a585626950 Remove Authorization context and fix bugs in rule and targetProfile 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien fc93bfc561 Add method interceptor tests to ensure that authz is configured for every RPC 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien bbf28a40ed Add authorization framework for gRPC methods 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien cacdb50c0e Add known mark to identity, fix credentials comparison bugs 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 15003fc495 Add owners to list profile ipc 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien a9fb48d80b Let active profile owner be the source of truth for the session holder 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 3a2f6df038 Fix debug test 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 04c00a9a19 Improve owner config parsing 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien abc77e6d92 Use list of owners 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 3ee80d99bf Fix wasm build 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 723deda478 Add nolint for unused functions 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 45b30ef83d Fix ServiceManager.AddProfile signature 2026-09-16 10:37:58 +02:00
Theodor S. Midtlien 77cfc4ac4c Refactor gatePolicy to gateRule 2026-09-16 10:37:32 +02:00
Theodor S. Midtlien 126f3a640b Use sessionholder pointer 2026-09-16 10:37:32 +02:00
Theodor S. Midtlien 6a983eee34 Add WIP profile ownership 2026-09-16 10:37:31 +02:00
Theodor S. Midtlien f4f47db14c WIP: add session ownership 2026-09-16 10:36:43 +02:00
Maycon Santos eab510178a [misc] Load AGENTS.md every session and refuse attribution trailers (#7544)
AGENTS.md forbids attribution trailers, but a rule an agent has to go and read loses to the instruction it is handed every turn. CLAUDE.md now imports AGENTS.md so it is always in context; a commit-msg hook (via make setup-hooks) refuses the trailers at commit time; a CodeRabbit pre-merge check flags a PR whose description or commits carry them. The check reports rather than blocks, since the repository keeps CodeRabbit's request-changes workflow off; turning that on is a separate, repository-wide decision.
2026-09-15 22:48:49 +02:00
Riccardo Manfrin 08699a9e29 [client] Enforce HTTPS on install script downloads (#7545)
Every curl invocation in the install script that follows redirects now passes
`--proto` and `--proto-redir` set to https only, so neither the initial request
nor any hop in the redirect chain can drop to plaintext. This matters most for
the macOS .pkg download, whose URL is itself the result of a redirect
resolution, and for the release tarballs that get moved into the install dir as
root.

The protocol set lives in a single `PROTO_HTTPS` variable rather than being
repeated at each call site, and every expansion is quoted — the variable holds
one option value, not a list of flags.

The two call sites without `-L` (the release metadata lookups) are left alone:
they do not follow redirects and their URLs are https literals.

Verified against every URL the script fetches on curl 7.29.0 (CentOS 7),
7.68.0, 7.76.1, 7.88.1 and 8.14.1; both options have existed since curl 7.20.0.
Plaintext http:// is refused on all of them.
2026-09-15 14:20:15 +02:00
Zoltan Papp e70ec07320 Read the session deadline under the status read lock (#7550)
GetSessionExpiresAt took the exclusive lock for a plain field read, so
every caller queued behind writers and behind each other. The Android
SessionMonitor polls it from the main thread, and in the captured ANR
that is exactly where the main thread was blocked while hundreds of
peer-list callbacks held or waited on the same mutex.

d.mux is already an RWMutex and the other getters use RLock; this brings
the deadline read in line with them.
2026-09-15 12:05:57 +02:00
Riccardo Manfrin 58b5263c1a [client] Stage install script downloads in a private temp directory (#7534)
The install script downloaded both the macOS .pkg and the release tarballs
into /tmp under fixed, predictable names, then passed those same paths to the
privileged install steps (`installer -pkg`, `mv` into the install dir).

/tmp is shared, so those fixed names can collide with entries created there
beforehand, and the privileged steps consume whatever the path resolves to.

Stage every download in a directory from `mktemp -d` instead: unpredictable
name, mode 0700, owned by the caller, created atomically. Extraction now
targets that directory (`tar -C`, `unzip -d`) rather than relying on `cd /tmp`,
and an EXIT trap removes it, so a failed run no longer leaves the archive and
the unpacked LICENSE/README behind in /tmp either.
2026-09-15 10:30:33 +02:00
Maycon Santos f29249e7ef [management] Point the agent-config e2e providers at the mock upstream (#7542)
TestAgentConfigAllowlistOfDeclaredModels still pointed its providers at api.openai.com and bedrock-runtime with a dummy key, so every save has been refused with "the provider rejected the credential" and the Agent Network E2E has been red on main since — both subtests, every scheduled run.

Every other suite already uses the mock vLLM upstream (harness.StartVLLM), which answers both the OpenAI (/v1/models) and the Bedrock (/inference-profiles) listing; this test does the same. What it checks — the allowlist advertising the provider's declared ids on GET /api/agent-network/agent-config — never depended on the vendor.
2026-09-15 09:40:52 +02:00
Maycon Santos 7ce6a63dcb [management] Validate the proxy cluster an agent network bootstraps onto (#7402)
The agent network gateway service is private: agents reach it over the WireGuard tunnel, authorised by peer identity, with the cluster as its only target. Only a reverse proxy cluster with private capabilities can serve that, reported per cluster as the `private` capability — the same `supports_private` flag the dashboard gates NetBird-only services on.

A bootstrap could pin an account to a cluster without private capabilities, leaving an immutable dead gateway. Both bootstrap paths now validate the picked cluster: one the account can see must have a connected proxy reporting the capability. Shared and account-owned clusters qualify alike. Known-ness comes from proxy rows, not heartbeat freshness, so a cluster without the capability stays refused while merely offline. A hostname no proxy has declared stays pinnable (address-first). Identity is compared case-insensitively over the account's cluster list.
2026-09-15 08:42:21 +02:00
Maycon Santos ea294e1d46 [management] Refuse to pin an agent network gateway onto another account's host (#7519)
An agent network bootstrap stores its cluster as proxy_address, which selects the proxy that serves the endpoint. An account-scoped proxy only receives its own account's mappings, so a pin onto a host another account's proxy declares can never be served, and the endpoint is immutable — a dead gateway until the account deletes its settings. Nothing refused that pin; the domain unique index only arbitrates between endpoints.

Both bootstrap paths now refuse, before the insert, a host that another account's proxy declares, a host another account has labeled pins beneath (self-addressed path), or a hostname that is another account's endpoint (labeled path).

Shared clusters are unaffected: shared proxies are never foreign, and labeled pins under one cluster are never asked about, so any number of accounts still pin beneath eu.proxy.netbird.io. Registration is deliberately unchanged — refusing a proxy for another account's pin would let a pin lock a tenant out after the reaper drops its rows.
2026-09-14 22:20:25 +02:00