Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tools:spamd [2022/07/08 01:29] – [Configure] darron | tools:spamd [2022/07/12 13:25] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 8: | Line 8: | ||
===Configure=== | ===Configure=== | ||
+ | |||
+ | ==Local== | ||
Edit / | Edit / | ||
- | ==compile-spamd.sh== | + | ==Compile== |
+ | |||
+ | Compiling rules will speed up spamd but it will work otherwise. | ||
+ | |||
+ | __compile-spamd.sh__ | ||
< | < | ||
#! /bin/sh | #! /bin/sh | ||
Line 21: | Line 27: | ||
</ | </ | ||
- | ===Update=== | + | ==Update== |
- | Run from cron once per day, week or month. | + | Run from cron once per day to download new rules and recompile. |
- | ==update-spamd.sh== | + | __update-spamd.sh__ |
< | < | ||
#! /bin/sh | #! /bin/sh | ||
sa-update --nogpg | sa-update --nogpg | ||
- | compile-spamd.sh | + | if test $? -eq 0; then |
+ | | ||
+ | fi | ||
exit 0 | exit 0 | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===Run it=== | ||
+ | |||
+ | < | ||
+ | #! /bin/sh | ||
+ | export TZ=" | ||
+ | rm -f / | ||
+ | exec / | ||
+ | </ | ||
+ | |||
+ | === Plugin=== | ||
+ | |||
+ | Example plugin I wrote to catch fake mailing list spam. | ||
+ | |||
+ | < | ||
+ | #! / | ||
+ | # | ||
+ | # By | ||
+ | # | ||
+ | # | ||
+ | # See | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # / | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | |||
+ | package LocalPlugin; | ||
+ | |||
+ | use Mail:: | ||
+ | use Mail:: | ||
+ | use Mail:: | ||
+ | |||
+ | our @ISA = qw(Mail:: | ||
+ | |||
+ | sub new | ||
+ | { | ||
+ | my($class, $mailsa) = @_; | ||
+ | |||
+ | $class = ref($class) || $class; | ||
+ | my $self = $class-> | ||
+ | bless ($self, $class); | ||
+ | |||
+ | $self-> | ||
+ | |||
+ | info(" | ||
+ | |||
+ | return $self; | ||
+ | } | ||
+ | |||
+ | sub check_for_fake_list | ||
+ | { | ||
+ | my($self, $permsgstatus) = @_; | ||
+ | |||
+ | $from = $permsgstatus-> | ||
+ | my @to = split /@/, $permsgstatus-> | ||
+ | my $name = $to[0]; | ||
+ | my $host = $to[1]; | ||
+ | if ($from && $name && $host) { | ||
+ | # *mail-user=host@mail.* | ||
+ | if ((index $from, " | ||
+ | info(" | ||
+ | return 1; | ||
+ | } | ||
+ | # newsletter-user=host@mail.* | ||
+ | if ((rindex $from, " | ||
+ | info(" | ||
+ | return 1; | ||
+ | } | ||
+ | } | ||
+ | return 0; | ||
+ | } | ||
+ | |||
+ | 1; | ||
+ | |||
+ | # vim: shiftwidth=4 tabstop=4 noexpandtab | ||
+ | </ | ||
+ | |||
+ | ===Spam=== | ||
+ | |||
+ | Here is a PHP command line tool to send test spam. | ||
+ | |||
+ | Change Host, Sender and addAddress as appropriate. | ||
+ | |||
+ | < | ||
+ | #! / | ||
+ | <?php | ||
+ | /* DEBIAN BUSTER */ | ||
+ | require_once ' | ||
+ | require_once ' | ||
+ | require_once ' | ||
+ | require_once ' | ||
+ | require_once ' | ||
+ | |||
+ | use PHPMailer\PHPMailer\PHPMailer; | ||
+ | use PHPMailer\PHPMailer\SMTP; | ||
+ | use PHPMailer\PHPMailer\Exception; | ||
+ | |||
+ | $mail = new PHPMailer(true); | ||
+ | |||
+ | $mail-> | ||
+ | $mail-> | ||
+ | $mail-> | ||
+ | $mail-> | ||
+ | |||
+ | $mail-> | ||
+ | |||
+ | $mail-> | ||
+ | $mail-> | ||
+ | $mail-> | ||
+ | |||
+ | $mail-> | ||
+ | $mail-> | ||
+ | $mail-> | ||
+ | |||
+ | try { | ||
+ | $mail-> | ||
+ | } | ||
+ | catch (Exception $e) { | ||
+ | echo $e-> | ||
+ | } | ||
+ | /* | ||
+ | * vim: shiftwidth=4 tabstop=4 softtabstop=4 expandtab | ||
+ | */ | ||
+ | ?> | ||
</ | </ | ||