dns/bind: small improvements for zone management (#1431)

This commit is contained in:
Frank Wall 2019-08-13 07:41:01 +02:00 committed by Franco Fichtner
parent e20c4e45a7
commit e6ac666d80
4 changed files with 50 additions and 27 deletions

View File

@ -3,13 +3,24 @@
<id>domain.enabled</id>
<label>Enabled</label>
<type>checkbox</type>
<help>This will enable or disable the ACL.</help>
<help>This will enable or disable this zone.</help>
</field>
<field>
<id>domain.domainname</id>
<label>Zone Name</label>
<type>text</type>
<help>Set the name for this zone. Both forward and reverse zones may be specified, i.e. example.com or 0.168.192.in-addr.arpa.</help>
</field>
<field>
<id>domain.type</id>
<label>Type</label>
<type>dropdown</type>
<help>Set the type for this domain.</help>
<help>Set the type for this zone.</help>
</field>
<field>
<label>Slave Zone</label>
<type>header</type>
<style>zone_type zone_type_slave</style>
</field>
<field>
<id>domain.masterip</id>
@ -18,63 +29,62 @@
<help>Set the IP address of master server when using slave mode.</help>
</field>
<field>
<id>domain.domainname</id>
<label>Domain Name</label>
<type>text</type>
<help>Set the name for this ACL.</help>
<label>Master Zone</label>
<type>header</type>
<style>zone_type zone_type_master</style>
</field>
<field>
<id>domain.allowtransfer</id>
<label>Allow Transfer</label>
<type>dropdown</type>
<help>Define an ACL where you allow which server can retrieve your zone.</help>
<help>Define an ACL where you allow which server can retrieve this zone.</help>
</field>
<field>
<id>domain.allowquery</id>
<label>Allow Query</label>
<type>dropdown</type>
<help>Define an ACL where you allow which client are allowed to query this domain.</help>
<help>Define an ACL where you allow which client are allowed to query this zone.</help>
</field>
<field>
<id>domain.ttl</id>
<label>TTL</label>
<type>text</type>
<help>Set the general TTL for this domain.</help>
<help>Set the general Time To Live for this zone.</help>
</field>
<field>
<id>domain.refresh</id>
<label>Refresh Time</label>
<type>text</type>
<help>Set the time in seconds.</help>
<help>Set the time in seconds after which name servers should refresh the zone information.</help>
</field>
<field>
<id>domain.retry</id>
<label>Retry Time</label>
<type>text</type>
<help>Set the time in seconds.</help>
<help>Set the time in seconds after which name servers should retry requests if the master does not respond.</help>
</field>
<field>
<id>domain.expire</id>
<label>Expire Time</label>
<type>text</type>
<help>Set the time in seconds.</help>
<help>Set the time in seconds after which name servers should stop answering requests if the master does not respond.</help>
</field>
<field>
<id>domain.negative</id>
<label>Negative TTL</label>
<type>text</type>
<help>Set the time in seconds.</help>
<help>Set the time in seconds after which an entry for a non-existent record should expire from cache.</help>
</field>
<field>
<id>domain.mailadmin</id>
<label>Mail Admin</label>
<type>text</type>
<help>Set the mail address of domain admin. Please replace @ with a dot.</help>
<help>Set the mail address of zone admin. A @-sign will automatically be replaced with a dot in the zone data.</help>
</field>
<field>
<id>domain.dnsserver</id>
<label>DNS Server</label>
<type>text</type>
<help>Set the DNS Server hosting this file. This should be the FQDN of your Firewall.</help>
<help>Set the DNS server hosting this file. This should usually be the FQDN of your firewall where the BIND plugin is installed.</help>
</field>
</form>

View File

@ -3,30 +3,30 @@
<id>record.enabled</id>
<label>Enabled</label>
<type>checkbox</type>
<help>This will enable or disable the ACL.</help>
<help>This will enable or disable this record.</help>
</field>
<field>
<id>record.domain</id>
<label>Domain</label>
<label>Zone</label>
<type>dropdown</type>
<help>Set the type for this record.</help>
<help>Select the zone for this record.</help>
</field>
<field>
<id>record.name</id>
<label>Name</label>
<type>text</type>
<help>Set the name for this ACL.</help>
<help>Set the name for this record.</help>
</field>
<field>
<id>record.type</id>
<label>Type</label>
<type>dropdown</type>
<help>Set the time in seconds.</help>
<help>Set the type for this record.</help>
</field>
<field>
<id>record.value</id>
<label>Value</label>
<type>text</type>
<help>Set the time in seconds.</help>
<help>Set the value for this record.</help>
</field>
</form>

View File

@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE.
<li class="active"><a data-toggle="tab" href="#general">{{ lang._('General') }}</a></li>
<li><a data-toggle="tab" href="#dnsbl">{{ lang._('DNSBL') }}</a></li>
<li><a data-toggle="tab" href="#acls">{{ lang._('ACLs') }}</a></li>
<li><a data-toggle="tab" href="#domains">{{ lang._('Domains') }}</a></li>
<li><a data-toggle="tab" href="#domains">{{ lang._('Zones') }}</a></li>
</ul>
<div class="tab-content content-box tab-content">
@ -91,7 +91,7 @@ POSSIBILITY OF SUCH DAMAGE.
<tr>
<th data-column-id="enabled" data-type="string" data-formatter="rowtoggle">{{ lang._('Enabled') }}</th>
<th data-column-id="type" data-type="string" data-visible="true">{{ lang._('Type') }}</th>
<th data-column-id="domainname" data-type="string" data-visible="true">{{ lang._('Domain') }}</th>
<th data-column-id="domainname" data-type="string" data-visible="true">{{ lang._('Zone') }}</th>
<th data-column-id="ttl" data-type="string" data-visible="true">{{ lang._('TTL') }}</th>
<th data-column-id="refresh" data-type="string" data-visible="true">{{ lang._('Refresh') }}</th>
<th data-column-id="retry" data-type="string" data-visible="true">{{ lang._('Retry') }}</th>
@ -113,12 +113,15 @@ POSSIBILITY OF SUCH DAMAGE.
</tfoot>
</table>
<hr/>
<div class="col-md-12">
<h2>{{ lang._('Records') }}</h2>
</div>
<div id="record-area">
<table id="grid-records" class="table table-responsive" data-editDialog="dialogEditBindRecord">
<thead>
<tr>
<th data-column-id="enabled" data-type="string" data-formatter="rowtoggle">{{ lang._('Enabled') }}</th>
<th data-column-id="domain" data-type="string" data-visible="true">{{ lang._('Domain') }}</th>
<th data-column-id="domain" data-type="string" data-visible="true">{{ lang._('Zone') }}</th>
<th data-column-id="name" data-type="string" data-visible="true">{{ lang._('Name') }}</th>
<th data-column-id="type" data-type="string" data-visible="true">{{ lang._('Type') }}</th>
<th data-column-id="value" data-type="string" data-visible="true">{{ lang._('Value') }}</th>
@ -147,8 +150,8 @@ POSSIBILITY OF SUCH DAMAGE.
</div>
{{ partial("layout_partials/base_dialog",['fields':formDialogEditBindAcl,'id':'dialogEditBindAcl','label':lang._('Edit ACL')])}}
{{ partial("layout_partials/base_dialog",['fields':formDialogEditBindDomain,'id':'dialogEditBindDomain','label':lang._('Edit Domains')])}}
{{ partial("layout_partials/base_dialog",['fields':formDialogEditBindRecord,'id':'dialogEditBindRecord','label':lang._('Edit Records')])}}
{{ partial("layout_partials/base_dialog",['fields':formDialogEditBindDomain,'id':'dialogEditBindDomain','label':lang._('Edit Zone')])}}
{{ partial("layout_partials/base_dialog",['fields':formDialogEditBindRecord,'id':'dialogEditBindRecord','label':lang._('Edit Record')])}}
<script>
$( document ).ready(function() {
@ -262,5 +265,15 @@ $( document ).ready(function() {
$("#saveAct_domain_progress").removeClass("fa fa-spinner fa-pulse");
});
});
// Hide options that are irrelevant in this context.
$('#dialogEditBindDomain').on('shown.bs.modal', function (e) {
$("#domain\\.type").change(function(){
$(".zone_type").hide();
$(".zone_type_"+$(this).val()).show();
});
$("#domain\\.type").change();
})
});
</script>

View File

@ -4,7 +4,7 @@
{% if TARGET_FILTERS['OPNsense.bind.domain.domains.domain.' ~ loop.index0] %}
{% if domaindb.enabled == '1' and domaindb.type == 'master' %}
$TTL {{ domaindb.ttl }}
@ IN SOA {{ domaindb.dnsserver }}. {{ domaindb.mailadmin }}. ( {{ domaindb.serial|trim }} {{ domaindb.refresh }} {{ domaindb.retry }} {{ domaindb.expire }} {{ domaindb.negative }} )
@ IN SOA {{ domaindb.dnsserver }}. {{ domaindb.mailadmin|replace('@', '.') }}. ( {{ domaindb.serial|trim }} {{ domaindb.refresh }} {{ domaindb.retry }} {{ domaindb.expire }} {{ domaindb.negative }} )
{% for record in helpers.sortDictList(OPNsense.bind.record.records.record, 'name', 'type' ) %}
{% if record.domain == domaindb['@uuid'] %}
{{ record.name }} {{ record.type }} {{ record.value }}