Add DHCP Dynamic DNS key algorithm drop-down list (#2651)

This commit is contained in:
Ingo Theiss 2018-08-21 20:06:33 +02:00 committed by Ad Schellevis
parent bf0b3f1acc
commit 55f05950b5
2 changed files with 17 additions and 2 deletions

View File

@ -950,6 +950,7 @@ EOD;
$newzone['dns-servers'] = array($dhcpifconf['ddnsdomainprimary']);
$newzone['ddnsdomainkeyname'] = $dhcpifconf['ddnsdomainkeyname'];
$newzone['ddnsdomainkey'] = $dhcpifconf['ddnsdomainkey'];
$newzone['ddnsdomainalgorithm'] = !empty($dhcpifconf['ddnsdomainalgorithm']) ? $dhcpifconf['ddnsdomainalgorithm'] : "hmac-md5";
$ddns_zones[] = $newzone;
}
}
@ -1012,7 +1013,7 @@ function services_dhcpd_zones($ddns_zones)
if (!empty($zone['ddnsdomainkeyname']) && !empty($zone['ddnsdomainkey'])) {
if (!in_array($zone['ddnsdomainkeyname'], $added_keys)) {
$dhcpdconf .= "key {$zone['ddnsdomainkeyname']} {\n";
$dhcpdconf .= " algorithm hmac-md5;\n";
$dhcpdconf .= " algorithm {$zone['ddnsdomainalgorithm']};\n";
$dhcpdconf .= " secret {$zone['ddnsdomainkey']};\n";
$dhcpdconf .= "}\n";
$added_keys[] = $zone['ddnsdomainkeyname'];

View File

@ -96,7 +96,7 @@ function reconfigure_dhcpd()
$config_copy_fieldsnames = array('enable', 'staticarp', 'failover_peerip', 'dhcpleaseinlocaltime','descr',
'defaultleasetime', 'maxleasetime', 'gateway', 'domain', 'domainsearchlist', 'denyunknown', 'ddnsdomain',
'ddnsdomainprimary', 'ddnsdomainkeyname', 'ddnsdomainkey', 'ddnsupdate', 'mac_allow', 'mac_deny', 'tftp', 'ldap',
'ddnsdomainprimary', 'ddnsdomainkeyname', 'ddnsdomainkey', 'ddnsdomainalgorithm', 'ddnsupdate', 'mac_allow', 'mac_deny', 'tftp', 'ldap',
'netboot', 'nextserver', 'filename', 'filename32', 'filename64', 'rootpath', 'netmask', 'numberoptions',
'interface_mtu', 'wpad');
@ -885,6 +885,20 @@ include("head.inc");
<input name="ddnsdomainkeyname" type="text" value="<?=$pconfig['ddnsdomainkeyname'];?>" />
<?=gettext("Enter the dynamic DNS domain key secret which will be used to register client names in the DNS server.");?>
<input name="ddnsdomainkey" type="text" value="<?=$pconfig['ddnsdomainkey'];?>" />
<?=gettext("Choose the dynamic DNS domain key algorithm.");?><br />
<select name='ddnsdomainalgorithm' id="ddnsdomainalgorithm" class="selectpicker">
<?php
foreach (array("hmac-md5", "hmac-sha512") as $algorithm) :
$selected = "";
if (! empty($pconfig['ddnsdomainalgorithm'])) {
if ($pconfig['ddnsdomainalgorithm'] == $algorithm) {
$selected = "selected=\"selected\"";
}
}?>
<option value="<?=$algorithm;?>" <?=$selected;?>><?=$algorithm;?></option>
<?php
endforeach; ?>
</select>
</div>
</td>
</tr>