Wed, April 14, 2021
 
https://devcodepro.comdevcodepro
Home · Latest · Trends  /  Plain Text
35

CentOS - SpamAssassin and Exim

Install SpamAssassin and Exim on a CentOS

1. Install Spamassassin [SSH]:

sudo yum install spamassassin

2. Create file filters in /etc/exim/ folder with code:

if $h_X-Spam-Flag: contains "YES" then headers add "Old-Subject: $h_subject" headers remove "Subject" headers add "Subject: ***[SPAM]*** $h_old-subject" headers remove "Old-Subject" endif

3. In etc/exim/exim.conf after this line:

# $Cambridge: exim/exim-src/src/configure.default,v 1.14 2009/10/16 07:46:13 tom Exp $
put this line:
system_filter = /etc/exim/filters

4. In etc/exim/exim.conf replace:

#spamd_address = 127.0.0.1 783
with:
spamd_address = 127.0.0.1 783

5. In etc/exim/exim.conf replace:

# Bypass SpamAssassin checks if the message is too large. # #accept condition = ${if >={$message_size}{100000} {1}} #add_header = X-Spam-Note: SpamAssassin run bypassed due to message size # Run SpamAssassin, but allow for it to fail or time out. Add a warning message # and accept the mail if that happens. Add an X-Spam-Flag: header if the SA # score exceeds the SA system threshold. # #warn spam = nobody/defer_ok #add_header = X-Spam-Flag: YES #add_header = X-Spam-Subject: [SPAM] $h_Subject #accept condition = ${if !def:spam_score_int {1}} #add_header = X-Spam-Note: SpamAssassin invocation failed # Unconditionally add score and report headers # #warn add_header = X-Spam-Score: $spam_score ($spam_bar)n #X-Spam-Report: $spam_report
with:
# Bypass SpamAssassin checks if the message is too large. # # accept condition = ${if >={$message_size}{100000} {1}} # add_header = X-Spam-Note: SpamAssassin run bypassed due to message size # Run SpamAssassin, but allow for it to fail or time out. Add a warning message # and accept the mail if that happens. Add an X-Spam-Flag: header if the SA # score exceeds the SA system threshold. # warn spam = nobody/defer_ok add_header = X-Spam-Flag: YES # accept condition = ${if !def:spam_score_int {1}} add_header = X-Spam-Note: SpamAssassin invocation failed # # Unconditionally add score and report headers # warn add_header = X-Spam-Report: $spam_report

6. Check this code exist in /etc/mail/spamassassin/local.cf

# These values can be overridden by editing ~/.spamassassin/user_prefs.cf # (see spamassassin(1) for details) # These should be safe assumptions and allow for simple visual sifting # without risking lost emails. required_hits 5 report_safe 0 rewrite_header Subject [SPAM] required_score 1.3

7. Restart Spamassassin [SSH]:

/etc/init.d/spamassassin restart

8. Restart Exim [SSH]:

service exim restart
rated 35 times (35) (0)
comments: 0 / hits: 4880  / 5 years ago, thu, sep 8, 16, 03:04:22
More From » Plain Text
 

Comments

There are no comments for this Snippet yet
Only authorized users can post. Please sign in first, or register a free account
 
Share
Posted
paki
Member since Sep 7, 2016
Total Code Snippets: 12
Total Comments: 0
Location: n/a
paki snippets
4 years ago, wed, dec 28, 16, 4:11:52
comments: 2 / hits: 3489
4 years ago, tue, jan 3, 17, 3:37:12
comments: 0 / hits: 2191
4 years ago, thu, jan 19, 17, 5:40:32
comments: 0 / hits: 4208
4 years ago, sat, jun 10, 17, 3:16:28
comments: 0 / hits: 2140
4 years ago, mon, jun 26, 17, 9:21:15
comments: 0 / hits: 3076
4 years ago, sat, sep 2, 17, 4:26:09
comments: 1 / hits: 2243
3 years ago, tue, feb 27, 18, 9:25:15
comments: 0 / hits: 1519
3 years ago, tue, feb 27, 18, 9:41:12
comments: 0 / hits: 1618
3 years ago, wed, feb 28, 18, 11:02:34
comments: 0 / hits: 1663