Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Netbird port for OPNsense #218

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions net/netbird/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
PORTNAME= netbird
DISTVERSIONPREFIX= v
DISTVERSION= 0.36.5
CATEGORIES= net security net-vpn

MAINTAINER= [email protected]
COMMENT= Mesh VPN
WWW= https://netbird.io/

LICENSE= BSD3CLAUSE
LICENSE_FILE= ${WRKSRC}/LICENSE

USES= go:1.23,modules
WRKSRC= ${WRKDIR}/netbird-${PORTVERSION}

GO_MODULE= github.com/netbirdio/netbird

USE_RC_SUBR= netbird

GO_TARGET= ./client:netbird
GO_BUILDFLAGS= -tags freebsd -o ${PORTNAME} -ldflags "\
-s -w -X github.com/netbirdio/netbird/version.version=${PORTVERSION}"

PLIST_FILES= bin/netbird

.include <bsd.port.mk>
5 changes: 5 additions & 0 deletions net/netbird/distinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
TIMESTAMP = 1738694930
SHA256 (go/net_netbird/netbird-v0.36.5/v0.36.5.mod) = 38b5ac547788f793c20e3048c172c3c39be580b34934d6e835cd0e3a57ed432d
SIZE (go/net_netbird/netbird-v0.36.5/v0.36.5.mod) = 12035
SHA256 (go/net_netbird/netbird-v0.36.5/v0.36.5.zip) = 435127808dd41a80609ec1923090e34bc757f9ff94111aa5985145ef99bf16e2
SIZE (go/net_netbird/netbird-v0.36.5/v0.36.5.zip) = 2465547
41 changes: 41 additions & 0 deletions net/netbird/files/netbird.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/sh

# PROVIDE: netbird
# REQUIRE: FILESYSTEMS devfs
# BEFORE: pf ipfw
# KEYWORD: shutdown

. /etc/rc.subr

name="netbird"
rcvar=netbird_enable
load_rc_config $name
desc="netbird mesh vpn"
pidfile="/var/run/${name}.pid"
netbird_tun_dev="wt0"
procname="/usr/local/bin/netbird"
start_cmd="${name}_start"
stop_postcmd="${name}_poststop"

netbird_start()
{
logger -s -t netbird "Starting ${name}."
# Check for orphaned netbird network interface
# And if it exists, then destroy it
/sbin/ifconfig ${netbird_tun_dev} >/dev/null 2>&1 && (
/sbin/ifconfig ${netbird_tun_dev} | fgrep -qw PID ||
/sbin/ifconfig ${netbird_tun_dev} destroy
)

/usr/sbin/daemon -p ${pidfile} -f -t ${name} /usr/local/bin/netbird service run --config /usr/local/etc/netbird/config.json --log-level info --log-file syslog
}

netbird_poststop()
{
/sbin/ifconfig ${netbird_tun_dev} >/dev/null 2>&1 && (
logger -s -t netbird "Destroying ${netbird_tun_dev} adapter"
/sbin/ifconfig ${netbird_tun_dev} destroy || logger -s -t netbird "Failed to destroy ${netbird_tun_dev} adapter"
)
}

run_rc_command "$1"
15 changes: 15 additions & 0 deletions net/netbird/files/patch-client_system_info__freebsd.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--- client/system/info_freebsd.go.orig 1979-11-30 00:00:00 UTC
+++ client/system/info_freebsd.go
@@ -39,10 +39,10 @@ func GetInfo(ctx context.Context) *Info {
systemHostname, _ := os.Hostname()

return &Info{
- GoOS: runtime.GOOS,
+ GoOS: "linux",
Kernel: osInfo[0],
Platform: runtime.GOARCH,
- OS: osName,
+ OS: strings.Replace(osName, "FreeBSD", "FakeBSD", -1),
OSVersion: osVersion,
Hostname: extractDeviceName(ctx, systemHostname),
CPUs: runtime.NumCPU(),
18 changes: 18 additions & 0 deletions net/netbird/pkg-descr
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Netbird is an open-source, peer-to-peer VPN built on top of WireGuard.
It enables secure and private networking between devices across different
locations without the need for complex configurations.

Key features:
- Zero-config VPN: Easily create secure connections between devices without
manual network setup.
- Built on WireGuard: Leverages WireGuard?s high-performance encryption for
fast and secure communication.
- Self-hosted or Cloud-managed: Users can deploy their own Netbird management
server or use Netbird Cloud for centralized control.
- Access Control & Routing: Fine-grained access control policies and automatic
network routing simplify connectivity.
- This FreeBSD port provides the Netbird client daemon and CLI tools, allowing
FreeBSD systems to join a Netbird mesh network and securely communicate with
other peers.

For more details, visit: https://netbird.io