add tailscale plugin (#4386)

This commit is contained in:
Sam Sheridan
2024-12-06 16:48:34 +01:00
committed by GitHub
parent dbe996b053
commit cadc03aebd
27 changed files with 1007 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
PLUGIN_NAME= tailscale
PLUGIN_VERSION= 1.0.d
PLUGIN_DEVEL= yes
PLUGIN_COMMENT= Tailscale makes creating software-defined networks easy
PLUGIN_DEPENDS= tailscale
PLUGIN_MAINTAINER= sam@sheridan.co.uk
.include "../../Mk/plugins.mk"
+11
View File
@@ -0,0 +1,11 @@
Tailscale is a mesh VPN alternative, based on WireGuard, that connects your
computers, databases, and services together securely without any proxies.
https://tailscale.com/
Plugin Changelog
================
1.0
* initial development release
@@ -0,0 +1,65 @@
<?php
/*
* Copyright (C) 2024 Sheridan Computers
* 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 tailscale_enabled()
{
return !empty((string)(new \OPNsense\Tailscale\Settings())->enabled);
}
function tailscale_services()
{
$services = [];
if (!tailscale_enabled()) {
return $services;
}
$services[] = [
'description' => gettext('Tailscale'),
'pidfile' => '/var/run/tailscaled.pid',
'configd' => [
'restart' => ['tailscale restart'],
'start' => ['tailscale start'],
'stop' => ['tailscale stop'],
],
'name' => 'tailscale',
];
return $services;
}
function tailscale_devices()
{
return [[
'pattern' => '^tailscale0$',
'configurable' => false,
'spoofmac' => false,
'volatile' => true,
]];
}
@@ -0,0 +1,39 @@
<?php
/*
* Copyright (C) 2024 Sheridan Computers
* 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\Tailscale\Api;
use OPNsense\Base\ApiMutableModelControllerBase;
use OPNsense\Core\Backend;
class AuthenticationController extends ApiMutableModelControllerBase
{
protected static $internalModelName = 'authentication';
protected static $internalModelClass = '\OPNsense\Tailscale\Authentication';
}
@@ -0,0 +1,45 @@
<?php
/*
* Copyright (C) 2024 Sheridan Computers
* 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\Tailscale\Api;
use OPNsense\Base\ApiMutableServiceControllerBase;
use OPNsense\Core\Backend;
/**
* Class ServiceController
* @package OPNsense\Tailscale
*/
class ServiceController extends ApiMutableServiceControllerBase
{
protected static $internalServiceClass = '\OPNsense\Tailscale\Settings';
protected static $internalServiceEnabled = 'enabled';
protected static $internalServiceTemplate = 'OPNsense/Tailscale';
protected static $internalServiceName = 'tailscale';
}
@@ -0,0 +1,77 @@
<?php
/*
* Copyright (C) 2024 Sheridan Computers
* 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\Tailscale\Api;
use OPNsense\Base\ApiMutableModelControllerBase;
use OPNsense\Core\Backend;
class SettingsController extends ApiMutableModelControllerBase
{
protected static $internalModelName = 'settings';
protected static $internalModelClass = '\OPNsense\Tailscale\Settings';
public function searchSubnetAction()
{
return $this->searchBase("subnets.subnet4", null, "subnet");
}
public function setSubnetAction($uuid)
{
return $this->setBase("subnet4", "subnets.subnet4", $uuid);
}
public function addSubnetAction()
{
return $this->addBase("subnet4", "subnets.subnet4");
}
public function getSubnetAction($uuid = null)
{
return $this->getBase("subnet4", "subnets.subnet4", $uuid);
}
public function delSubnetAction($uuid)
{
return $this->delBase("subnets.subnet4", $uuid);
}
public function reloadAction()
{
$mdl = $this->getModel();
$enabled = $mdl->enabled->__toString() === '1';
$response = $this->toggleTailScaleService($enabled);
return ['result ' => $response];
}
private function toggleTailscaleService($enabled)
{
$backend = new Backend();
$backend->configdRun('template reload OPNsense/Tailscale');
$action = $enabled ? 'start' : 'stop';
return trim($backend->configdRun('tailscale ' . $action));
}
}
@@ -0,0 +1,65 @@
<?php
/*
* Copyright (C) 2024 Sheridan Computers
* 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\Tailscale\Api;
use OPNsense\Base\ApiMutableModelControllerBase;
use OPNsense\Core\Backend;
class StatusController extends ApiMutableModelControllerBase
{
protected static $internalModelName = 'Tailscale';
protected static $internalModelClass = '\OPNsense\Tailscale\Status';
public function statusAction()
{
$response = json_decode(trim((new Backend())->configdRun('tailscale tailscale-status')), true);
if ($response !== null) {
return $response;
}
return ['error' => 'Unable to determine Tailscale status, is the service running?'];
}
public function ipAction()
{
$response = trim((new Backend())->configdRun('tailscale tailscale-ip'));
return ['result' => $response];
}
public function netAction()
{
$response = trim((new Backend())->configdRun('tailscale tailscale-netcheck'));
return ['result' => $response];
}
private function isJson($string) {
return is_string($string)
&& (is_object(json_decode($string))
|| is_array(json_decode($string)));
}
}
@@ -0,0 +1,38 @@
<?php
/**
* Copyright (C) 2024 Sheridan Computers
* 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\Tailscale;
class AuthenticationController extends \OPNsense\Base\IndexController
{
public function indexAction()
{
$this->view->pick('OPNsense/Tailscale/authentication');
$this->view->authenticationForm = $this->getForm('authentication');
}
}
@@ -0,0 +1,39 @@
<?php
/**
* Copyright (C) 2024 Sheridan Computers
* 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\Tailscale;
class SettingsController extends \OPNsense\Base\IndexController
{
public function indexAction()
{
$this->view->pick('OPNsense/Tailscale/settings');
$this->view->settingsForm = $this->getForm('settings');
$this->view->formDialogSubnet = $this->getForm("dialogSubnet4");
}
}
@@ -0,0 +1,37 @@
<?php
/**
* Copyright (C) 2024 Sheridan Computers
* 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\Tailscale;
class StatusController extends \OPNsense\Base\IndexController
{
public function indexAction()
{
$this->view->pick('OPNsense/Tailscale/status');
}
}
@@ -0,0 +1,14 @@
<form>
<field>
<id>authentication.loginServer</id>
<label>Login Server</label>
<type>text</type>
<help>Base URL of login (control) server.</help>
</field>
<field>
<id>authentication.preAuthKey</id>
<label>Pre-authentication Key</label>
<type>text</type>
<help>Use a non-reusable auth key and disable expiration</help>
</field>
</form>
@@ -0,0 +1,14 @@
<form>
<field>
<id>subnet4.subnet</id>
<label>Subnet</label>
<type>text</type>
<help>Subnet to use, should be large enough to hold the specified pools and reservations</help>
</field>
<field>
<id>subnet4.description</id>
<label>Description</label>
<type>text</type>
<help>You may enter a description here for your reference (not parsed).</help>
</field>
</form>
@@ -0,0 +1,32 @@
<form>
<field>
<id>settings.enabled</id>
<label>Enabled</label>
<type>checkbox</type>
<help>This will activate the Tailscale service.</help>
</field>
<field>
<id>settings.listenPort</id>
<label>Listen Port</label>
<type>text</type>
<help>UDP port to listen on for Wireguard and peer-to-peer traffic.</help>
</field>
<field>
<id>settings.acceptDNS</id>
<label>Accept DNS</label>
<type>checkbox</type>
<help>Accept DNS configuration from the control server.</help>
</field>
<field>
<id>settings.advertiseExitNode</id>
<label>Advertise Exit Node</label>
<type>checkbox</type>
<help>Offer to be an exit node for outbound internet traffic from the Tailscale network.</help>
</field>
<field>
<id>settings.acceptSubnetRoutes</id>
<label>Accept Subnet Routes</label>
<type>checkbox</type>
<help>Accept subnet routes that other nodes advertise.</help>
</field>
</form>
@@ -0,0 +1,9 @@
<acl>
<page-tailscale-config>
<name>Tailscale</name>
<patterns>
<pattern>ui/tailscale/*</pattern>
<pattern>api/tailscale/*</pattern>
</patterns>
</page-tailscale-config>
</acl>
@@ -0,0 +1,35 @@
<?php
/**
* Copyright (C) 2024 Sheridan Computers
* 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\Tailscale;
use OPNsense\Base\BaseModel;
class Authentication extends BaseModel
{
}
@@ -0,0 +1,14 @@
<model>
<mount>//OPNsense/tailscale/authentication</mount>
<description>Tailscale authentication settings</description>
<items>
<loginServer type="UrlField">
<default>https://controlplane.tailscale.com</default>
<Required>Y</Required>
<ValidationMessage>Please enter a valid URL</ValidationMessage>
</loginServer>
<preAuthKey type="TextField">
<Required>Y</Required>
</preAuthKey>
</items>
</model>
@@ -0,0 +1,9 @@
<menu>
<VPN>
<Tailscale cssClass="fa fa-lock fa-fw">
<Authentication order="1" url="/ui/tailscale/authentication"/>
<Settings order="2" url="/ui/tailscale/settings"/>
<Status order="3" url="/ui/tailscale/status"/>
</Tailscale>
</VPN>
</menu>
@@ -0,0 +1,35 @@
<?php
/**
* Copyright (C) 2024 Sheridan Computers
* 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\Tailscale;
use OPNsense\Base\BaseModel;
class Settings extends BaseModel
{
}
@@ -0,0 +1,37 @@
<model>
<mount>//OPNsense/tailscale/settings</mount>
<description>Tailscale general settings</description>
<items>
<enabled type="BooleanField">
<default>0</default>
<Required>Y</Required>
</enabled>
<listenPort type="PortField">
<default>41641</default>
<Required>Y</Required>
</listenPort>
<acceptDNS type="BooleanField">
<default>1</default>
<Required>Y</Required>
</acceptDNS>
<advertiseExitNode type="BooleanField">
<default>0</default>
<Required>Y</Required>
</advertiseExitNode>
<acceptSubnetRoutes type="BooleanField">
<default>0</default>
<Required>Y</Required>
</acceptSubnetRoutes>
<subnets>
<subnet4 type="ArrayField">
<subnet type="NetworkField">
<NetMaskRequired>Y</NetMaskRequired>
<AddressFamily>ipv4</AddressFamily>
<Strict>Y</Strict>
<Required>Y</Required>
</subnet>
<description type="DescriptionField"/>
</subnet4>
</subnets>
</items>
</model>
@@ -0,0 +1,35 @@
<?php
/**
* Copyright (C) 2024 Sheridan Computers
* 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\Tailscale;
use OPNsense\Base\BaseModel;
class Status extends BaseModel
{
}

Some files were not shown because too many files have changed in this diff Show More