Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mailinabox
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mailinabox
Commits
94c4352f
Commit
94c4352f
authored
Sep 27, 2014
by
Joshua Tauberer
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'jmar71n-master' - site-wide bayesean spam filtering
parents
5c7ba2a4
6dd6353d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
spamassassin.sh
setup/spamassassin.sh
+16
-4
No files found.
setup/spamassassin.sh
100644 → 100755
View file @
94c4352f
#!/bin/bash
# Spam filtering with spamassassin via spampd
# Spam filtering with spamassassin via spampd
#############################################
#############################################
...
@@ -9,6 +10,7 @@
...
@@ -9,6 +10,7 @@
# plugin. The tools/mail.py tool creates the necessary sieve script for each mail
# plugin. The tools/mail.py tool creates the necessary sieve script for each mail
# user when the mail user is created.
# user when the mail user is created.
source
/etc/mailinabox.conf
# get global vars
source
setup/functions.sh
# load our functions
source
setup/functions.sh
# load our functions
# Install packages.
# Install packages.
...
@@ -33,13 +35,14 @@ sudo sed -i "s/#mail_plugins = .*/mail_plugins = \$mail_plugins antispam/" /etc/
...
@@ -33,13 +35,14 @@ sudo sed -i "s/#mail_plugins = .*/mail_plugins = \$mail_plugins antispam/" /etc/
# When mail is moved in or out of the Dovecot Spam folder, re-train using this script
# When mail is moved in or out of the Dovecot Spam folder, re-train using this script
# that sends the mail to spamassassin.
# that sends the mail to spamassassin.
# from http://wiki2.dovecot.org/Plugins/Antispam
# from http://wiki2.dovecot.org/Plugins/Antispam
cat
>
/usr/bin/sa-learn-pipe.sh
<<
EOF
;
rm
-f
/usr/bin/sa-learn-pipe.sh
# legacy location
cat
>
/usr/local/bin/sa-learn-pipe.sh
<<
EOF
;
cat<&0 >> /tmp/sendmail-msg-
\$\$
.txt
cat<&0 >> /tmp/sendmail-msg-
\$\$
.txt
/usr/bin/sa-learn
\$
* /tmp/sendmail-msg-
\$\$
.txt > /dev/null
/usr/bin/sa-learn
\$
* /tmp/sendmail-msg-
\$\$
.txt > /dev/null
rm -f /tmp/sendmail-msg-
\$\$
.txt
rm -f /tmp/sendmail-msg-
\$\$
.txt
exit 0
exit 0
EOF
EOF
chmod
a+x /usr/bin/sa-learn-pipe.sh
chmod
a+x /usr/
local/
bin/sa-learn-pipe.sh
# Configure the antispam plugin to call sa-learn-pipe.sh.
# Configure the antispam plugin to call sa-learn-pipe.sh.
cat
>
/etc/dovecot/conf.d/99-local-spampd.conf
<<
EOF
;
cat
>
/etc/dovecot/conf.d/99-local-spampd.conf
<<
EOF
;
...
@@ -47,12 +50,21 @@ plugin {
...
@@ -47,12 +50,21 @@ plugin {
antispam_backend = pipe
antispam_backend = pipe
antispam_spam_pattern_ignorecase = SPAM
antispam_spam_pattern_ignorecase = SPAM
antispam_allow_append_to_spam = yes
antispam_allow_append_to_spam = yes
antispam_pipe_program_spam_args = /usr/bin/sa-learn-pipe.sh;--spam
antispam_pipe_program_spam_args = /usr/
local/
bin/sa-learn-pipe.sh;--spam
antispam_pipe_program_notspam_args = /usr/bin/sa-learn-pipe.sh;--ham
antispam_pipe_program_notspam_args = /usr/
local/
bin/sa-learn-pipe.sh;--ham
antispam_pipe_program = /bin/bash
antispam_pipe_program = /bin/bash
}
}
EOF
EOF
# Tell spamassassin where to load and store site-wide bayesean filtering data.
mkdir
-p
$STORAGE_ROOT
/mail/spamassassin
chown
-R
mail:mail
$STORAGE_ROOT
/mail/spamassassin
chmod
-R
775
$STORAGE_ROOT
/mail/spamassassin
tools/editconf.py /etc/spamassassin/local.cf
-s
\
bayes_path
=
$STORAGE_ROOT
/mail/spamassassin/bayes
# Initial training?
# Initial training?
# sa-learn --ham storage/mail/mailboxes/*/*/cur/
# sa-learn --ham storage/mail/mailboxes/*/*/cur/
# sa-learn --spam storage/mail/mailboxes/*/*/.Spam/cur/
# sa-learn --spam storage/mail/mailboxes/*/*/.Spam/cur/
...
...
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