From 2e1fbd374ded3269831ba2402cd2a2339ac6c531 Mon Sep 17 00:00:00 2001 From: Kienan Stewart Date: Fri, 13 Nov 2020 14:51:48 -0500 Subject: [PATCH] Fixes #441: Correct DMARC entry syntax --- bureau/class/m_mail.php | 8 ++++---- install/variables.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bureau/class/m_mail.php b/bureau/class/m_mail.php index bb5aee2a..6e8c8baf 100644 --- a/bureau/class/m_mail.php +++ b/bureau/class/m_mail.php @@ -1105,14 +1105,14 @@ ORDER BY $dmarc = str_replace("%%USERMAIL%%", $login . "@" . $L_FQDN, $dmarc); // Search for the record in sub_domaines table - $db->query("SELECT * FROM sub_domaines WHERE compte= ? AND domaine= ? AND sub='_dmarc' AND type='txt' AND valeur LIKE 'v=dmarc1;%' AND web_action!='DELETE';", array($uid, $domain)); + $db->query("SELECT * FROM sub_domaines WHERE compte= ? AND domaine= ? AND sub='_dmarc' AND type='txt' AND valeur LIKE lower('v=DMARC1;%') AND web_action!='DELETE';", array($uid, $domain)); if ($db->next_record()) { - if ($previous !== -1 && $db->Record["valeur"] == "v=dmarc1;" . $dmarc) { + if ($previous !== -1 && $db->Record["valeur"] == "v=DMARC1;" . $dmarc) { return; // skip, no change asked. } $db->query("UPDATE sub_domaines SET web_action='DELETE' WHERE id= ?;", array($db->Record["id"])); } - $db->query("INSERT INTO sub_domaines SET compte= ?, domaine= ?, sub='_dmarc', type='txt', valeur= ?, web_action='UPDATE';", array($uid, $domain, "v=dmarc1;" . $dmarc)); + $db->query("INSERT INTO sub_domaines SET compte= ?, domaine= ?, sub='_dmarc', type='txt', valeur= ?, web_action='UPDATE';", array($uid, $domain, "v=DMARC1;" . $dmarc)); $db->query("UPDATE domaines SET dns_action='UPDATE' WHERE domaine= ?;", array($domain)); } @@ -1124,7 +1124,7 @@ ORDER BY */ function del_dns_dmarc($domain) { global $db; - $db->query("UPDATE sub_domaines SET web_action='DELETE' WHERE domaine= ? AND type='txt' AND sub='' AND valeur LIKE 'v=dmarc1 %';", array($domain)); + $db->query("UPDATE sub_domaines SET web_action='DELETE' WHERE domaine= ? AND type='txt' AND sub='_dmarc' AND valeur LIKE lower('v=DMARC1;%');", array($domain)); } diff --git a/install/variables.php b/install/variables.php index f07cf92f..2d161e64 100644 --- a/install/variables.php +++ b/install/variables.php @@ -12,6 +12,6 @@ require("/usr/share/alternc/panel/class/config_nochk.php"); variable_set('default_spf_value','a mx ?all', 'This variable (if set) tells the SPF/TXT DNS field that will be published as a SPF entry, telling which server(s) are allowed to send email for this one. You can still change it later in the advanced DNS entries for ONE domain, this entry is only set once for new domains (or when you change it here).'); -variable_set('default_dmarc_value', 'p=none;pct=100;rua=%%ADMINMAIL%%;aspf=r;adkim=r', 'This variable (if set) tells the DMARC/TXT DNS field that will be published as a DMARC entry, telling which policy you apply to this domain name. You can still change it later in the advanced DNS entries for ONE domain, this entry is only set once for new domains (or when you change it here). You can use %%ADMINMAIL%% or %%USERMAIL%% to substitute to admin-account or alternc user-account email address.'); -// strict dmarc would be 'p=reject;pct=100;rua=%%ADMINMAIL%%;aspf=s;adkim=s' +variable_set('default_dmarc_value', 'p=none;pct=100;rua=mailto:%%ADMINMAIL%%;aspf=r;adkim=r', 'This variable (if set) tells the DMARC/TXT DNS field that will be published as a DMARC entry, telling which policy you apply to this domain name. You can still change it later in the advanced DNS entries for ONE domain, this entry is only set once for new domains (or when you change it here). You can use %%ADMINMAIL%% or %%USERMAIL%% to substitute to admin-account or alternc user-account email address.'); +// strict dmarc would be 'p=reject;pct=100;rua=mailto:%%ADMINMAIL%%;aspf=s;adkim=s'