forked from haraka/Haraka
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b32ae4
commit 1701e74
Showing
5 changed files
with
142 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
loadplugin Mail::SpamAssassin::Plugin::Haraka Haraka.pm | ||
|
||
ifplugin Mail::SpamAssassin::Plugin::Haraka | ||
header __HARAKA eval:get_haraka_uuid() | ||
endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package Mail::SpamAssassin::Plugin::Haraka; | ||
my $VERSION = 0.1; | ||
|
||
use warnings; | ||
use strict; | ||
use Mail::SpamAssassin::Plugin; | ||
use vars qw(@ISA); | ||
@ISA = qw(Mail::SpamAssassin::Plugin); | ||
|
||
sub dbg { | ||
Mail::SpamAssassin::Plugin::dbg ("Haraka: @_"); | ||
} | ||
|
||
sub new { | ||
my ($class, $mailsa) = @_; | ||
$class = ref($class) || $class; | ||
my $self = $class->SUPER::new($mailsa); | ||
bless ($self, $class); | ||
$self->register_eval_rule("get_haraka_uuid"); | ||
} | ||
|
||
sub get_haraka_uuid { | ||
my ($self, $pms) = @_; | ||
|
||
# Add last external IP | ||
my $le = $pms->get_tag('LASTEXTERNALIP'); | ||
if(defined($le) && $le) { | ||
$pms->set_spamd_result_item( sub { return "last-external=$le"; } ); | ||
} | ||
my $header = $pms->get("X-Haraka-UUID"); | ||
if(defined($header) && $header) { | ||
$pms->set_spamd_result_item( sub { return "haraka-uuid=$header"; } ); | ||
} | ||
return 0; | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,76 @@ | ||
spamassassin | ||
============ | ||
|
||
This plugin runs the mail through SpamAssassin. | ||
This plugin implements the spamd protocol and will send messages to | ||
spamd for scoring. | ||
|
||
Configuration | ||
------------- | ||
|
||
spamassassin.ini | ||
|
||
- spamd_socket = \[host:port | /path/to/socket\] *optional* | ||
|
||
Default: localhost:783 | ||
Host or path to socket where spamd is running. | ||
|
||
- spamd_user = \[user\] *optional* | ||
|
||
Default: default | ||
Username to pass to spamd. This is useful when you are running | ||
spamd with virtual users. | ||
|
||
You can also pass this value in dynamically by setting: | ||
|
||
connection.transaction.notes.spamd_user | ||
|
||
- max_size = N *optional* | ||
|
||
Default: 500000 | ||
Maximum size of messages (in bytes) to send to spamd. | ||
Messages over this size will be skipped. | ||
|
||
- reject_thresold = N *optional* | ||
|
||
Default: none (do not reject any mail) | ||
SpamAssassin score at which the mail should be rejected. | ||
|
||
- relay_reject_threshold = N *optional* | ||
|
||
Default: none | ||
As above, except this threshold only applies to connections | ||
that are relays (e.g. AUTH) where connection.relaying = true. | ||
This is used to set a *lower* thresold at which to reject mail | ||
from these hosts to prevent sending outbound spam. | ||
|
||
If this is not set, then the `reject_thresold` value is used. | ||
|
||
- munge_subject_threshold = N *optional* | ||
|
||
Default: none (do not munge the subject) | ||
Score at which the subject should be munged (prefixed). | ||
|
||
- subject_prefix = \[prefix\] *optional* | ||
|
||
Default: *** SPAM *** | ||
Prefix to use when munging the subject. | ||
|
||
- old_headers_action = \[rename | drop | keep\] *optional* | ||
|
||
Default: rename | ||
If old X-Spam-* headers are in the email, what do we do with them? | ||
`rename` them to X-Old-Spam-*. | ||
`drop` will delete them. | ||
`keep` will keep them (new X-Spam-* headers appear lower down in | ||
the headers then). | ||
|
||
|
||
Extras | ||
====== | ||
|
||
A SpamAssassin plugin can be found in the `contrib` directory. | ||
Haraka.\[pm|cf\] should be placed in the SpamAssassin local site rules | ||
directory (/etc/mail/spamassassin on Linux), spamd should be restarted | ||
and the plugin will make spamd output the Haraka UUID as part of it's | ||
log output to aid debugging when searching the mail logs. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters