Fixes #441: Correct DMARC entry syntax

This commit is contained in:
Kienan Stewart 2020-11-13 14:51:48 -05:00 committed by Benjamin Sonntag
parent 7e02128159
commit 2e1fbd374d
2 changed files with 6 additions and 6 deletions

View File

@ -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));
}

View File

@ -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'