how to build a white list?

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
middle6
Posts: 26
Joined: Fri Sep 12, 2014 11:20 pm

how to build a white list?

Postby middle6 » Wed Feb 20, 2008 1:57 am

I have a email :middle6@sina.com.I use it send email to my zimbra mailbox.
then I'll find middle6@sina.com's email go to my zimbra junk mailbox.
As a zimbra admin, How to build a white list ?or how to copy the filter rule to everyone?


mmorse
Ambassador
Ambassador
Posts: 6036
Joined: Fri Sep 12, 2014 10:24 pm

how to build a white list?

Postby mmorse » Wed Feb 20, 2008 5:34 pm

You have several options depending if you want to do it globally or individually - I'll discuss a few below:
Global hard-lists:

To add blackist or whitelist entries to your /opt/zimbra/conf/salocal.cf.in file, simply add lines in the following format:

[quote] blacklist_from someone@bad.com

whitelist_from someone@good.com

blacklist_from *@realybad.com[/quote]Note that * is a wildcard so in this example *@reallybad.com indicates all email from any user at reallybad.com.
When you are finished editing the salocal.cf.in file, restart Zimbra's spamassassin by issuing the following command at the server prompt (as the zimbra user):

zmamavisdctl restart



Global & personal soft-lists:


Soft lists just add or subtract values to the total score, they don't just allow or block, it's like giving certain accounts or regex's a little help towards one direction in scoring. Checkout your /opt/zimbra/conf/amavis.conf.in file, you should see a section like:

[quote]

