forked from opnsense/plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dns/dnscrypt-proxy: new plugin (opnsense#965)
- Loading branch information
Showing
31 changed files
with
1,355 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,8 @@ | ||
PLUGIN_NAME= dnscrypt-proxy | ||
PLUGIN_VERSION= 0.1 | ||
PLUGIN_COMMENT= Flexible DNS proxy supportung DNSCrypt and DoH | ||
PLUGIN_DEPENDS= dnscrypt-proxy2 | ||
PLUGIN_MAINTAINER= [email protected] | ||
PLUGIN_DEVEL= yes | ||
|
||
.include "../../Mk/plugins.mk" |
This file contains 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,4 @@ | ||
A flexible DNS proxy, with support for modern encrypted DNS protocols | ||
such as DNSCrypt v2 and DNS-over-HTTPS. | ||
|
||
WWW: https://github.com/jedisct1/dnscrypt-proxy |
55 changes: 55 additions & 0 deletions
55
dns/dnscrypt-proxy/src/etc/inc/plugins.inc.d/dnscryptproxy.inc
This file contains 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,55 @@ | ||
<?php | ||
|
||
/* | ||
Copyright (C) 2018 Michael Muenz <[email protected]> | ||
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 dnscryptproxy_enabled() | ||
{ | ||
$model = new \OPNsense\Dnscryptproxy\General(); | ||
return (string)$model->enabled == '1'; | ||
} | ||
|
||
function dnscryptproxy_services() | ||
{ | ||
$services = array(); | ||
|
||
if (!dnscryptproxy_enabled()) { | ||
return $services; | ||
} | ||
|
||
$services[] = array( | ||
'description' => gettext('DNSCrypt-Proxy'), | ||
'configd' => array( | ||
'restart' => array('dnscryptproxy restart'), | ||
'start' => array('dnscryptproxy start'), | ||
'stop' => array('dnscryptproxy stop'), | ||
), | ||
'name' => 'dnscrypt-proxy', | ||
'pid' => '/var/run/dnscrypt-proxy.pid' | ||
); | ||
|
||
return $services; | ||
} |
65 changes: 65 additions & 0 deletions
65
...ypt-proxy/src/opnsense/mvc/app/controllers/OPNsense/Dnscryptproxy/Api/CloakController.php
This file contains 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,65 @@ | ||
<?php | ||
/** | ||
* Copyright (C) 2018 Michael Muenz <[email protected]> | ||
* | ||
* 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\Dnscryptproxy\Api; | ||
|
||
use \OPNsense\Base\ApiMutableModelControllerBase; | ||
use \OPNsense\Core\Backend; | ||
|
||
class CloakController extends ApiMutableModelControllerBase | ||
{ | ||
static protected $internalModelName = 'cloak'; | ||
static protected $internalModelClass = '\OPNsense\Dnscryptproxy\Cloak'; | ||
|
||
public function searchCloakAction() | ||
{ | ||
return $this->searchBase('cloaks.cloak', array("enabled", "name", "destination")); | ||
} | ||
public function getCloakAction($uuid = null) | ||
{ | ||
$this->sessionClose(); | ||
return $this->getBase('cloak', 'cloaks.cloak', $uuid); | ||
} | ||
public function addCloakAction() | ||
{ | ||
return $this->addBase('cloak', 'cloaks.cloak'); | ||
} | ||
public function delCloakAction($uuid) | ||
{ | ||
return $this->delBase('cloaks.cloak', $uuid); | ||
} | ||
public function setCloakAction($uuid) | ||
{ | ||
return $this->setBase('cloak', 'cloaks.cloak', $uuid); | ||
} | ||
public function toggleCloakAction($uuid) | ||
{ | ||
return $this->toggleBase('cloaks.cloak', $uuid); | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
...t-proxy/src/opnsense/mvc/app/controllers/OPNsense/Dnscryptproxy/Api/ForwardController.php
This file contains 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,65 @@ | ||
<?php | ||
/** | ||
* Copyright (C) 2018 Michael Muenz <[email protected]> | ||
* | ||
* 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\Dnscryptproxy\Api; | ||
|
||
use \OPNsense\Base\ApiMutableModelControllerBase; | ||
use \OPNsense\Core\Backend; | ||
|
||
class ForwardController extends ApiMutableModelControllerBase | ||
{ | ||
static protected $internalModelName = 'forward'; | ||
static protected $internalModelClass = '\OPNsense\Dnscryptproxy\Forward'; | ||
|
||
public function searchForwardAction() | ||
{ | ||
return $this->searchBase('forwards.forward', array("enabled", "domain", "dnsserver")); | ||
} | ||
public function getForwardAction($uuid = null) | ||
{ | ||
$this->sessionClose(); | ||
return $this->getBase('forward', 'forwards.forward', $uuid); | ||
} | ||
public function addForwardAction() | ||
{ | ||
return $this->addBase('forward', 'forwards.forward'); | ||
} | ||
public function delForwardAction($uuid) | ||
{ | ||
return $this->delBase('forwards.forward', $uuid); | ||
} | ||
public function setForwardAction($uuid) | ||
{ | ||
return $this->setBase('forward', 'forwards.forward', $uuid); | ||
} | ||
public function toggleForwardAction($uuid) | ||
{ | ||
return $this->toggleBase('forwards.forward', $uuid); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...t-proxy/src/opnsense/mvc/app/controllers/OPNsense/Dnscryptproxy/Api/GeneralController.php
This file contains 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,39 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright (C) 2018 Michael Muenz <[email protected]> | ||
* | ||
* 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\Dnscryptproxy\Api; | ||
|
||
use OPNsense\Base\ApiMutableModelControllerBase; | ||
|
||
class GeneralController extends ApiMutableModelControllerBase | ||
{ | ||
static protected $internalModelClass = '\OPNsense\Dnscryptproxy\General'; | ||
static protected $internalModelName = 'general'; | ||
} |
47 changes: 47 additions & 0 deletions
47
...t-proxy/src/opnsense/mvc/app/controllers/OPNsense/Dnscryptproxy/Api/ServiceController.php
This file contains 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,47 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright (C) 2018 Michael Muenz <[email protected]> | ||
* | ||
* 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\Dnscryptproxy\Api; | ||
|
||
use OPNsense\Base\ApiMutableServiceControllerBase; | ||
use OPNsense\Core\Backend; | ||
use OPNsense\Dnscryptproxy\General; | ||
|
||
/** | ||
* Class ServiceController | ||
* @package OPNsense\Dnscrypt-proxy | ||
*/ | ||
class ServiceController extends ApiMutableServiceControllerBase | ||
{ | ||
static protected $internalServiceClass = '\OPNsense\Dnscryptproxy\General'; | ||
static protected $internalServiceTemplate = 'OPNsense/Dnscryptproxy'; | ||
static protected $internalServiceEnabled = 'enabled'; | ||
static protected $internalServiceName = 'dnscryptproxy'; | ||
} |
65 changes: 65 additions & 0 deletions
65
...proxy/src/opnsense/mvc/app/controllers/OPNsense/Dnscryptproxy/Api/WhitelistController.php
This file contains 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,65 @@ | ||
<?php | ||
/** | ||
* Copyright (C) 2018 Michael Muenz <[email protected]> | ||
* | ||
* 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\Dnscryptproxy\Api; | ||
|
||
use \OPNsense\Base\ApiMutableModelControllerBase; | ||
use \OPNsense\Core\Backend; | ||
|
||
class WhitelistController extends ApiMutableModelControllerBase | ||
{ | ||
static protected $internalModelName = 'whitelist'; | ||
static protected $internalModelClass = '\OPNsense\Dnscryptproxy\Whitelist'; | ||
|
||
public function searchWhitelistAction() | ||
{ | ||
return $this->searchBase('whitelists.whitelist', array("enabled", "name")); | ||
} | ||
public function getWhitelistAction($uuid = null) | ||
{ | ||
$this->sessionClose(); | ||
return $this->getBase('whitelist', 'whitelists.whitelist', $uuid); | ||
} | ||
public function addWhitelistAction() | ||
{ | ||
return $this->addBase('whitelist', 'whitelists.whitelist'); | ||
} | ||
public function delWhitelistAction($uuid) | ||
{ | ||
return $this->delBase('whitelists.whitelist', $uuid); | ||
} | ||
public function setWhitelistAction($uuid) | ||
{ | ||
return $this->setBase('whitelist', 'whitelists.whitelist', $uuid); | ||
} | ||
public function toggleWhitelistAction($uuid) | ||
{ | ||
return $this->toggleBase('whitelists.whitelist', $uuid); | ||
} | ||
} |
Oops, something went wrong.