parent
5a71d5efde
commit
6b1329eb3c
|
@ -49,10 +49,22 @@ class DomainController
|
||||||
|
|
||||||
$oFile = fopen(filename: $this->localZoneFile, mode: 'w');
|
$oFile = fopen(filename: $this->localZoneFile, mode: 'w');
|
||||||
foreach ($domains as $domain) {
|
foreach ($domains as $domain) {
|
||||||
|
if (!$this->isMasterZone(domain: $domain)) {
|
||||||
fputs(stream: $oFile, data: 'include "' . $this->localZonesDir . $domain->getName() . '";' . PHP_EOL);
|
fputs(stream: $oFile, data: 'include "' . $this->localZonesDir . $domain->getName() . '";' . PHP_EOL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
fclose(stream: $oFile);
|
fclose(stream: $oFile);
|
||||||
|
|
||||||
|
exec(command: '/usr/sbin/named-checkconf', output: $output, result_code: $resultCode);
|
||||||
|
if ($resultCode != 0) {
|
||||||
|
echo 'There was an error:' . PHP_EOL;
|
||||||
|
foreach ($output as $line) {
|
||||||
|
echo $line . PHP_EOL;
|
||||||
|
}
|
||||||
|
echo 'You need to fix the error before the configuration can be activated.' . PHP_EOL;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
exec(command: '/usr/sbin/rndc reload');
|
exec(command: '/usr/sbin/rndc reload');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,12 +130,11 @@ class DomainController
|
||||||
if (in_array(needle: $name, haystack: $members)) {
|
if (in_array(needle: $name, haystack: $members)) {
|
||||||
echo "\t✅ $name" . COLOR_DEFAULT . ' is in group ' . COLOR_YELLOW . 'bind' . PHP_EOL;
|
echo "\t✅ $name" . COLOR_DEFAULT . ' is in group ' . COLOR_YELLOW . 'bind' . PHP_EOL;
|
||||||
} else {
|
} else {
|
||||||
echo "\t❌$name needs to be in group $bindGroup!" . PHP_EOL;
|
echo "\t❌$name needs to be in group " . COLOR_YELLOW . 'bind' . COLOR_DEFAULT . '!' . PHP_EOL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo COLOR_DEFAULT . 'Checking ' . COLOR_YELLOW . $this->localZoneFile . PHP_EOL;
|
echo COLOR_DEFAULT . 'Checking ' . COLOR_YELLOW . $this->localZoneFile . PHP_EOL;
|
||||||
$localZoneFilePermissions = fileperms(filename: $this->localZoneFile);
|
$localZoneFilePermissions = @fileperms(filename: $this->localZoneFile);
|
||||||
if ($localZoneFilePermissions & 0x0010) {
|
if ($localZoneFilePermissions & 0x0010) {
|
||||||
echo COLOR_DEFAULT . "\t✅ Group has write access." . PHP_EOL;
|
echo COLOR_DEFAULT . "\t✅ Group has write access." . PHP_EOL;
|
||||||
} else {
|
} else {
|
||||||
|
@ -142,7 +153,7 @@ class DomainController
|
||||||
}
|
}
|
||||||
|
|
||||||
echo COLOR_DEFAULT . 'Checking directory: ' . COLOR_YELLOW . $this->localZonesDir . PHP_EOL;
|
echo COLOR_DEFAULT . 'Checking directory: ' . COLOR_YELLOW . $this->localZonesDir . PHP_EOL;
|
||||||
$localZoneDirPermissions = fileperms(filename: $this->localZonesDir);
|
$localZoneDirPermissions = @fileperms(filename: $this->localZonesDir);
|
||||||
if ($localZoneDirPermissions & 0x0010) {
|
if ($localZoneDirPermissions & 0x0010) {
|
||||||
echo "\t✅ Group has write access." . PHP_EOL;
|
echo "\t✅ Group has write access." . PHP_EOL;
|
||||||
} else {
|
} else {
|
||||||
|
@ -199,9 +210,8 @@ class DomainController
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if we're a master zone
|
// check if we're a master zone
|
||||||
$keyhelpConf = file_get_contents(filename: $this->keyhelpNamedCond);
|
if ($this->isMasterZone($domain->getName())) {
|
||||||
if (str_contains(haystack: $keyhelpConf, needle: $domain->getName())) {
|
echo 'We are zone master for ' . $domain->getName() . PHP_EOL;
|
||||||
echo 'We a zone master for ' . $domain->getName() . PHP_EOL;
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue