add dmarc dns check

This commit is contained in:
Matthew Saunders Brown 2024-02-13 14:35:27 -08:00
parent 48830851b8
commit 04f4fce67c

View File

@ -104,7 +104,22 @@ class Domains extends \Panel\Vmail {
$dnsinfo['dkim']['status'] = "Create"; $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'; $dnsinfo['status'] = 'Verified';
} else { } else {
$dnsinfo['status'] = 'Update'; $dnsinfo['status'] = 'Update';