Connect your devices into a single secure private WireGuard®-based mesh network with SSO/MFA and simple access controls.
Go to file
Bethuel Mmbaga 7bda385e1b
[management] Optimize network map updates (#2718)
* Skip peer update on unchanged network map (#2236)

* Enhance network updates by skipping unchanged messages

Optimizes the network update process
by skipping updates where no changes in the peer update message received.

* Add unit tests

* add locks

* Improve concurrency and update peer message handling

* Refactor account manager network update tests

* fix test

* Fix inverted network map update condition

* Add default group and policy to test data

* Run peer updates in a separate goroutine

* Refactor

* Refactor lock

* Fix peers update by including NetworkMap and posture Checks

* go mod tidy

* fix merge

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* fix merge

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* [management] Skip account peers update if no changes affect peers (#2310)

* Remove incrementing network serial and updating peers after group deletion

* Update account peer if posture check is linked to policy

* Remove account peers update on saving setup key

* Refactor group link checking into re-usable functions

* Add HasPeers function to group

* Refactor group management

* Optimize group change effects on account peers

* Update account peers if ns group has peers

* Refactor group changes

* Optimize account peers update in DNS settings

* Optimize update of account peers on jwt groups sync

* Refactor peer account updates for efficiency

* Optimize peer update on user deletion and changes

* Remove condition check for network serial update

* Optimize account peers updates on route changes

* Remove UpdatePeerSSHKey method

* Remove unused isPolicyRuleGroupsEmpty

* Add tests for peer update behavior on posture check changes

* Add tests for peer update behavior on policy changes

* Add tests for peer update behavior on group changes

* Add tests for peer update behavior on dns settings changes

* Refactor

* Add tests for peer update behavior on name server changes

* Add tests for peer update behavior on user changes

* Add tests for peer update behavior on route changes

* fix tests

* Add tests for peer update behavior on setup key changes

* Add tests for peer update behavior on peers changes

* fix merge

* Fix tests

* go mod tidy

* Add NameServer and Route comparators

* Update network map diff logic with custom comparators

* Add tests

* Refactor duplicate diff handling logic

* fix linter

* fix tests

* Refactor policy group handling and update logic.

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* Update route check by checking if group has peers

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* Refactor posture check policy linking logic

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* Simplify peer update condition in DNS management

Refactor the condition for updating account peers to remove redundant checks

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* fix tests

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* fix merge

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* add policy tests

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* add posture checks tests

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* fix user and setup key tests

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* fix account and route tests

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* fix typo

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* fix nameserver tests

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* fix routes tests

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* fix group tests

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* upgrade diff package

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* fix nameserver tests

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* use generic differ for netip.Addr and netip.Prefix

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* go mod tidy

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* add peer tests

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* fix merge

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* fix management suite tests

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* fix postgres tests

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* enable diff nil structs comparison

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* skip the update only last sent the serial is larger

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* refactor peer and user

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* skip spell check for groupD

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* Refactor group, ns group, policy and posture checks

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* skip spell check for GroupD

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* update account policy check before verifying policy status

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* Update management/server/route_test.go

Co-authored-by: Maycon Santos <mlsmaycon@gmail.com>

* Update management/server/route_test.go

Co-authored-by: Maycon Santos <mlsmaycon@gmail.com>

* Update management/server/route_test.go

Co-authored-by: Maycon Santos <mlsmaycon@gmail.com>

* Update management/server/route_test.go

Co-authored-by: Maycon Santos <mlsmaycon@gmail.com>

* Update management/server/route_test.go

Co-authored-by: Maycon Santos <mlsmaycon@gmail.com>

* add tests missing tests for dns setting groups

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* add tests for posture checks changes

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* add ns group and policy tests

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* add route and group tests

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* increase Linux test timeout to 10 minutes

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* Run diff for client posture checks only

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* add panic recovery and detailed logging in peer update comparison

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* Fix tests

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

---------

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
Co-authored-by: Maycon Santos <mlsmaycon@gmail.com>

---------

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
Co-authored-by: Maycon Santos <mlsmaycon@gmail.com>
2024-10-23 13:05:02 +03:00
.devcontainer Update contribution and readme file (#1447) 2024-01-08 15:41:22 +01:00
.github [management] Optimize network map updates (#2718) 2024-10-23 13:05:02 +03:00
base62 Update GitHub Actions and Enhance golangci-lint (#1075) 2023-09-04 17:03:44 +02:00
client [client] Eliminate UDP proxy in user-space mode (#2712) 2024-10-22 20:53:14 +02:00
dns Prepare regexps on compile time (#1327) 2023-11-27 13:01:00 +01:00
docs/media Update README.md (#524) 2022-10-22 16:19:16 +02:00
encryption [relay] Feature/relay integration (#2244) 2024-09-08 12:06:14 +02:00
formatter Fix syslog output containing duplicated timestamps (#2292) 2024-08-01 18:22:02 +02:00
infrastructure_files Update Zitadel version on quickstart script (#2744) 2024-10-16 17:51:21 +02:00
management [management] Optimize network map updates (#2718) 2024-10-23 13:05:02 +03:00
relay [relay-server] Move the handshake logic to separated struct (#2648) 2024-10-12 18:21:34 +02:00
release_files Fix decompress zip path (#2755) 2024-10-17 20:39:59 +02:00
route [management, client] Add access control support to network routes (#2100) 2024-10-02 13:41:00 +02:00
sharedsock Fix lint (#2427) 2024-08-14 13:30:10 +03:00
signal [signal] new signal dispatcher version (#2722) 2024-10-10 16:23:46 +02:00
util Replace suite tests with regular go tests (#2762) 2024-10-21 14:39:28 +02:00
version Release 0.28.0 (#2092) 2024-06-13 13:24:24 +02:00
.editorconfig Fix syslog output containing duplicated timestamps (#2292) 2024-08-01 18:22:02 +02:00
.gitattributes Run linter action on MacOS and Windows (#1198) 2023-10-07 21:45:46 +02:00
.gitignore [management] Auto update geolite (#2297) 2024-09-09 18:27:42 +02:00
.golangci.yaml Upgrade gRPC and OpenTelemetry packages for compatibility (#2003) 2024-05-27 08:39:18 +02:00
.goreleaser_ui_darwin.yaml [client] Add universal bin build and update sign workflow version (#2738) 2024-10-15 15:03:17 +02:00
.goreleaser_ui.yaml Specify goreleaser version and update to 2 (#2673) 2024-09-30 16:43:34 +02:00
.goreleaser.yaml [client] Add universal bin build and update sign workflow version (#2738) 2024-10-15 15:03:17 +02:00
AUTHORS chore: update license and AUTHORS 2022-01-19 16:22:40 +01:00
CODE_OF_CONDUCT.md Update CODE_OF_CONDUCT.md (#2048) 2024-05-24 17:29:14 +02:00
CONTRIBUTING.md Specify goreleaser version and update to 2 (#2673) 2024-09-30 16:43:34 +02:00
CONTRIBUTOR_LICENSE_AGREEMENT.md Add contribution guide (#595) 2022-12-02 13:31:31 +01:00
go.mod [management] Optimize network map updates (#2718) 2024-10-23 13:05:02 +03:00
go.sum [management] Optimize network map updates (#2718) 2024-10-23 13:05:02 +03:00
LICENSE chore: update license and AUTHORS 2022-01-19 16:22:40 +01:00
README.md Add Link to the Lawrence Systems video (#2711) 2024-10-09 14:56:25 +02:00
SECURITY.md Add security policy file (#600) 2022-12-02 13:54:22 +01:00
versioninfo.json Add release version to windows binaries and update sign pipeline version (#2256) 2024-07-11 19:06:55 +02:00

🐣 New Release! Device Posture Checks. Learn more


Start using NetBird at netbird.io
See Documentation
Join our Slack channel


NetBird combines a configuration-free peer-to-peer private network and a centralized access control system in a single platform, making it easy to create secure private networks for your organization or home.

Connect. NetBird creates a WireGuard-based overlay network that automatically connects your machines over an encrypted tunnel, leaving behind the hassle of opening ports, complex firewall rules, VPN gateways, and so forth.

Secure. NetBird enables secure remote access by applying granular access policies while allowing you to manage them intuitively from a single place. Works universally on any infrastructure.

Open-Source Network Security in a Single Platform

netbird_2

NetBird on Lawrence Systems (Video)

Watch the video

Key features

Connectivity Management Security Automation Platforms
  • - [x] Kernel WireGuard
  • - [x] Linux
  • - [x] Peer-to-peer connections
  • - [x] Auto peer discovery and configuration
  • - [x] Mac
  • - [x] Connection relay fallback
  • - [x] Windows
  • - [x] IdP groups sync with JWT
  • - [x] Android
  • - [x] NAT traversal with BPF
  • - [x] Peer-to-peer encryption
  • - [x] iOS
  • - [x] OpenWRT
  • - [x] Periodic re-authentication
    • - [x] Docker

    Quickstart with NetBird Cloud

    Quickstart with self-hosted NetBird

    This is the quickest way to try self-hosted NetBird. It should take around 5 minutes to get started if you already have a public domain and a VM. Follow the Advanced guide with a custom identity provider for installations with different IDPs.

    Infrastructure requirements:

    • A Linux VM with at least 1CPU and 2GB of memory.
    • The VM should be publicly accessible on TCP ports 80 and 443 and UDP ports: 3478, 49152-65535.
    • Public domain name pointing to the VM.

    Software requirements:

    • Docker installed on the VM with the docker-compose plugin (Docker installation guide) or docker with docker-compose in version 2 or higher.
    • jq installed. In most distributions Usually available in the official repositories and can be installed with sudo apt install jq or sudo yum install jq
    • curl installed. Usually available in the official repositories and can be installed with sudo apt install curl or sudo yum install curl

    Steps

    • Download and run the installation script:
    export NETBIRD_DOMAIN=netbird.example.com; curl -fsSL https://github.com/netbirdio/netbird/releases/latest/download/getting-started-with-zitadel.sh | bash
    
    • Once finished, you can manage the resources via docker-compose

    A bit on NetBird internals

    • Every machine in the network runs NetBird Agent (or Client) that manages WireGuard.
    • Every agent connects to Management Service that holds network state, manages peer IPs, and distributes network updates to agents (peers).
    • NetBird agent uses WebRTC ICE implemented in pion/ice library to discover connection candidates when establishing a peer-to-peer connection between machines.
    • Connection candidates are discovered with the help of STUN servers.
    • Agents negotiate a connection through Signal Service passing p2p encrypted messages with candidates.
    • Sometimes the NAT traversal is unsuccessful due to strict NATs (e.g. mobile carrier-grade NAT) and a p2p connection isn't possible. When this occurs the system falls back to a relay server called TURN, and a secure WireGuard tunnel is established via the TURN server.

    Coturn is the one that has been successfully used for STUN and TURN in NetBird setups.

    See a complete architecture overview for details.

    Community projects

    Note: The main branch may be in an unstable or even broken state during development. For stable versions, see releases.

    Support acknowledgement

    In November 2022, NetBird joined the StartUpSecure program sponsored by The Federal Ministry of Education and Research of The Federal Republic of Germany. Together with CISPA Helmholtz Center for Information Security NetBird brings the security best practices and simplicity to private networking.

    CISPA_Logo_BLACK_EN_RZ_RGB (1)

    Testimonials

    We use open-source technologies like WireGuard®, Pion ICE (WebRTC), Coturn, and Rosenpass. We very much appreciate the work these guys are doing and we'd greatly appreciate if you could support them in any way (e.g., by giving a star or a contribution).

    WireGuard and the WireGuard logo are registered trademarks of Jason A. Donenfeld.