# ENVELOPE SENDER SOFT-WHITELISTING / SOFT-BLACKLISTING
@score_sender_maps = ({ # a by-recipient hash lookup table,

# results from all matching recipient tables are summed
# ## per-recipient personal tables (NOTE: positive: black, negative: white)

# 'user1@example.com' => [{'bla-mobile.press@bad.com' => 10.0}],

# 'user3@example.com' => [{'.good.com' => -3.0}],

# '.angel.com' => -5.0}],
## site-wide opinions about senders (the '.' matches any recipient)

'.' => [ # the _first_ matching sender determines the score boost
new_RE( # regexp-type lookup table, just happens to be all soft-blacklist

[qr'^(bulkmail|offers|cheapbenefits|earnmoney|foryou)@'i => 5.0],

[qr'^(greatcasino|investments|lose_weight_today|market.alert)@'i=> 5.0],

),
# read_hash("/var/amavis/sender_scores_sitewide"),
{ # a hash-type lookup table (associative array)

'nobody@cert.org' => -3.0,

'cert-advisory@us-cert.gov' => -3.0,

'owner-alert@iss.net' => -3.0,

'securityfocus.com' => -3.0,

'ntbugtraq@listserv.ntbugtraq.com' => -3.0,

'security-alerts@linuxsecurity.com' => -3.0,

'mailman-announce-admin@python.org' => -3.0,

'amavis-user-admin@lists.sourceforge.net'=> -3.0,

'amavis-user-bounces@lists.sourceforge.net' => -3.0,

'spamassassin.apache.org' => -3.0,

'owner-postfix-announce@postfix.org' => -3.0,

'sendmail-announce-request@lists.sendmail.org' => -3.0,

'donotreply@sendmail.org' => -3.0,

lc('lvs-users-admin@LinuxVirtualServer.org') => -3.0,

lc('owner-textbreakingnews@CNNIMAIL12.CNN.COM') => -5.0,
# soft-blacklisting (positive score)

'sender@example.net' => 3.0,

'.example.net' => 1.0,

[/quote]Personal hard-list:

[quote]zmprov ma user@domain.com +amavisWhiteListSender name1@example.com +amavisWhiteListSender name2@example2.com[/quote]To put that in the UI is: Bug">http://bugzilla.zimbra.com/show_bug.cgi?id=6953>Bug 6953 - Per user spam white lists in the UI

(opposite is amavisBlackListSender



Personal mail-filter methods:


1) Preferences> mailfilters > make one with the action discard or move to junk (the users can do this one)

2) zmmailbox:

[quote]addFilterRule(afrl) [opts] {name} [*active|inactive] [any|*all] {conditions}+ {actions}+

-f/--first add as first filter rule

-b/--before add before filter-name

-a/--after add after filter-name

-l/--last add as last filter rule
deleteFilterRule(dfrl) {name}
getFilterRules(gfrl)
modifyFilterRule(mfrl) {name} [*active|inactive] [any|*all] {conditions}+ {actions}+
{conditions}:

header "name" is|not_is|contains|not_contains|matches|not_matches "value"

header "name" exists|not_exists

date before|not_before|after|not_after "YYYYMMDD"

size under|not_under|over|not_over "1|1K|1M"

body contains|not_contains "text"

addressbook in|not_in "header-name"

attachment exists|not_exists
{actions}:

keep

discard

fileinto "/path"

tag "/tag"

mark read|flagged

redirect "address"

stop[/quote]Like:[quote]zmmailbox -z -m user@domain.com addFilterRule "tag special" active any header "subject" contains "special" tag "special" discard[/quote]3) zmprov:

[quote]zmprov modifyAccount user@domain.com zimbraMailSieveScript 'require ["fileinto", "reject", "tag", "flag>

[/quote]Note that the personal filters method would only be useful for unwanted unless you change the behavior:

In ZCS 5.0.1 and earlier, user filters were run before the spam filter check was run. This meant that if the user filtered mail into a folder, spam would not be identified and sent to the Junk folder.

Beginning with 5.0.2, spam check is completed first and messages identified as spam are moved to the Junk folder. With this change, users cannot write a filter to move false positive spam out of the Junk folder.
If you prefer ZCS 5.0.2+ to use the spam filter function as it works for 5.0.1 and earlier, you can set the zimbraSpamApplyUserFilters option to True.

This can be done by COS:

zmprov mc COSname zimbraSpamApplyUserFilters TRUE

or for individual accounts:

zmprov ma user@domain.com zimbraSpamApplyUserFilters TRUE
brained
Advanced member
Advanced member
Posts: 91
Joined: Fri Sep 12, 2014 10:01 pm

how to build a white list?

Postby brained » Wed Feb 20, 2008 6:52 pm

#!/bin/bash

ACC=`/opt/zimbra/bin/zmprov gaa`

for i in $ACC

do

/opt/zimbra/bin/zmmailbox -z -m $i gact | grep -u email: | sort | uniq | sed -e 's/email:/whitelist_from/g' >> /tmp/autowhitelistall.tmp

done

sed -i '/clean-wire.net/d' /tmp/autowhitelistall.tmp

sed -i '/chromedcomputing.com/d' /tmp/autowhitelistall.tmp

... Repeat for each domain on the Zimbra server ...

cat /tmp/autowhitelistall.tmp | sort | uniq > /opt/zimbra/conf/spamassassin/autowhitelistall.cf

rm -f /tmp/autowhitelistall.tmp

/opt/zimbra/bin/zmamavisdctl restart


It's ugly but does the job and it's easy for end users to understand that addressbook = whitelist.
Russianspi
Advanced member
Advanced member
Posts: 84
Joined: Fri Sep 12, 2014 10:43 pm

how to build a white list?

Postby Russianspi » Thu Aug 28, 2008 11:13 am

Brian: does this still work? It looks like a neat solution, and I would love to be able to tell my users that they can just add someone to their address book to keep them out of the Spam folder. Also, how/how often do you run it (nightly cronjob, etc?)
kej263
Posts: 6
Joined: Fri Sep 12, 2014 10:39 pm

how to build a white list?

Postby kej263 » Fri Oct 24, 2008 3:30 pm

works for me on 5.0.10
Russianspi
Advanced member
Advanced member
Posts: 84
Joined: Fri Sep 12, 2014 10:43 pm

how to build a white list?

Postby Russianspi » Mon Oct 27, 2008 9:23 am

Thanks. I'll give it a try.

Return to “Administrators”

Who is online

Users browsing this forum: Baidu [Spider] and 17 guests