mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-17 18:14:42 +00:00
unbound: integrade DoT grid; closes #5101
Extensive rewrite based on the original PR, but the models have been merged into one Unbound.xml and the migration will follow in the next commit.
This commit is contained in:
parent
f5264d9085
commit
d6d0971677
2
LICENSE
2
LICENSE
@ -35,7 +35,7 @@ Copyright (c) 2003-2006 Manuel Kasper <mk@neon1.net>
|
||||
Copyright (c) 2012 Marcello Coutinho
|
||||
Copyright (c) 2018 Martin Wasley <martin@team-rebellion.net>
|
||||
Copyright (c) 2010-2015 Michael Bostock
|
||||
Copyright (c) 2019 Michael Muenz <m.muenz@gmail.com>
|
||||
Copyright (c) 2019-2021 Michael Muenz <m.muenz@gmail.com>
|
||||
Copyright (c) 2019 Pascal Mathis <mail@pascalmathis.com>
|
||||
Copyright (c) 2005-2006 Paul Taylor <paultaylor@winn-dixie.com>
|
||||
Copyright (c) 2005-2006 Peter Allgeyer <allgeyer@web.de>
|
||||
|
||||
12
plist
12
plist
@ -370,12 +370,13 @@
|
||||
/usr/local/opnsense/mvc/app/controllers/OPNsense/TrafficShaper/forms/dialogQueue.xml
|
||||
/usr/local/opnsense/mvc/app/controllers/OPNsense/TrafficShaper/forms/dialogRule.xml
|
||||
/usr/local/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/DiagnosticsController.php
|
||||
/usr/local/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/DnsblController.php
|
||||
/usr/local/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/MiscellaneousController.php
|
||||
/usr/local/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/ServiceController.php
|
||||
/usr/local/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/SettingsController.php
|
||||
/usr/local/opnsense/mvc/app/controllers/OPNsense/Unbound/DnsblController.php
|
||||
/usr/local/opnsense/mvc/app/controllers/OPNsense/Unbound/DotController.php
|
||||
/usr/local/opnsense/mvc/app/controllers/OPNsense/Unbound/MiscellaneousController.php
|
||||
/usr/local/opnsense/mvc/app/controllers/OPNsense/Unbound/StatsController.php
|
||||
/usr/local/opnsense/mvc/app/controllers/OPNsense/Unbound/forms/dialogDot.xml
|
||||
/usr/local/opnsense/mvc/app/controllers/OPNsense/Unbound/forms/dnsbl.xml
|
||||
/usr/local/opnsense/mvc/app/controllers/OPNsense/Unbound/forms/miscellaneous.xml
|
||||
/usr/local/opnsense/mvc/app/library/Google/API/Drive.php
|
||||
@ -558,10 +559,8 @@
|
||||
/usr/local/opnsense/mvc/app/models/OPNsense/TrafficShaper/TrafficShaper.xml
|
||||
/usr/local/opnsense/mvc/app/models/OPNsense/Unbound/ACL/ACL.xml
|
||||
/usr/local/opnsense/mvc/app/models/OPNsense/Unbound/Menu/Menu.xml
|
||||
/usr/local/opnsense/mvc/app/models/OPNsense/Unboundplus/Dnsbl.php
|
||||
/usr/local/opnsense/mvc/app/models/OPNsense/Unboundplus/Dnsbl.xml
|
||||
/usr/local/opnsense/mvc/app/models/OPNsense/Unboundplus/Miscellaneous.php
|
||||
/usr/local/opnsense/mvc/app/models/OPNsense/Unboundplus/Miscellaneous.xml
|
||||
/usr/local/opnsense/mvc/app/models/OPNsense/Unbound/Unbound.php
|
||||
/usr/local/opnsense/mvc/app/models/OPNsense/Unbound/Unbound.xml
|
||||
/usr/local/opnsense/mvc/app/views/OPNsense/CaptivePortal/clients.volt
|
||||
/usr/local/opnsense/mvc/app/views/OPNsense/CaptivePortal/index.volt
|
||||
/usr/local/opnsense/mvc/app/views/OPNsense/CaptivePortal/vouchers.volt
|
||||
@ -601,6 +600,7 @@
|
||||
/usr/local/opnsense/mvc/app/views/OPNsense/TrafficShaper/index.volt
|
||||
/usr/local/opnsense/mvc/app/views/OPNsense/TrafficShaper/statistics.volt
|
||||
/usr/local/opnsense/mvc/app/views/OPNsense/Unbound/dnsbl.volt
|
||||
/usr/local/opnsense/mvc/app/views/OPNsense/Unbound/dot.volt
|
||||
/usr/local/opnsense/mvc/app/views/OPNsense/Unbound/miscellaneous.volt
|
||||
/usr/local/opnsense/mvc/app/views/OPNsense/Unbound/stats.volt
|
||||
/usr/local/opnsense/mvc/app/views/layout_partials/base_dialog.volt
|
||||
|
||||
@ -49,6 +49,9 @@ class LogController extends IndexController
|
||||
case 'ipsec':
|
||||
$this->view->service = 'ipsec';
|
||||
break;
|
||||
case 'resolver':
|
||||
$this->view->service = 'unbound';
|
||||
break;
|
||||
case 'suricata':
|
||||
$this->view->service = 'ids';
|
||||
break;
|
||||
|
||||
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2019 Michael Muenz <m.muenz@gmail.com>
|
||||
* Copyright (C) 2020 Deciso B.V.
|
||||
* 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\Unbound\Api;
|
||||
|
||||
use OPNsense\Base\ApiMutableModelControllerBase;
|
||||
|
||||
class MiscellaneousController extends ApiMutableModelControllerBase
|
||||
{
|
||||
protected static $internalModelClass = '\OPNsense\Unboundplus\Miscellaneous';
|
||||
protected static $internalModelName = 'miscellaneous';
|
||||
}
|
||||
@ -31,12 +31,10 @@ namespace OPNsense\Unbound\Api;
|
||||
|
||||
use OPNsense\Base\ApiMutableServiceControllerBase;
|
||||
use OPNsense\Core\Backend;
|
||||
use OPNsense\Unboundplus\Dnsbl;
|
||||
use OPNsense\Unboundplus\Miscellaneous;
|
||||
|
||||
class ServiceController extends ApiMutableServiceControllerBase
|
||||
{
|
||||
protected static $internalServiceClass = '\OPNsense\Unboundplus\Dnsbl';
|
||||
protected static $internalServiceClass = '\OPNsense\Unbound\Unbound';
|
||||
protected static $internalServiceTemplate = 'OPNsense/Unbound/*';
|
||||
protected static $internalServiceEnabled = 'service_enabled';
|
||||
protected static $internalServiceName = 'unbound';
|
||||
|
||||
@ -31,8 +31,38 @@ namespace OPNsense\Unbound\Api;
|
||||
|
||||
use OPNsense\Base\ApiMutableModelControllerBase;
|
||||
|
||||
class DnsblController extends ApiMutableModelControllerBase
|
||||
class SettingsController extends ApiMutableModelControllerBase
|
||||
{
|
||||
protected static $internalModelClass = '\OPNsense\Unboundplus\Dnsbl';
|
||||
protected static $internalModelName = 'dnsbl';
|
||||
protected static $internalModelClass = '\OPNsense\Unbound\Unbound';
|
||||
protected static $internalModelName = 'unbound';
|
||||
|
||||
public function searchDotAction()
|
||||
{
|
||||
return $this->searchBase('dots.dot', array('enabled', 'server', 'port', 'verify'));
|
||||
}
|
||||
|
||||
public function getDotAction($uuid = null)
|
||||
{
|
||||
return $this->getBase('dot', 'dots.dot', $uuid);
|
||||
}
|
||||
|
||||
public function addDotAction()
|
||||
{
|
||||
return $this->addBase('dot', 'dots.dot');
|
||||
}
|
||||
|
||||
public function delDotAction($uuid)
|
||||
{
|
||||
return $this->delBase('dots.dot', $uuid);
|
||||
}
|
||||
|
||||
public function setDotAction($uuid)
|
||||
{
|
||||
return $this->setBase('dot', 'dots.dot', $uuid);
|
||||
}
|
||||
|
||||
public function toggleDotAction($uuid, $enabled = null)
|
||||
{
|
||||
return $this->toggleBase('dots.dot', $uuid, $enabled);
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2019 Michael Muenz <m.muenz@gmail.com>
|
||||
* Copyright (C) 2021 Michael Muenz <m.muenz@gmail.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -26,10 +26,15 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OPNsense\Unboundplus;
|
||||
namespace OPNsense\Unbound;
|
||||
|
||||
use OPNsense\Base\BaseModel;
|
||||
use OPNsense\Base\IndexController;
|
||||
|
||||
class Miscellaneous extends BaseModel
|
||||
class DotController extends IndexController
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->formDialogEdit = $this->getForm('dialogDot');
|
||||
$this->view->pick('OPNsense/Unbound/dot');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
<form>
|
||||
<field>
|
||||
<id>dot.enabled</id>
|
||||
<label>Enabled</label>
|
||||
<type>checkbox</type>
|
||||
<help>Enable or disable this server.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>dot.server</id>
|
||||
<label>Server IP</label>
|
||||
<type>text</type>
|
||||
<help>IP address of DNS server to forward all requests.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>dot.port</id>
|
||||
<label>Server Port</label>
|
||||
<type>text</type>
|
||||
<help>Port of DNS server, for usual DNS use 53, if you use DoT set it to 853.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>dot.verify</id>
|
||||
<label>Verify CN</label>
|
||||
<type>text</type>
|
||||
<help>Verfiy if CN in certficate matches this value.</help>
|
||||
</field>
|
||||
</form>
|
||||
@ -1,18 +1,18 @@
|
||||
<form>
|
||||
<field>
|
||||
<id>dnsbl.enabled</id>
|
||||
<id>unbound.dnsbl.enabled</id>
|
||||
<label>Enable</label>
|
||||
<type>checkbox</type>
|
||||
<help>Enable the usage of DNS blocklists.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>dnsbl.type</id>
|
||||
<id>unbound.dnsbl.type</id>
|
||||
<label>Type of DNSBL</label>
|
||||
<type>select_multiple</type>
|
||||
<help>Select which kind of DNSBL you want to use.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>dnsbl.lists</id>
|
||||
<id>unbound.dnsbl.lists</id>
|
||||
<label>URLs of Blacklists</label>
|
||||
<type>select_multiple</type>
|
||||
<style>tokenize</style>
|
||||
@ -21,7 +21,7 @@
|
||||
<help>List of domains from where blacklist will be downloaded.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>dnsbl.whitelists</id>
|
||||
<id>unbound.dnsbl.whitelists</id>
|
||||
<label>Whitelist Domains</label>
|
||||
<type>select_multiple</type>
|
||||
<style>tokenize</style>
|
||||
|
||||
@ -1,18 +1,10 @@
|
||||
<form>
|
||||
<field>
|
||||
<id>miscellaneous.privatedomain</id>
|
||||
<id>unbound.miscellaneous.privatedomain</id>
|
||||
<label>Private Domains</label>
|
||||
<type>select_multiple</type>
|
||||
<style>tokenize</style>
|
||||
<allownew>true</allownew>
|
||||
<help>List of domains to mark as private. You only need this for some DNSBL lists which resolve to private addresses.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>miscellaneous.dotservers</id>
|
||||
<label>DNS over TLS Servers</label>
|
||||
<type>select_multiple</type>
|
||||
<style>tokenize</style>
|
||||
<allownew>true</allownew>
|
||||
<help>List of nameservers to use for DoT. Use syntax ip@port like 9.9.9.9@853</help>
|
||||
</field>
|
||||
</form>
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
<All url="/services_unbound_acls.php*" visibility="hidden"/>
|
||||
</ACL>
|
||||
<Blacklist order="50" url="/ui/unbound/dnsbl/index"/>
|
||||
<Dot VisibleName="DNS over TLS" order="55" url="/ui/unbound/dot/index"/>
|
||||
<Miscellaneous order="60" url="/ui/unbound/miscellaneous/index"/>
|
||||
<Statistics order="90" url="/ui/unbound/stats"/>
|
||||
<LogFile VisibleName="Log File" order="100" url="/ui/diagnostics/log/core/resolver"/>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2019 Michael Muenz <m.muenz@gmail.com>
|
||||
* Copyright (C) 2021 Michael Muenz <m.muenz@gmail.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -26,10 +26,10 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OPNsense\Unboundplus;
|
||||
namespace OPNsense\Unbound;
|
||||
|
||||
use OPNsense\Base\BaseModel;
|
||||
|
||||
class Dnsbl extends BaseModel
|
||||
class Unbound extends BaseModel
|
||||
{
|
||||
}
|
||||
81
src/opnsense/mvc/app/models/OPNsense/Unbound/Unbound.xml
Normal file
81
src/opnsense/mvc/app/models/OPNsense/Unbound/Unbound.xml
Normal file
@ -0,0 +1,81 @@
|
||||
<model>
|
||||
<mount>//OPNsense/unboundplus</mount>
|
||||
<description>Unbound configuration</description>
|
||||
<version>0.0.0</version>
|
||||
<items>
|
||||
<service_enabled type="LegacyLinkField">
|
||||
<Source>unbound.enable</Source>
|
||||
</service_enabled>
|
||||
<dnsbl>
|
||||
<enabled type="BooleanField">
|
||||
<default>0</default>
|
||||
<Required>Y</Required>
|
||||
</enabled>
|
||||
<type type="OptionField">
|
||||
<Required>N</Required>
|
||||
<Multiple>Y</Multiple>
|
||||
<OptionValues>
|
||||
<aa>AdAway List</aa>
|
||||
<ag>AdGuard List</ag>
|
||||
<bla0>Blocklist.site Abuse</bla0>
|
||||
<bla>Blocklist.site Ads</bla>
|
||||
<blc>Blocklist.site Crypto</blc>
|
||||
<bld>Blocklist.site Drugs</bld>
|
||||
<blf>Blocklist.site Fraud</blf>
|
||||
<blf0>Blocklist.site Facebook</blf0>
|
||||
<blg>Blocklist.site Gambling</blg>
|
||||
<blm>Blocklist.site Malware</blm>
|
||||
<blp>Blocklist.site Phishing</blp>
|
||||
<blp0>Blocklist.site Piracy</blp0>
|
||||
<blp1>Blocklist.site Porn</blp1>
|
||||
<blr>Blocklist.site Ransomware</blr>
|
||||
<blr0>Blocklist.site Redirect</blr0>
|
||||
<bls>Blocklist.site Scam</bls>
|
||||
<blt>Blocklist.site Tiktok</blt>
|
||||
<blt0>Blocklist.site Torrent</blt0>
|
||||
<blt1>Blocklist.site Tracking</blt1>
|
||||
<bly>Blocklist.site Youtube</bly>
|
||||
<el>EasyList</el>
|
||||
<ep>EasyPrivacy</ep>
|
||||
<nc>NoCoin List</nc>
|
||||
<pt>PornTop1M List</pt>
|
||||
<sa>Simple Ad List</sa>
|
||||
<st>Simple Tracker List</st>
|
||||
<sb>Steven Black List</sb>
|
||||
<ws>WindowsSpyBlocker (spy)</ws>
|
||||
<wsu>WindowsSpyBlocker (update)</wsu>
|
||||
<wse>WindowsSpyBlocker (extra)</wse>
|
||||
<yy>YoYo List</yy>
|
||||
</OptionValues>
|
||||
</type>
|
||||
<lists type="CSVListField">
|
||||
<Required>N</Required>
|
||||
</lists>
|
||||
<whitelists type="CSVListField">
|
||||
<Required>N</Required>
|
||||
</whitelists>
|
||||
</dnsbl>
|
||||
<dots>
|
||||
<dot type="ArrayField">
|
||||
<enabled type="BooleanField">
|
||||
<Required>Y</Required>
|
||||
<default>1</default>
|
||||
</enabled>
|
||||
<server type="NetworkField">
|
||||
<Required>Y</Required>
|
||||
</server>
|
||||
<port type="PortField">
|
||||
<Required>Y</Required>
|
||||
</port>
|
||||
<verify type="HostnameField">
|
||||
<Required>N</Required>
|
||||
</verify>
|
||||
</dot>
|
||||
</dots>
|
||||
<miscellaneous>
|
||||
<privatedomain type="CSVListField">
|
||||
<Required>N</Required>
|
||||
</privatedomain>
|
||||
</miscellaneous>
|
||||
</items>
|
||||
</model>
|
||||
@ -1,57 +0,0 @@
|
||||
<model>
|
||||
<mount>//OPNsense/unboundplus/dnsbl</mount>
|
||||
<description>Unbound DNSBL configuration</description>
|
||||
<version>0.0.1</version>
|
||||
<items>
|
||||
<service_enabled type="LegacyLinkField">
|
||||
<Source>unbound.enable</Source>
|
||||
</service_enabled>
|
||||
<enabled type="BooleanField">
|
||||
<default>0</default>
|
||||
<Required>Y</Required>
|
||||
</enabled>
|
||||
<type type="OptionField">
|
||||
<Required>N</Required>
|
||||
<Multiple>Y</Multiple>
|
||||
<OptionValues>
|
||||
<aa>AdAway List</aa>
|
||||
<ag>AdGuard List</ag>
|
||||
<bla0>Blocklist.site Abuse</bla0>
|
||||
<bla>Blocklist.site Ads</bla>
|
||||
<blc>Blocklist.site Crypto</blc>
|
||||
<bld>Blocklist.site Drugs</bld>
|
||||
<blf>Blocklist.site Fraud</blf>
|
||||
<blf0>Blocklist.site Facebook</blf0>
|
||||
<blg>Blocklist.site Gambling</blg>
|
||||
<blm>Blocklist.site Malware</blm>
|
||||
<blp>Blocklist.site Phishing</blp>
|
||||
<blp0>Blocklist.site Piracy</blp0>
|
||||
<blp1>Blocklist.site Porn</blp1>
|
||||
<blr>Blocklist.site Ransomware</blr>
|
||||
<blr0>Blocklist.site Redirect</blr0>
|
||||
<bls>Blocklist.site Scam</bls>
|
||||
<blt>Blocklist.site Tiktok</blt>
|
||||
<blt0>Blocklist.site Torrent</blt0>
|
||||
<blt1>Blocklist.site Tracking</blt1>
|
||||
<bly>Blocklist.site Youtube</bly>
|
||||
<el>EasyList</el>
|
||||
<ep>EasyPrivacy</ep>
|
||||
<nc>NoCoin List</nc>
|
||||
<pt>PornTop1M List</pt>
|
||||
<sa>Simple Ad List</sa>
|
||||
<st>Simple Tracker List</st>
|
||||
<sb>Steven Black List</sb>
|
||||
<ws>WindowsSpyBlocker (spy)</ws>
|
||||
<wsu>WindowsSpyBlocker (update)</wsu>
|
||||
<wse>WindowsSpyBlocker (extra)</wse>
|
||||
<yy>YoYo List</yy>
|
||||
</OptionValues>
|
||||
</type>
|
||||
<lists type="CSVListField">
|
||||
<Required>N</Required>
|
||||
</lists>
|
||||
<whitelists type="CSVListField">
|
||||
<Required>N</Required>
|
||||
</whitelists>
|
||||
</items>
|
||||
</model>
|
||||
@ -1,14 +0,0 @@
|
||||
<model>
|
||||
<mount>//OPNsense/unboundplus/miscellaneous</mount>
|
||||
<description>Unbound Miscellaneous configuration</description>
|
||||
<version>0.0.2</version>
|
||||
<items>
|
||||
<privatedomain type="CSVListField">
|
||||
<Required>N</Required>
|
||||
</privatedomain>
|
||||
<dotservers type="CSVListField">
|
||||
<Required>N</Required>
|
||||
<mask>/^[a-fA-F0-9\.\,\:\@]{1,512}$/</mask>
|
||||
</dotservers>
|
||||
</items>
|
||||
</model>
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var data_get_map = {'frm_dnsbl_settings':"/api/unbound/dnsbl/get"};
|
||||
var data_get_map = {'frm_dnsbl_settings':"/api/unbound/settings/get"};
|
||||
mapDataToFormUI(data_get_map).done(function(data){
|
||||
formatTokenizersUI();
|
||||
$('.selectpicker').selectpicker('refresh');
|
||||
@ -36,12 +36,14 @@
|
||||
$("#saveAct").SimpleActionButton({
|
||||
onPreAction: function() {
|
||||
const dfObj = new $.Deferred();
|
||||
saveFormToEndpoint("/api/unbound/dnsbl/set", 'frm_dnsbl_settings', function(){
|
||||
saveFormToEndpoint("/api/unbound/settings/set", 'frm_dnsbl_settings', function(){
|
||||
dfObj.resolve();
|
||||
});
|
||||
return dfObj;
|
||||
}
|
||||
});
|
||||
|
||||
updateServiceControlUI('unbound');
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
139
src/opnsense/mvc/app/views/OPNsense/Unbound/dot.volt
Normal file
139
src/opnsense/mvc/app/views/OPNsense/Unbound/dot.volt
Normal file
@ -0,0 +1,139 @@
|
||||
{#
|
||||
# Copyright (c) 2014-2015 Deciso B.V.
|
||||
# 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.
|
||||
#}
|
||||
|
||||
<script>
|
||||
|
||||
$( document ).ready(function() {
|
||||
/**
|
||||
* inline open dialog, go back to previous page on exit
|
||||
*/
|
||||
function openDialog(uuid) {
|
||||
var editDlg = "DialogEdit";
|
||||
var setUrl = "/api/unbound/settings/setDot/";
|
||||
var getUrl = "/api/unbound/settings/getDot/";
|
||||
var urlMap = {};
|
||||
urlMap['frm_' + editDlg] = getUrl + uuid;
|
||||
mapDataToFormUI(urlMap).done(function () {
|
||||
// update selectors
|
||||
$('.selectpicker').selectpicker('refresh');
|
||||
// clear validation errors (if any)
|
||||
clearFormValidation('frm_' + editDlg);
|
||||
// show
|
||||
$('#'+editDlg).modal({backdrop: 'static', keyboard: false});
|
||||
$('#'+editDlg).on('hidden.bs.modal', function () {
|
||||
// go back to previous page on exit
|
||||
parent.history.back();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// define save action
|
||||
$("#btn_"+editDlg+"_save").unbind('click').click(function(){
|
||||
saveFormToEndpoint(setUrl+uuid, 'frm_' + editDlg, function(){
|
||||
// do reconfigure of unbound after save (because we're leaving back to the sender)
|
||||
ajaxCall("/api/unbound/service/reconfigure", {}, function(data,status) {
|
||||
$("#"+editDlg).modal('hide');
|
||||
});
|
||||
}, true);
|
||||
});
|
||||
|
||||
}
|
||||
/*************************************************************************************************************
|
||||
* link grid actions
|
||||
*************************************************************************************************************/
|
||||
|
||||
$("#grid-dot").UIBootgrid(
|
||||
{ 'search':'/api/unbound/settings/searchDot',
|
||||
'get':'/api/unbound/settings/getDot/',
|
||||
'set':'/api/unbound/settings/setDot/',
|
||||
'add':'/api/unbound/settings/addDot/',
|
||||
'del':'/api/unbound/settings/delDot/',
|
||||
'toggle':'/api/unbound/settings/toggleDot/'
|
||||
}
|
||||
);
|
||||
|
||||
{% if (selected_uuid|default("") != "") %}
|
||||
openDialog('{{selected_uuid}}');
|
||||
{% endif %}
|
||||
|
||||
/*************************************************************************************************************
|
||||
* Commands
|
||||
*************************************************************************************************************/
|
||||
|
||||
/**
|
||||
* Reconfigure unbound - activate changes
|
||||
*/
|
||||
$("#reconfigureAct").SimpleActionButton();
|
||||
|
||||
updateServiceControlUI('unbound');
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<ul class="nav nav-tabs" data-tabs="tabs" id="maintabs">
|
||||
<li class="active"><a data-toggle="tab" href="#grid-dot">{{ lang._('Servers') }}</a></li>
|
||||
</ul>
|
||||
<div class="tab-content content-box">
|
||||
<div id="dot" class="tab-pane fade in active">
|
||||
<table id="grid-dot" class="table table-condensed table-hover table-striped table-responsive" data-editDialog="DialogEdit">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="enabled" data-width="6em" data-type="string" data-formatter="rowtoggle">{{ lang._('Enabled') }}</th>
|
||||
<th data-column-id="server" data-type="string">{{ lang._('Address') }}</th>
|
||||
<th data-column-id="port" data-type="int">{{ lang._('Port') }}</th>
|
||||
<th data-column-id="verify" data-type="int">{{ lang._('Hostname') }}</th>
|
||||
<th data-column-id="commands" data-width="7em" data-formatter="commands" data-sortable="false">{{ lang._('Edit') }} | {{ lang._('Delete') }}</th>
|
||||
<th data-column-id="uuid" data-type="string" data-identifier="true" data-visible="false">{{ lang._('ID') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<button data-action="add" type="button" class="btn btn-xs btn-primary"><span class="fa fa-fw fa-plus"></span></button>
|
||||
<button data-action="deleteSelected" type="button" class="btn btn-xs btn-default"><span class="fa fa-fw fa-trash-o"></span></button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<hr/>
|
||||
<button class="btn btn-primary" id="reconfigureAct"
|
||||
data-endpoint='/api/unbound/service/reconfigure'
|
||||
data-label="{{ lang._('Apply') }}"
|
||||
data-error-title="{{ lang._('Error reconfiguring unbound') }}"
|
||||
type="button"
|
||||
></button>
|
||||
<br/><br/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# include dialog #}
|
||||
{{ partial("layout_partials/base_dialog",['fields':formDialogEdit,'id':'DialogEdit','label':lang._('Edit server')])}}
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var data_get_map = {'frm_miscellaneous_settings':"/api/unbound/miscellaneous/get"};
|
||||
var data_get_map = {'frm_miscellaneous_settings':"/api/unbound/settings/get"};
|
||||
mapDataToFormUI(data_get_map).done(function(data){
|
||||
formatTokenizersUI();
|
||||
$('.selectpicker').selectpicker('refresh');
|
||||
@ -35,12 +35,14 @@
|
||||
$("#saveAct").SimpleActionButton({
|
||||
onPreAction: function() {
|
||||
const dfObj = new $.Deferred();
|
||||
saveFormToEndpoint("/api/unbound/miscellaneous/set", 'frm_miscellaneous_settings', function(){
|
||||
saveFormToEndpoint("/api/unbound/settings/set", 'frm_miscellaneous_settings', function(){
|
||||
dfObj.resolve();
|
||||
});
|
||||
return dfObj;
|
||||
}
|
||||
});
|
||||
|
||||
updateServiceControlUI('unbound');
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@ -137,9 +137,9 @@
|
||||
|
||||
// initial fetch
|
||||
updateStats();
|
||||
|
||||
updateServiceControlUI('unbound');
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<div class="content-box">
|
||||
|
||||
@ -40,18 +40,26 @@ parameters:%s
|
||||
type:script
|
||||
message:Unbound cache %s
|
||||
|
||||
[reload]
|
||||
command:/usr/local/sbin/unbound-control -c /var/unbound/unbound.conf reload
|
||||
parameters:
|
||||
type:script
|
||||
message:Reloading Unbound
|
||||
|
||||
[start]
|
||||
command:/usr/local/bin/flock -n -E 0 -o /tmp/unbound_start.lock /usr/local/opnsense/scripts/unbound/start.sh
|
||||
parameters:
|
||||
type:script
|
||||
message:Starting Unbound
|
||||
|
||||
[stop]
|
||||
command:/usr/local/sbin/unbound-control -c /var/unbound/unbound.conf stop
|
||||
parameters:
|
||||
type:script
|
||||
message:Stopping Unbound
|
||||
|
||||
[restart]
|
||||
command:
|
||||
/usr/local/sbin/unbound-control -c /var/unbound/unbound.conf stop &&
|
||||
/usr/local/bin/flock -n -E 0 -o /tmp/unbound_start.lock /usr/local/opnsense/scripts/unbound/start.sh
|
||||
parameters:
|
||||
type:script
|
||||
message:Restarting Unbound
|
||||
|
||||
[check]
|
||||
command:/usr/local/opnsense/scripts/unbound/check.sh
|
||||
parameters:
|
||||
|
||||
@ -1,10 +1,19 @@
|
||||
{% if not helpers.empty('OPNsense.unboundplus.miscellaneous.dotservers') %}
|
||||
{% if not helpers.empty('OPNsense.unboundplus.dots.dot') %}
|
||||
{% set dots = [] %}
|
||||
{% for dot in helpers.toList('OPNsense.unboundplus.dots.dot') %}
|
||||
{% if dot.enabled == '1' %}
|
||||
{% do dots.append(dot) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if dots|length > 0 %}
|
||||
server:
|
||||
tls-cert-bundle: /etc/ssl/cert.pem
|
||||
forward-zone:
|
||||
name: "."
|
||||
forward-tls-upstream: yes
|
||||
{% for dot in OPNsense.unboundplus.miscellaneous.dotservers.split(',') %}
|
||||
forward-addr: {{ dot }}
|
||||
{% endfor %}
|
||||
{% for dot in dots %}
|
||||
forward-addr: {{ dot.server }}@{{ dot.port }}{% if dot.verify != '' %}{{ dot.verify }}{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user