Sharing custom SpamAssassin Rules
-
7 days recap after applying your rules.
I believe not one spam mail has hit my spam folder or inbox so far.
normally I'd get ~20x+ spam mails a day since my Inbox also redirects my old legacy mailboxes from web.de which have been leaked and abused over and over again.
I must say, this feels very good.
@BrutalBirdie still get them in my spam folder but at least not in my inbox
-
@murgero said in Sharing custom SpamAssassin Rules:
@d19dotca does this just go into email -> Spam Filter -> Custom Spam Assassin Settings?
Yes, it goes right there. Basically from the Mail page > Spam filtering > Custom Spamassassin Rules box.
You can copy & paste the entire thing, but do note a few items just in case:
- You will need to likely remove the
blocklist_from
orwelcomelist_from
lines unless you have emails to place in those two sections already, I left those there just for an example. - If you want to use the DNSBLs from Abusix then you'll need to use your own API key (it's free for under 5,000 queries per day averaged over 7 days, it seems to work great and I highly recommend it).
The rest though you can basically copy & paste directly. Of course YMMV as they say, but this list works pretty well for me, or at least is a noticeable improvement over the rule tweaks I was using last year.
- You will need to likely remove the
-
@d19dotca Heyo! Finally got around to applying this - do I need to add anything to Mail ACL or just to custom spamassassin rules?
-
I've been getting a LOT of spam lately.
@girish Any chances we can have this implemented but the core app? Save everyone having to discoverer this thread and do the same.
-
Alternatively: turn it into a community guide, link to the guide in the documentation
-
Thanks a bunch for the list @d19dotca! Quick question about the rest of the setup though: Do you still have entries in the Email ACL DNSBL Zones or is that empty because everything is handled in the custom rules? Like those:
zen.spamhaus.org bl.mailspike.net noptr.spamrats.com dnsbl.sorbs.net
Or is that empty on your side?
-
Thanks a bunch for the list @d19dotca! Quick question about the rest of the setup though: Do you still have entries in the Email ACL DNSBL Zones or is that empty because everything is handled in the custom rules? Like those:
zen.spamhaus.org bl.mailspike.net noptr.spamrats.com dnsbl.sorbs.net
Or is that empty on your side?
@msbt Great question! So for me personally I use the following one in there:
{APIKey}.exploit.mail.abusix.zone
. The reason being is that seems to be 100% accurate in terms of 0 false positives. The goal is to get to 0 false positives and then tag the rest as either ham or spam so the users can decide from there if anything is incorrect. That way they donโt risk losing any mail that may be important.I have also been tinkering with the spam rules again the past month, testing some things out. Iโll go into more detail with that soon with updated scores that Iโm using. I wanted to do a bit more analysis of it today actually to make sure itโs in the right direction before sharing it, but Iโll likely be in a position to share it pretty soon.
-
@msbt Great question! So for me personally I use the following one in there:
{APIKey}.exploit.mail.abusix.zone
. The reason being is that seems to be 100% accurate in terms of 0 false positives. The goal is to get to 0 false positives and then tag the rest as either ham or spam so the users can decide from there if anything is incorrect. That way they donโt risk losing any mail that may be important.I have also been tinkering with the spam rules again the past month, testing some things out. Iโll go into more detail with that soon with updated scores that Iโm using. I wanted to do a bit more analysis of it today actually to make sure itโs in the right direction before sharing it, but Iโll likely be in a position to share it pretty soon.
@d19dotca said in Sharing custom SpamAssassin Rules:
I have also been tinkering with the spam rules again the past month, testing some things out. Iโll go into more detail with that soon with updated scores that Iโm using. I wanted to do a bit more analysis of it today actually to make sure itโs in the right direction before sharing it, but Iโll likely be in a position to share it pretty soon.
-
@msbt Great question! So for me personally I use the following one in there:
{APIKey}.exploit.mail.abusix.zone
. The reason being is that seems to be 100% accurate in terms of 0 false positives. The goal is to get to 0 false positives and then tag the rest as either ham or spam so the users can decide from there if anything is incorrect. That way they donโt risk losing any mail that may be important.I have also been tinkering with the spam rules again the past month, testing some things out. Iโll go into more detail with that soon with updated scores that Iโm using. I wanted to do a bit more analysis of it today actually to make sure itโs in the right direction before sharing it, but Iโll likely be in a position to share it pretty soon.
@d19dotca The last rules you provided are working great for me. I still get spam sent via the major mail providers like Gmail and Outlook though. They seem to target my info@ mailboxes. I wonder if there is anything we can do in that regards other than using keyword filtering?
-
@d19dotca The last rules you provided are working great for me. I still get spam sent via the major mail providers like Gmail and Outlook though. They seem to target my info@ mailboxes. I wonder if there is anything we can do in that regards other than using keyword filtering?
@humptydumpty That's something I'd like to look into too, although I have a feeling the only thing that can really work its magic there is the Bayesian learning, so running the SpamAssassin
learn
commands. I've been running a script (with the help of ChatGPT, lol) like one below in case this helps as I find the Bayesian learning in Cloudron seems to be really manual or inconsistent at running (I think they've admitted that too in a post I saw somewhere the other month), and it's improved IMO with running this often. Personally I run this manually for now just because I wanted to make sure it was working, but I'll probably consider throwing this in a cron job soon enough.-
sudo docker exec -ti mail /bin/bash
-
Run this script in the mail container:
nohup bash -c ' MAILDIR="/app/data/vmail"; SPAMD_DIR="/app/data/spamd"; for user in $(ls "$MAILDIR"); do MAILBOX="$MAILDIR/$user/mail"; BAYES_PATH="$SPAMD_DIR/$user"; mkdir -p "$BAYES_PATH"; chown -R cloudron:cloudron "$BAYES_PATH"; chmod 700 "$BAYES_PATH"; echo "๐ Training SpamAssassin for $user..." | tee -a /app/data/spamd/train.log; # Train spam from .Spam and .Junk folders (including subfolders) find "$MAILBOX/.Spam" "$MAILBOX/.Junk" -type d -name "cur" 2>/dev/null | while read folder; do echo "๐ Training SPAM from: $folder" | tee -a /app/data/spamd/train.log; sa-learn --spam --dbpath "$BAYES_PATH" --dir "$folder" | tee -a /app/data/spamd/train.log; done # Train ham from Inbox and Archive, but EXCLUDE Junk, Spam, Trash, Sent, and Drafts find "$MAILBOX" -type d -name "cur" 2>/dev/null | grep -Ev "/(\.Trash|\.Deleted Messages|\.Sent|\.Sent Messages|\.Drafts|\.Junk|\.Spam)/" | while read folder; do echo "๐ Training HAM from: $folder" | tee -a /app/data/spamd/train.log; sa-learn --ham --dbpath "$BAYES_PATH" --dir "$folder" | tee -a /app/data/spamd/train.log; done echo "โ Completed training for $user! BAYES files stored in $BAYES_PATH" | tee -a /app/data/spamd/train.log; done; echo "๐ SpamAssassin training completed for all mailboxes." | tee -a /app/data/spamd/train.log; ' > /app/data/spamd/train.log 2>&1 &
It creates that train.log file and writes all the output to it so you can see it learning across all mailboxes for the Inbox and Archive folder as ham and the Junk/Spam folder as spam for all users. It's neat to see it saying it
learned ham from 34 messages
or something like that for each mailbox, haha.I think my latest spam rules are doing well the past week, so I'll likely be posting them here soon.
-