From 04f4fce67cd0a7436ab963e62d39d0371ea96626 Mon Sep 17 00:00:00 2001 From: Matthew Saunders Brown Date: Tue, 13 Feb 2024 14:35:27 -0800 Subject: [PATCH] add dmarc dns check --- panel/classes/Panel/Vmail/Domains.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/panel/classes/Panel/Vmail/Domains.php b/panel/classes/Panel/Vmail/Domains.php index 96275b6..14b72bc 100644 --- a/panel/classes/Panel/Vmail/Domains.php +++ b/panel/classes/Panel/Vmail/Domains.php @@ -104,7 +104,22 @@ class Domains extends \Panel\Vmail { $dnsinfo['dkim']['status'] = "Create"; } - if ($dnsinfo['verified_count'] == 4) { + # DMARC (TXT) record + $dnsinfo['dmarc']['status'] = "Create"; + $dnsinfo['dmarc']['color'] = "red"; + 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"; + $dnsinfo['dmarc']['color'] = "black"; + $dnsinfo['verified_count']++; + } else { + $dnsinfo['dmarc']['status'] = "Update"; + } + } + } + + if ($dnsinfo['verified_count'] == 5) { $dnsinfo['status'] = 'Verified'; } else { $dnsinfo['status'] = 'Update';