Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mimedefang
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
certo
mimedefang
Commits
3f74755b
Commit
3f74755b
authored
Jan 31, 2021
by
Vladimir Bashkirtsev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
We should add X-Spam-Flag if Spamassassin detected spam; we should check messages up to 1MB
parent
3af6d80c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
19 deletions
+9
-19
mimedefang-filter
mimedefang-filter
+9
-19
No files found.
mimedefang-filter
View file @
3f74755b
...
@@ -265,32 +265,22 @@ sub filter_end {
...
@@ -265,32 +265,22 @@ sub filter_end {
# Spam checks if SpamAssassin is installed
# Spam checks if SpamAssassin is installed
if ($Features{"SpamAssassin"}) {
if ($Features{"SpamAssassin"}) {
if (-s "./INPUTMSG" < 10
0
*1024) {
if (-s "./INPUTMSG" < 10
24
*1024) {
# Only scan messages smaller than 1
00k
B. Larger messages
# Only scan messages smaller than 1
M
B. Larger messages
# are extremely unlikely to be spam, and SpamAssassin is
# are extremely unlikely to be spam, and SpamAssassin is
# dreadfully slow on very large messages.
# dreadfully slow on very large messages.
my($hits, $req, $names, $report) = spam_assassin_check();
my($hits, $req, $names, $report) = spam_assassin_check();
my($score);
if ($hits < 40) {
$score = "*" x int($hits);
} else {
$score = "*" x 40;
}
# We add a header which looks like this:
# We add a header which looks like this:
# X-Spam-Score: 6.8 (******) NAME_OF_TEST,NAME_OF_TEST
# X-Spam-Flag: Yes
# The number of asterisks in parens is the integer part
# X-Spam-Score: 6.8 NAME_OF_TEST,NAME_OF_TEST
# of the spam score clamped to a maximum of 40.
# MUA filters can easily be written to trigger on a
# minimum number of asterisks...
if ($hits >= $req) {
if ($hits >= $req) {
action_change_header("X-Spam-Score", "$hits ($score) $names");
action_change_header("X-Spam-Flag", "Yes");
action_change_header("X-Spam-Score", "$hits $names");
md_graphdefang_log('spam', $hits, $RelayAddr);
md_graphdefang_log('spam', $hits, $RelayAddr);
# If you find the SA report useful, add it, I guess...
action_add_part($entity, "text/plain", "-suggest",
"$report\n",
"SpamAssassinReport.txt", "inline");
} else {
} else {
# Delete any existing X-Spam-Flag header?
action_delete_header("X-Spam-Flag");
# Delete any existing X-Spam-Score header?
# Delete any existing X-Spam-Score header?
action_delete_header("X-Spam-Score");
action_delete_header("X-Spam-Score");
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment