about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--sa_config/root/etc/spamassassin/public-inbox.pre2
-rw-r--r--sa_config/user/.spamassassin/user_prefs25
-rwxr-xr-xscripts/edit-sa-prefs38
3 files changed, 59 insertions, 6 deletions
diff --git a/sa_config/root/etc/spamassassin/public-inbox.pre b/sa_config/root/etc/spamassassin/public-inbox.pre
index 161e2109..d2c2de8f 100644
--- a/sa_config/root/etc/spamassassin/public-inbox.pre
+++ b/sa_config/root/etc/spamassassin/public-inbox.pre
@@ -7,3 +7,5 @@ loadplugin Mail::SpamAssassin::Plugin::Rule2XSBody
 
 # for ok_languages in user_prefs
 loadplugin Mail::SpamAssassin::Plugin::TextCat
+
+allow_user_rules 1
diff --git a/sa_config/user/.spamassassin/user_prefs b/sa_config/user/.spamassassin/user_prefs
index 9919b98e..b9a8da45 100644
--- a/sa_config/user/.spamassassin/user_prefs
+++ b/sa_config/user/.spamassassin/user_prefs
@@ -1,5 +1,5 @@
 # raise or lower as needed
-required_score 5.0
+required_score 3.0
 
 # do not mess with the original message body, only notify in headers
 clear_report_template
@@ -15,12 +15,25 @@ bayes_ignore_header X-Spam-Flag
 bayes_ignore_header X-Spam-Status
 bayes_ignore_header X-Spam-Report
 
-# English-only for all lists on public-inbox.org
-ok_locales en
-# we have "loadplugin Mail::SpamAssassin::Plugin::TextCat" in a *.pre file
-ok_languages en
-
 # uncomment the following for importing archives:
 # dns_available no
 # skip_rbl_checks 1
 # skip_uribl_checks 1
+
+# manual rules (some stolen from debian)
+# these require "allow_user_rules 1" in the system-wide config
+
+rawbody  LOCAL_VIEWINBROWSER /View this message in a browser/
+describe LOCAL_VIEWINBROWSER "HTML mail not welcome"
+score    LOCAL_VIEWINBROWSER 2.8
+
+body MEETUPSECURELY /meetupsecurely\.com/i
+describe MEETUPSECURELY "site used by spammers"
+score MEETUPSECURELY 2.8
+
+body HELLOMYDEAR /hello my dear/i
+describe HELLOMYDEAR "spam phrase"
+score HELLOMYDEAR 2.8
+
+# we hate HTML mail
+score MIME_HTML_MOSTLY  2.0
diff --git a/scripts/edit-sa-prefs b/scripts/edit-sa-prefs
new file mode 100755
index 00000000..acaed610
--- /dev/null
+++ b/scripts/edit-sa-prefs
@@ -0,0 +1,38 @@
+#!/bin/sh
+# Copyright (C) 2014, Eric Wong <e@80x24.org>
+# License: GPLv3 or later <http://www.gnu.org/licenses/gpl-3.0.txt>
+# edit and atomically update ~/.spamasassin/user_prefs safely
+set -e
+cd ~/.spamassassin
+cp user_prefs user_prefs.edit.$$ # don't care if we clobber old files
+
+# non-blocking lock
+if ! ln user_prefs.edit.$$ user_prefs.edit
+then
+        rm user_prefs.edit.$$
+        echo >&2 "we are already editing user_prefs.edit"
+        exit 1
+fi
+
+rm user_prefs.edit.$$
+
+${VISUAL-vi} user_prefs.edit
+
+if diff -u user_prefs user_prefs.edit
+then
+        rm -f user_prefs.edit
+        echo 'no changes'
+        exit 0
+fi
+
+# check until we're good or $EDITOR fails
+while ! spamassassin -p user_prefs.edit --lint
+do
+        echo >&2 "respawning editor, press Enter to continue"
+        read ignored_var
+        ${VISUAL-vi} user_prefs.edit
+done
+
+# atomically replace user_prefs
+mv user_prefs.edit user_prefs
+echo '~/.spamassassin/user_prefs updated'