|
|
@@ -86,10 +86,18 @@ class DnsHelper
|
|
|
return $vars;
|
|
|
}
|
|
|
|
|
|
- public function getTxtRecords($domain)
|
|
|
+ public function getRecords($domain) {
|
|
|
+ $zoneID = $this->selfDns($domain);
|
|
|
+ if($zoneID) {
|
|
|
+ return $this->getLocalRecords($zoneID);
|
|
|
+ }
|
|
|
+ return $this->getResolverRecords($domain);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getResolverRecords($domain)
|
|
|
{
|
|
|
try {
|
|
|
- $result = $this->resolver->query($domain, 'TXT');
|
|
|
+ $result = $this->resolver->query($domain);
|
|
|
|
|
|
} catch(\Net_DNS2_Exception $e) {
|
|
|
|
|
|
@@ -97,6 +105,14 @@ class DnsHelper
|
|
|
}
|
|
|
$domainTXT = $result->answer;
|
|
|
|
|
|
+ logModuleCall(
|
|
|
+ 'kerioEmail',
|
|
|
+ __FUNCTION__,
|
|
|
+ $domain,
|
|
|
+ 'DEbug',
|
|
|
+ $domainTXT
|
|
|
+ );
|
|
|
+
|
|
|
$domainSPF = array();
|
|
|
$domainDMARC = array();
|
|
|
$domainDKIM = array();
|
|
|
@@ -179,11 +195,20 @@ class DnsHelper
|
|
|
return $zoneIDobj->{'id'};
|
|
|
}
|
|
|
|
|
|
- public function getZone($zoneID) {
|
|
|
+ public function getLocalRecords($zoneID) {
|
|
|
$dnsZone = localAPI('dnsmanager', array( 'dnsaction' => 'getZone', 'zone_id' => $zoneID));
|
|
|
if($dnsZone['result'] != 'success') {
|
|
|
return 'Error: cloud not fetch zone for ID ' . $zoneID;
|
|
|
}
|
|
|
+
|
|
|
+ logModuleCall(
|
|
|
+ 'kerioEmail',
|
|
|
+ __FUNCTION__,
|
|
|
+ $zoneID,
|
|
|
+ 'DEbug',
|
|
|
+ $dnsZone
|
|
|
+ );
|
|
|
+
|
|
|
$zoneRecords = array();
|
|
|
foreach($dnsZone['data']->records as $record) {
|
|
|
if(in_array($record->type, ['MX', 'TXT'])){
|