-
Notifications
You must be signed in to change notification settings - Fork 644
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renamed scripts to be more inclusive to what they do
Signed-off-by: Jeremy-Boyle <[email protected]>
- Loading branch information
1 parent
dc35366
commit b4caaad
Showing
17 changed files
with
357 additions
and
34 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
PLUGIN_NAME= bind | ||
PLUGIN_VERSION= 1.33 | ||
PLUGIN_VERSION= 1.34 | ||
PLUGIN_COMMENT= BIND domain name service | ||
PLUGIN_DEPENDS= bind920 | ||
PLUGIN_MAINTAINER= [email protected] | ||
|
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
65 changes: 65 additions & 0 deletions
65
dns/bind/src/opnsense/mvc/app/controllers/OPNsense/Bind/Api/KeyController.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) 2024 Jeremy Boyle | ||
* | ||
* 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\Bind\Api; | ||
|
||
use OPNsense\Base\ApiMutableModelControllerBase; | ||
|
||
class KeyController extends ApiMutableModelControllerBase | ||
{ | ||
protected static $internalModelName = 'key'; | ||
protected static $internalModelClass = '\OPNsense\Bind\Key'; | ||
|
||
public function searchKeyAction() | ||
{ | ||
return $this->searchBase('keys.key', array("enabled", "name","algo","secret")); | ||
} | ||
public function getKeyAction($uuid = null) | ||
{ | ||
$this->sessionClose(); | ||
return $this->getBase('key', 'keys.key', $uuid); | ||
} | ||
public function addKeyAction() | ||
{ | ||
return $this->addBase('key', 'keys.key'); | ||
} | ||
public function delKeyAction($uuid) | ||
{ | ||
return $this->delBase('keys.key', $uuid); | ||
} | ||
public function setKeyAction($uuid) | ||
{ | ||
return $this->setBase('key', 'keys.key', $uuid); | ||
} | ||
public function toggleKeyAction($uuid) | ||
{ | ||
return $this->toggleBase('keys.key', $uuid); | ||
} | ||
} |
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
28 changes: 28 additions & 0 deletions
28
dns/bind/src/opnsense/mvc/app/controllers/OPNsense/Bind/forms/dialogEditBindKey.xml
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,28 @@ | ||
<form> | ||
<field> | ||
<id>key.enabled</id> | ||
<label>Enabled</label> | ||
<type>checkbox</type> | ||
<help>This will enable or disable the key.</help> | ||
</field> | ||
<field> | ||
<id>key.name</id> | ||
<label>Name</label> | ||
<type>text</type> | ||
<help>Set the name for this key key.</help> | ||
</field> | ||
<field> | ||
<id>key.algo</id> | ||
<label>Algorithm</label> | ||
<type>dropdown</type> | ||
<advanced>true</advanced> | ||
<help>Set the authentication algorithm for the key. This requires a restart of the Bind Service.</help> | ||
</field> | ||
<field> | ||
<id>key.secret</id> | ||
<label>Secret</label> | ||
<type>text</type> | ||
<advanced>true</advanced> | ||
<help>The base64-encoded key. This requires a restart of the Bind Service.</help> | ||
</field> | ||
</form> |
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
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
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
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
45 changes: 45 additions & 0 deletions
45
dns/bind/src/opnsense/mvc/app/models/OPNsense/Bind/Key.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,45 @@ | ||
<?php | ||
|
||
/* | ||
Copyright (C) 2024 Jeremy Boyle | ||
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\Bind; | ||
|
||
use OPNsense\Base\BaseModel; | ||
|
||
class Key extends BaseModel | ||
{ | ||
/** | ||
* @param $uuid string key uuid | ||
* @return mixed key | ||
*/ | ||
public function getKey($uuid) | ||
{ | ||
foreach ($this->keys->key->iterateItems() as $key) { | ||
if ($key->getAttribute('uuid') == $uuid) { | ||
return $key; | ||
} | ||
} | ||
return null; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
dns/bind/src/opnsense/mvc/app/models/OPNsense/Bind/Key.xml
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,42 @@ | ||
<model> | ||
<mount>//OPNsense/bind/key</mount> | ||
<description>BIND KEY configuration</description> | ||
<version>1.0.0</version> | ||
<items> | ||
<keys> | ||
<key type="ArrayField"> | ||
<enabled type="BooleanField"> | ||
<Default>1</Default> | ||
<Required>Y</Required> | ||
</enabled> | ||
<name type="TextField"> | ||
<Required>Y</Required> | ||
<mask>/^[0-9a-zA-Z_\-]{1,32}$/u</mask> | ||
<ValidationMessage>Should be a string between 1 and 32 characters. Allowed characters are 0-9, a-z, A-Z, _ and -.</ValidationMessage> | ||
<Constraints> | ||
<check001> | ||
<ValidationMessage>A Key with this name already exists.</ValidationMessage> | ||
<type>UniqueConstraint</type> | ||
</check001> | ||
</Constraints> | ||
</name> | ||
<algo type="OptionField"> | ||
<Required>Y</Required> | ||
<Default>hmac-sha256</Default> | ||
<OptionValues> | ||
<hmac-sha512>HMAC-SHA512</hmac-sha512> | ||
<hmac-sha384>HMAC-SHA384</hmac-sha384> | ||
<hmac-sha256>HMAC-SHA256</hmac-sha256> | ||
<hmac-sha224>HMAC-SHA224</hmac-sha224> | ||
<hmac-sha1>HMAC-SHA1</hmac-sha1> | ||
<hmac-md5>HMAC-MD5</hmac-md5> | ||
</OptionValues> | ||
</algo> | ||
<secret type="Base64Field"> | ||
<Required>Y</Required> | ||
<Default>VxtIzJevSQXqnr7h2qerrcwjnZlMWSGGFBndKeNIDfw=</Default> | ||
</secret> | ||
</key> | ||
</keys> | ||
</items> | ||
</model> |
Oops, something went wrong.