dns/bind: acl, forwards, menu item (#731)

This commit is contained in:
Michael
2018-07-17 15:36:26 +02:00
committed by Franco Fichtner
parent 88dceeff45
commit 010922c329
10 changed files with 56 additions and 37 deletions
@@ -31,33 +31,33 @@ namespace OPNsense\Bind\Api;
use \OPNsense\Base\ApiMutableModelControllerBase;
class ACLController extends ApiMutableModelControllerBase
class AclController extends ApiMutableModelControllerBase
{
static protected $internalModelName = 'acl';
static protected $internalModelClass = '\OPNsense\Bind\ACL';
static protected $internalModelClass = '\OPNsense\Bind\Acl';
public function searchACLAction()
public function searchAclAction()
{
return $this->searchBase('acls.acl', array("enabled", "name", "networks"));
}
public function getACLAction($uuid = null)
public function getAclAction($uuid = null)
{
$this->sessionClose();
return $this->getBase('acl', 'acls.acl', $uuid);
}
public function addACLAction()
public function addAclAction()
{
return $this->addBase('acl', 'acls.acl');
}
public function delACLAction($uuid)
public function delAclAction($uuid)
{
return $this->delBase('acls.acl', $uuid);
}
public function setACLAction($uuid)
public function setAclAction($uuid)
{
return $this->setBase('acl', 'acls.acl', $uuid);
}
public function toggleACLAction($uuid)
public function toggleAclAction($uuid)
{
return $this->toggleBase('acls.acl', $uuid);
}
@@ -33,7 +33,7 @@ class GeneralController extends \OPNsense\Base\IndexController
public function indexAction()
{
$this->view->generalForm = $this->getForm("general");
$this->view->formDialogEditBindACL = $this->getForm("dialogEditBindACL");
$this->view->formDialogEditBindAcl = $this->getForm("dialogEditBindAcl");
$this->view->pick('OPNsense/Bind/general');
}
}
@@ -14,7 +14,9 @@
<field>
<id>acl.networks</id>
<label>Network List</label>
<type>text</type>
<style>tokenize</style>
<type>select_multiple</type>
<allownew>true</allownew>
<help>List of networks for this ACL.</help>
</field>
</form>
@@ -21,4 +21,12 @@
<allownew>true</allownew>
<help>Set the IPv6 addresses the service should listen to.</help>
</field>
<field>
<id>general.forwarders</id>
<label>DNS Forwarders</label>
<style>tokenize</style>
<type>select_multiple</type>
<allownew>true</allownew>
<help>Set one or more hosts to send your DNS queries if the request is unknown.</help>
</field>
</form>
@@ -26,6 +26,6 @@ namespace OPNsense\Bind;
use OPNsense\Base\BaseModel;
class ACL extends BaseModel
class Acl extends BaseModel
{
}
@@ -17,8 +17,9 @@
</name>
<networks type="NetworkField">
<default></default>
<FieldSeparator>;</FieldSeparator>
<FieldSeparator>,</FieldSeparator>
<Required>Y</Required>
<asList>Y</asList>
</networks>
</acl>
</acls>
@@ -8,12 +8,21 @@
<Required>Y</Required>
</enabled>
<listenv4 type="NetworkField">
<FieldSeparator>;</FieldSeparator>
<Required>N</Required>
<default>127.0.0.1</default>
<FieldSeparator>,</FieldSeparator>
<Required>Y</Required>
<asList>Y</asList>
</listenv4>
<listenv6 type="NetworkField">
<FieldSeparator>;</FieldSeparator>
<Required>N</Required>
<default>::1</default>
<FieldSeparator>,</FieldSeparator>
<Required>Y</Required>
<asList>Y</asList>
</listenv6>
<forwarders type="NetworkField">
<FieldSeparator>,</FieldSeparator>
<Required>N</Required>
<asList>Y</asList>
</forwarders>
</items>
</model>
@@ -1,5 +1,5 @@
<menu>
<Services>
<BIND cssClass="fa fa-map-marked" url="/ui/bind/general/index" />
<BIND cssClass="fa fa-tags" url="/ui/bind/general/index" />
</Services>
</menu>
@@ -44,7 +44,7 @@ POSSIBILITY OF SUCH DAMAGE.
</div>
</div>
<div id="acls" class="tab-pane fade in">
<table id="grid-acls" class="table table-responsive" data-editDialog="dialogEditBindACL">
<table id="grid-acls" class="table table-responsive" data-editDialog="dialogEditBindAcl">
<thead>
<tr>
<th data-column-id="enabled" data-type="string" data-formatter="rowtoggle">{{ lang._('Enabled') }}</th>
@@ -73,7 +73,7 @@ POSSIBILITY OF SUCH DAMAGE.
</div>
</div>
{{ partial("layout_partials/base_dialog",['fields':formDialogEditBindACL,'id':'dialogEditBindACL','label':lang._('Edit ACL')])}}
{{ partial("layout_partials/base_dialog",['fields':formDialogEditBindAcl,'id':'dialogEditBindAcl','label':lang._('Edit ACL')])}}
<script>
$( document ).ready(function() {
@@ -88,12 +88,12 @@ $( document ).ready(function() {
});
$("#grid-acls").UIBootgrid(
{ 'search':'/api/bind/acl/searchACL',
'get':'/api/bind/acl/getACL/',
'set':'/api/bind/acl/setACL/',
'add':'/api/bind/acl/addACL/',
'del':'/api/bind/acl/delACL/',
'toggle':'/api/bind/acl/toggleACL/'
{ 'search':'/api/bind/acl/searchAcl',
'get':'/api/bind/acl/getAcl/',
'set':'/api/bind/acl/setAcl/',
'add':'/api/bind/acl/addAcl/',
'del':'/api/bind/acl/delAcl/',
'toggle':'/api/bind/acl/toggleAcl/'
}
);
@@ -1,5 +1,13 @@
{% if helpers.exists('OPNsense.bind.general.enabled') and OPNsense.bind.general.enabled == '1' %}
{% if helpers.exists('OPNsense.bind.acl.acls.acl') %}
{% for acl_list in helpers.toList('OPNsense.bind.acl.acls.acl') %}
{% if acl_list.enabled == '1' %}
acl "{{ acl_list.name }}" { {{ acl_list.networks.replace(',', '; ') }}; };
{% endif %}
{% endfor %}
{% endif %}
options {
directory "/usr/local/etc/namedb/working";
@@ -14,21 +22,12 @@ options {
listen-on-v6 { {{ OPNsense.bind.general.listenv6.replace(',', '; ') }}; };
{% endif %}
/*
forwarders {
127.0.0.1;
};
*/
{% if helpers.exists('OPNsense.bind.general.forwarders') and OPNsense.bind.general.forwarders != '' %}
forwarders { {{ OPNsense.bind.general.forwarders.replace(',', '; ') }}; };
{% endif %}
};
// If the 'forwarders' clause is not empty the default is to 'forward first'
// which will fall back to sending a query from your local server if the name
// servers in 'forwarders' do not have the answer. Alternatively you can
// force your name server to never initiate queries of its own by enabling the
// following line:
// forward only;
zone "." { type hint; file "/usr/local/etc/namedb/named.root"; };
zone "localhost" { type master; file "/usr/local/etc/namedb/master/localhost-forward.db"; };