Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Discuss
  3. Sharing custom SpamAssassin Rules

Sharing custom SpamAssassin Rules

Scheduled Pinned Locked Moved Discuss
mailspam
77 Posts 18 Posters 19.2k Views 27 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    crazybrad
    wrote on last edited by crazybrad
    #66

    @humptydumpty So I asked my favorite tool for some help on your list of "bad Gmail actors" and here is a detailed analysis for your consideration: https://www.perplexity.ai/search/please-review-the-attached-gma-BjXGrt4qR_er6c45dse5Vw .

    I found myself curious as to whether those email addresses even exist. Unfortunately Gmail does not have a "finger" API and there are limited options within Spam Assassin for handling this directly. There were some ideas on combining Spam Assassin's rule-based tagging with a Sieve filter. Here are the details for your consideration: https://www.perplexity.ai/search/does-gmail-have-the-ability-to-jePfq628TDeod5jDVoYU2Q

    humptydumptyH 1 Reply Last reply
    1
    • C crazybrad

      @humptydumpty So I asked my favorite tool for some help on your list of "bad Gmail actors" and here is a detailed analysis for your consideration: https://www.perplexity.ai/search/please-review-the-attached-gma-BjXGrt4qR_er6c45dse5Vw .

      I found myself curious as to whether those email addresses even exist. Unfortunately Gmail does not have a "finger" API and there are limited options within Spam Assassin for handling this directly. There were some ideas on combining Spam Assassin's rule-based tagging with a Sieve filter. Here are the details for your consideration: https://www.perplexity.ai/search/does-gmail-have-the-ability-to-jePfq628TDeod5jDVoYU2Q

      humptydumptyH Offline
      humptydumptyH Offline
      humptydumpty
      wrote on last edited by
      #67

      @crazybrad That was an interesting read! I'm going to test the gmail spam rules and see how it goes. I'll add my gmail based clients to the whitelist to be on the safe side though. TYVM!

      1 Reply Last reply
      1
      • BrutalBirdieB BrutalBirdie

        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.
        โค

        sponchS Offline
        sponchS Offline
        sponch
        wrote on last edited by
        #68

        @BrutalBirdie still get them in my spam folder but at least not in my inbox ๐Ÿ™‚

        1 Reply Last reply
        0
        • d19dotcaD d19dotca

          @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 or welcomelist_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.

          murgeroM Offline
          murgeroM Offline
          murgero
          App Dev
          wrote on last edited by
          #69

          @d19dotca Heyo! Finally got around to applying this - do I need to add anything to Mail ACL or just to custom spamassassin rules?

          --
          https://urgero.org
          ~ Professional Nerd. Freelance Programmer. ~

          d19dotcaD 1 Reply Last reply
          0
          • murgeroM murgero

            @d19dotca Heyo! Finally got around to applying this - do I need to add anything to Mail ACL or just to custom spamassassin rules?

            d19dotcaD Offline
            d19dotcaD Offline
            d19dotca
            wrote on last edited by
            #70

            @murgero just in the SpamAssassin rules part is all you need. ๐Ÿ™‚ Nothing else. But let me know if that doesnโ€™t seem to work for you at all and I can try to help with some screenshots later too.

            --
            Dustin Dauncey
            www.d19.ca

            1 Reply Last reply
            2
            • marcusquinnM Offline
              marcusquinnM Offline
              marcusquinn
              wrote on last edited by
              #71

              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.

              Web Design & Development: https://www.evergreen.je
              Technology & Apps: https://www.marcusquinn.com

              1 Reply Last reply
              1
              • necrevistonnezrN Offline
                necrevistonnezrN Offline
                necrevistonnezr
                wrote on last edited by
                #72

                Alternatively: turn it into a community guide, link to the guide in the documentation

                1 Reply Last reply
                3
                • M Offline
                  M Offline
                  msbt
                  App Dev
                  wrote on last edited by
                  #73

                  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?

                  Hosting & Web Development

                  d19dotcaD 1 Reply Last reply
                  2
                  • M msbt

                    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?

                    d19dotcaD Offline
                    d19dotcaD Offline
                    d19dotca
                    wrote on last edited by
                    #74

                    @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. ๐Ÿ™‚

                    --
                    Dustin Dauncey
                    www.d19.ca

                    BrutalBirdieB humptydumptyH 2 Replies Last reply
                    8
                    • d19dotcaD d19dotca

                      @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. ๐Ÿ™‚

                      BrutalBirdieB Offline
                      BrutalBirdieB Offline
                      BrutalBirdie
                      Partner
                      wrote on last edited by
                      #75

                      @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.

                      excited waiting gif

                      Like my work? Consider donating a drink. Cheers!

                      1 Reply Last reply
                      5
                      • d19dotcaD d19dotca

                        @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. ๐Ÿ™‚

                        humptydumptyH Offline
                        humptydumptyH Offline
                        humptydumpty
                        wrote on last edited by humptydumpty
                        #76

                        @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?

                        d19dotcaD 1 Reply Last reply
                        2
                        • humptydumptyH humptydumpty

                          @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?

                          d19dotcaD Offline
                          d19dotcaD Offline
                          d19dotca
                          wrote on last edited by d19dotca
                          #77

                          @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.

                          1. sudo docker exec -ti mail /bin/bash

                          2. 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. ๐Ÿ™‚

                          --
                          Dustin Dauncey
                          www.d19.ca

                          1 Reply Last reply
                          11
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Bookmarks
                          • Search