MailWatch icon indicating copy to clipboard operation
MailWatch copied to clipboard

domain-admin and SQLSpamSettings.pm

Open stefaweb opened this issue 4 years ago • 5 comments

Hi!

I discovered that domain-admin specific spam score is not working in SQLSpamSettings.pm.

May be, I 'm not well using the feature.

In the code we have in the LookupScoreList function:

return $LowHigh->{$to} if $LowHigh->{$to};
return $LowHigh->{$todomain} if $LowHigh->{$todomain};
return $LowHigh->{"admin"} if $LowHigh->{"admin"};

If in the table users we have the user [email protected] ($to) and the default "admin" user, it's working and the code use the specific low/high score.

But for [email protected], it's not working as the code is looking for only the domain part.

I can create a user called domain.tld in the database (but only as "Administrator"). With an administrator domain.tld user, the code use the $todomain and works with a specific low/high score for all email from this domain.

The problem is that this administrator is not an "Domain administrator" and can see all mails, not only it how domain mails.

It will be better to look for [email protected] as a regular domain admin user.

Cheers,

stefaweb avatar Jul 05 '21 09:07 stefaweb

Again me.

I tried with:

$todomain = 'domain-admin@' . $todomain[0];

And it work fine.

stefaweb avatar Jul 05 '21 09:07 stefaweb

Commit: https://github.com/mailwatch/MailWatch/commit/dc0fb32358cf649d4b021a4918b59f928b85b11f

stefaweb avatar Jul 05 '21 10:07 stefaweb

This would break the settings for normal users. Wouldn't it be better to change it here instead?

    return $LowHigh->{$to} if $LowHigh->{$to}; //check user setting
    return $LowHigh->{$todomain} if $LowHigh->{$todomain}; //check "legacy" domain setting
    return $LowHigh->{'admin@' . $todomain} if $LowHigh->{'admin@' . $todomain} //check new domain setting (in user account admin@<domain.tld>
    return $LowHigh->{"admin"} if $LowHigh->{"admin"}; //check global admin

Skywalker-11 avatar Jul 06 '21 08:07 Skywalker-11

Hi!

What is a "legacy domain setting"?

In the online doc in MailWatch.org, "domain-admin@<domain.tld>" is used instead of "admin@<domain.tld>".

More mods car be done and the default setup for "domain-admin" migrated in MailWatchConf.pm.

stefaweb avatar Jul 06 '21 09:07 stefaweb

I updated the commit: https://github.com/mailwatch/MailWatch/commit/c1070d421c7e1822bbcae927f513e9c670eee62d

Sorry, I completely broke my git config and the commit went straight to the source.

stefaweb avatar Jul 06 '21 10:07 stefaweb