Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
9 changes: 9 additions & 0 deletions net/netbird/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
PLUGIN_NAME= netbird
PLUGIN_VERSION= 0.1
PLUGIN_DEPENDS= netbird
PLUGIN_COMMENT= Peer-to-peer VPN that seamlessly connects your devices
PLUGIN_MAINTAINER= [email protected]
PLUGIN_WWW= https://netbird.io
PLUGIN_DEVEL= yes

.include "../../Mk/plugins.mk"
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 WireGuard-based overlay network combined with
Zero Trust Network Access, providing secure and reliable connectivity
to internal resources.

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
57 changes: 57 additions & 0 deletions net/netbird/src/etc/inc/plugins.inc.d/netbird.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

/*
* Copyright (C) 2025 Ralph Moser, PJ Monitoring GmbH
* Copyright (C) 2025 squared GmbH
* Copyright (C) 2025 Christopher Linn, BackendMedia IT-Services GmbH
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

function netbird_enabled()
{
return !(new \OPNsense\netbird\Netbird())->general->Enabled->isEmpty();
}

function netbird_services()
{
$services = array();

if (!netbird_enabled()) {
return $services;
}

$services[] = array(
'description' => gettext('Netbird'),
'configd' => array(
'restart' => array('netbird restart'),
'start' => array('netbird start'),
'stop' => array('netbird stop'),
),
'name' => 'netbird',
'pidfile' => '/var/run/netbird.pid',
);

return $services;
}

78 changes: 78 additions & 0 deletions net/netbird/src/etc/rc.syshook.d/carp/30-netbird
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/usr/local/bin/php
<?php

/*
* Copyright (C) 2004 Scott Ullrich <[email protected]>
* Copyright (C) 2025 Ralph Moser, PJ Monitoring GmbH
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

require_once('config.inc');
require_once('util.inc');
require_once('interfaces.inc');


$model = new \OPNsense\netbird\Netbird();
$enabled = $model->general->Enabled->__toString();


if(!$enabled) {
exit(0);
}

$carpif = $model->general->CarpIf->__toString();

if($carpif == '') {
exit(0);
}

$target_vhid = $model->general->VHID;
$subsystem = !empty($argv[1]) ? $argv[1] : '';
$type = !empty($argv[2]) ? $argv[2] : '';

if ($type != 'MASTER' && $type != 'BACKUP') {
exit(1);
}

if (!strstr($subsystem, '@')) {
exit(1);
}

list ($vhid, $iface) = explode('@', $subsystem);
$friendly = convert_real_interface_to_friendly_interface_name($iface);


if ($carpif != $friendly || $vhid != $target_vhid) {
exit(0);
}

switch ($type) {
case 'MASTER':
shell_exec('/usr/local/bin/netbird up');
break;
case 'BACKUP':
shell_exec('/usr/local/bin/netbird down');
break;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

/*
* Copyright (C) 2025 Ralph Moser, PJ Monitoring GmbH
* Copyright (C) 2025 squared GmbH
* Copyright (C) 2025 Christopher Linn, BackendMedia IT-Services GmbH
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

namespace OPNsense\netbird\Api;

use OPNsense\Base\ApiMutableModelControllerBase;

/**
* netbird settings controller
* @package OPNsense\netbird
*/
class InitialController extends ApiMutableModelControllerBase
{
protected static $internalModelName = 'netbird';
protected static $internalModelClass = 'OPNsense\netbird\Initial';

}
Loading