-
Notifications
You must be signed in to change notification settings - Fork 727
Added a plugin for Netbird #4531
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
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
96a9151
Added a plugin for Netbird
Gauss23 47c7df7
Update net/netbird/Makefile
Gauss23 e835f44
Remove the post-install file, not needed
Gauss23 7e418a6
Update net/netbird/Makefile
Gauss23 9b7dfb9
Update net/netbird/src/etc/inc/plugins.inc.d/netbird.inc
Gauss23 f32085d
Fixed pkg-descr and plugin_comment
Gauss23 59e9a9d
Update netbird.inc
Gauss23 5e11bc3
Update InitialController.php
Gauss23 dd90d9a
Update 30-netbird
Gauss23 58a775e
Update InitialController.php
Gauss23 0e79750
Update ServiceController.php
Gauss23 a5bd82f
Update SettingsController.php
Gauss23 76ce49a
Update ConstatusController.php
Gauss23 204d9cf
Update IndexController.php
Gauss23 83328c8
Update Initial.php
Gauss23 b17c20f
Update Netbird.php
Gauss23 91b00cc
Update constatus.volt
Gauss23 423ab9e
Update index.volt
Gauss23 f87cb16
Apply suggestions from code review
Gauss23 c72cb48
Update Menu.xml
Gauss23 301e2de
Fixed copyright header
Gauss23 6aad26a
Update net/netbird/src/opnsense/mvc/app/models/OPNsense/netbird/Initi…
Gauss23 a8db2d9
Update 30-netbird
Gauss23 44e47ae
Update net/netbird/src/opnsense/service/templates/OPNsense/netbird/ne…
Gauss23 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
44 changes: 44 additions & 0 deletions
44
net/netbird/src/opnsense/mvc/app/controllers/OPNsense/netbird/Api/InitialController.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.