From 5c29b0b1e41d341967eabe72b00a4e941622ef68 Mon Sep 17 00:00:00 2001 From: Matthew Saunders Brown Date: Tue, 9 Apr 2024 10:22:58 -0700 Subject: [PATCH] suppress errors for all dns_get_record calls --- panel/classes/Panel/Cert/CertsAdd.php | 2 +- panel/classes/Panel/Vhost/Vhosts.php | 2 +- panel/classes/Panel/Vmail/Dkim.php | 2 +- panel/classes/Panel/Vmail/Domains.php | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/panel/classes/Panel/Cert/CertsAdd.php b/panel/classes/Panel/Cert/CertsAdd.php index e415536..7275167 100644 --- a/panel/classes/Panel/Cert/CertsAdd.php +++ b/panel/classes/Panel/Cert/CertsAdd.php @@ -22,7 +22,7 @@ class CertsAdd extends \Panel\Cert { if ($f3->exists('PARAMS.cert')) { $domain = $f3->get('PARAMS.cert'); if ($f3->call('\Panel::validateDomain', $domain)) { - if ($certdomain_dns = dns_get_record("$domain", DNS_A)) { + if ($certdomain_dns = @dns_get_record("$domain", DNS_A)) { if ($certdomain_dns[0]['ip'] == $_SERVER['SERVER_ADDR']) { if (is_dir('/var/tmp/letsencrypt/')) { if (is_writable('/var/tmp/letsencrypt/')) { diff --git a/panel/classes/Panel/Vhost/Vhosts.php b/panel/classes/Panel/Vhost/Vhosts.php index 189acc8..e208beb 100644 --- a/panel/classes/Panel/Vhost/Vhosts.php +++ b/panel/classes/Panel/Vhost/Vhosts.php @@ -43,7 +43,7 @@ class Vhosts extends \Panel\Vhost { $dnsinfo['server_addr'] = $_SERVER['SERVER_ADDR']; # A record $dnsinfo['a']['color'] = "red"; - if ($certdomain_dns = dns_get_record("$vhost", DNS_A)) { + if ($certdomain_dns = @dns_get_record("$vhost", DNS_A)) { if ($certdomain_dns[0]['ip'] == $dnsinfo['server_addr']) { $dnsinfo['a']['status'] = "Verified"; $dnsinfo['a']['color'] = "black"; diff --git a/panel/classes/Panel/Vmail/Dkim.php b/panel/classes/Panel/Vmail/Dkim.php index 2c43caf..6010128 100644 --- a/panel/classes/Panel/Vmail/Dkim.php +++ b/panel/classes/Panel/Vmail/Dkim.php @@ -23,7 +23,7 @@ class Dkim extends \Panel\Vmail { if ($dkim_array = $f3->call('\Panel::vGet', array("vmail-dkim-get.sh -d $domain -c", FALSE))) { $dkim_array = $dkim_array[0]; $dkim_array['dns']['host'] = $dkim_array['selector'] . "._domainkey.$domain"; - if ($dns_txt_records = dns_get_record($dkim_array['dns']['host'], DNS_TXT)) { + if ($dns_txt_records = @dns_get_record($dkim_array['dns']['host'], DNS_TXT)) { $dkim_array['dns']['status'] = "Verified"; } else { $dkim_array['dns']['status'] = "Update"; diff --git a/panel/classes/Panel/Vmail/Domains.php b/panel/classes/Panel/Vmail/Domains.php index 14b72bc..ef868d7 100644 --- a/panel/classes/Panel/Vmail/Domains.php +++ b/panel/classes/Panel/Vmail/Domains.php @@ -44,7 +44,7 @@ class Domains extends \Panel\Vmail { $dnsinfo['server_addr'] = $_SERVER['SERVER_ADDR']; # A record $dnsinfo['a']['color'] = "red"; - if ($certdomain_dns = dns_get_record("$mxdomain", DNS_A)) { + if ($certdomain_dns = @dns_get_record("$mxdomain", DNS_A)) { if ($certdomain_dns[0]['ip'] == $dnsinfo['server_addr']) { $dnsinfo['a']['status'] = "Verified"; $dnsinfo['a']['color'] = "black"; @@ -71,7 +71,7 @@ class Domains extends \Panel\Vmail { # SPF (TXT) record $dnsinfo['spf']['status'] = "Create"; $dnsinfo['spf']['color'] = "red"; - if ($dns_txt_records = dns_get_record("$domain", DNS_TXT)) { + if ($dns_txt_records = @dns_get_record("$domain", DNS_TXT)) { foreach ($dns_txt_records as $k=>$dns_txt_record) { if (str_starts_with($dns_txt_record['txt'], 'v=spf1')) { $dnsinfo['spf']['status'] = "Update"; @@ -88,7 +88,7 @@ class Domains extends \Panel\Vmail { if ($f3->call('\Panel::verifyDkimExists', $domain)) { if ($dkim_array = $f3->call('\Panel::vGet', array("vmail-dkim-get.sh -d $domain -c", FALSE))) { $dkim_hostname = $dkim_array[0]['selector'] . "._domainkey.$domain"; - if ($dns_txt_records = dns_get_record($dkim_hostname, DNS_TXT)) { + if ($dns_txt_records = @dns_get_record($dkim_hostname, DNS_TXT)) { $dnsinfo['dkim']['status'] = "Verified"; $dnsinfo['dkim']['color'] = "black"; $dnsinfo['verified_count']++; @@ -107,7 +107,7 @@ class Domains extends \Panel\Vmail { # DMARC (TXT) record $dnsinfo['dmarc']['status'] = "Create"; $dnsinfo['dmarc']['color'] = "red"; - if ($dns_txt_records = dns_get_record("_dmarc.$domain", DNS_TXT)) { + if ($dns_txt_records = @dns_get_record("_dmarc.$domain", DNS_TXT)) { foreach ($dns_txt_records as $k=>$dns_txt_record) { if (str_starts_with($dns_txt_record['txt'], 'v=DMARC1')) { $dnsinfo['dmarc']['status'] = "Verified"; @@ -148,7 +148,7 @@ class Domains extends \Panel\Vmail { // dns_dkim // # domain does not have cert yet, check DNS // $dns_a_record = $_SERVER['SERVER_ADDR']; - // if ($certdomain_dns = dns_get_record("$certdomain", DNS_A)) { + // if ($certdomain_dns = @dns_get_record("$certdomain", DNS_A)) { // if ($certdomain_dns[0]['ip'] == $dns_a_record) { // $dns_status = "ready"; // } else {