This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Enable Spamassassin Bayes

We have ASG V6.  Spam threshold is set to quarantine at 4 and reject at 8.  We have blocked a few legitimate emails at the 4 level so any lower for us and we would probably block too much legitimate mail.  We have bl.spamcop.net, sbl.spamhaus.org, list.dsbl.org, relays.ordb.org, and xbl.spamhaus.org for RBL's in use.  I was trying to figure out if the BAYES feature of spamassassin is used by default but it doesn't appear to be.  I've seen others posting spam email contents with Bayes information in them.  I have never seen any spam email in proxy content manager with Bayes filtering in it.  How does one go about using this feature??  We still get very obvious spam inside our network with buzz words in the body such as V I A GrA, and other variations of this word and other drugs.  It seems obvious that a spam program should block stuff as obvious as this.  So, how do I learn this spamassassin to block using the bayes feature??


This thread was automatically locked due to age.
Parents
  • Hi! [:)] 
     
    The Bayers feature is NOT used by default. That and autowhitelist is disabled. To enable them i have tried this...
     
    This will void your warranty and support and so forth... 
    *Just a warning*
     
    Edit the file
    /etc/mail/spamassassin/local.cf
     
    Change the rows containg bayers from 0 -> 1
    I also enabled autowhitelist as you can see + More headers.
     
    # This is the right place to customize your installation of SpamAssassin.
    #
    # See 'perldoc Mail::SpamAssassin::Conf' for details of what can be
    # tweaked.
    #
    # Only a small subset of options are listed below
    #
    ###########################################################################
     
    # Add *****SPAM***** to the Subject header of spam e-mails
    #
    # rewrite_header Subject *****SPAM*****
     
     
    # Save spam messages as a message/rfc822 MIME attachment instead of
    # modifying the original message (0: off, 2: use text/plain instead)
    #
    # report_safe 1
     
     
    # Set which networks or hosts are considered 'trusted' by your mail
    # server (i.e. not spammers)
    #
    # trusted_networks 212.17.35.
     
     
    # Set file-locking method (flock is not safe over NFS, but is faster)
    #
    # lock_method flock
     
     
    # Set the threshold at which a message is considered spam (default: 5.0)
    #
    # required_score 5.0
     
     
    # Use Bayesian classifier (default: 1)
    #
    use_bayes 1
     
     
    # Bayesian classifier auto-learning (default: 1)
    #
    bayes_auto_learn 1
     
     
    # Set headers which may provide inappropriate cues to the Bayesian
    # classifier
    #
    bayes_ignore_header X-Bogosity
    bayes_ignore_header X-Spam-Flag
    bayes_ignore_header X-Spam-Status
     
    use_auto_whitelist 1
     
    score DRUGS_ERECTILE 2
    score DRUGS_ANXIETY_EREC 2
     
    score HTML_MIME_NO_HTML_TAG 1
    score HTML_MESSAGE 0.0
    score HTML_FONT_BIG 1
     
    score RCVD_NUMERIC_HELO 2
    score RCVD_BY_IP 1
     
    #EOF
     
    When your done restart the spam protection in the Webadmin GUI.
     
    BTW; 
    The bayers database can be found at 
    /var/lib/nobody/.spamassassin
     
    Hope this does the trick [;)]
  • Ok, thanks Frank.  We aren't prepared to void all support.  Maybe in a year after what we paid for is ready for a renewal.  What the hell is the point of having a great spam blocking program if the best feature isn't being used.  Don't suppose you or anyone else know whether future versions will have this ENABLED?  
    Thanks again.
  • Hi!
     
    I can understand that completly. I have since i wrote the original mail in this topic trained my bayesian database with about 20-30000 non spam mail from my UNIX mailbox. Using the sa-learn command. And I can say that it is working like a dream! [[:)]] 
     
    From my expriance in SPAM protections (However different products) the bayesian feature properly configured can catch around 97-99,9% of the spam. I work as an IT-Administator at a local goverment in Sweden and we run a different spam solution that heavely depends on just bayesian learning. And i can say it works excellent! [[:)]] 
     
    It will however require its administrator and a learning period. Or as I did and uploaded and trained it with some real mail and some spam. If you do not do this the bayesian database will probably not be even close to as efficiant as it can be. My guess is this i why Astaro has not implimented it. You want a Firewall with SPAM features that works from the box, NOT that you have to maintain a lot in the begining and every now and then later.
     
    Well I have been running ASL since V3.2 at home and at another company that i help since V4. When they first became intrested in ASL at that company i wrote a topic here about features i would like to se in future ASL versions. Bayesian learning was one of the thinks i wrote down then. Tom then responded to that post and said that it would be included in Spamassassin 2.55, but I looked at it then and most versions since then and i did not see it implimented in the ASL version of spamassassin. Or at least not working properly. [[:(]] 
     
    Later they included DCC and Razor2 witch I was very happy to see. However it looks like they have removed this in (6.105) or some versions ago. [[:(]] 
     
    But if they include Bayesian learning with an upload option for SPAM / HAM or just as an extra option that you can enable in V7 I would be more then happy to say THANKS ASTARO!
  • I am not familiar with hand running the sa-learn, would you mind my asking how you are getting the SPAM emails back into Astaro to run the sa-learn on?
  • Hi!
     
    I have made some changes since the last post. I don’t use Autowhitelist and after tuning the system with mail i now changes the points for Bayers. My new local.cf looks like this.
     
    # This is the right place to customize your installation of SpamAssassin.
    #
    # See 'perldoc Mail::SpamAssassin::Conf' for details of what can be
    # tweaked.
    #
    # Only a small subset of options are listed below
    #
    ###########################################################################
    # Add *****SPAM***** to the Subject header of spam e-mails
    #
    # rewrite_header Subject *****SPAM*****
     
    # Save spam messages as a message/rfc822 MIME attachment instead of
    # modifying the original message (0: off, 2: use text/plain instead)
    #
    # report_safe 1
     
    # Set which networks or hosts are considered 'trusted' by your mail
    # server (i.e. not spammers)
    #
    trusted_networks 192.168.100.
     
    # Set file-locking method (flock is not safe over NFS, but is faster)
    #
    lock_method flock
     
    # Set the threshold at which a message is considered spam (default: 5.0)
    #
    # required_score 5.0
     
    # Email BULK checking (Not working due to need of seperate software)
    use_pyzor 1
    use_dcc 1
    #use_razor2 1
     
    # Use Bayesian classifier (default: 1)
    #
    use_bayes 1
    use_bayes_rules 1
    bayes_use_hapaxes 1
    bayes_auto_expire 1
    bayes_expiry_max_db_size 750000
    bayes_min_ham_num 200
    bayes_min_spam_num 200
     
    # Bayesian classifier auto-learning (default: 1)
    #
    bayes_auto_learn 1
    bayes_auto_learn_threshold_nonspam -1.0
    bayes_auto_learn_threshold_spam 3.0
    bayes_learn_to_journal 0
     
    # Set headers which may provide inappropriate cues to the Bayesian
    # classifier
    #
    bayes_ignore_header X-Bogosity
    bayes_ignore_header X-Spam-Flag
    bayes_ignore_header X-Spam-Status
    bayes_ignore_header ReSent-Date
    bayes_ignore_header ReSent-From
    bayes_ignore_header ReSent-Message-ID
    bayes_ignore_header ReSent-Subject
    bayes_ignore_header ReSent-To
    bayes_ignore_header Resent-Date
    bayes_ignore_header Resent-From
    bayes_ignore_header Resent-Message-ID
    bayes_ignore_header Resent-Subject
    bayes_ignore_header Resent-To
     
    use_auto_whitelist 0
     
    header LOCAL_RCVD Received =~ /.*\(\S+\.mydomain\.org\s+[.*]\)/
    describe LOCAL_RCVD Received from local machine
    score LOCAL_RCVD -50
    score ALL_TRUSTED -50
     
    score DRUGS_ERECTILE 2
    score DRUGS_ANXIETY_EREC 2
    score HTML_MIME_NO_HTML_TAG 1
    score HTML_MESSAGE 0.0
    score HTML_FONT_BIG 1
    score RCVD_NUMERIC_HELO 2
    score RCVD_BY_IP 1
     
    # extra adjust for asia emails
    score MIME_BASE64_TEXT 0.5
     
    # Extra points for softfail and negative score for pass 
    # (Not working what i can see)
     
    score SPF_SOFTFAIL 3.000
    score SPF_HELO_SOFTFAIL 3.000
    score SPF_PASS -5.000
    score SPF_HELO_PASS -5.000
     
    # Bayers scoring
    score BAYES_99 10.000
    score BAYES_95 7.500
    score BAYES_80 5.000
    score BAYES_60 3.000
    score BAYES_50 0.000
    score BAYES_40 -3.000
    score BAYES_20 -5.000
    score BAYES_05 -7.500
    score BAYES_00 -10.000
     
    # EOF
     
     
    Well to the point. 
    I run at the moment a SuSE Linux machine where my mailboxes are located. I don't retrieve and remove my mails when I access my mailbox by POP3. I have configured my mail client to only remove mails from the mailbox if i remove them on my client. Therefore I have a mailbox clean with NO spam.
     
    1: I copied my UNIX mailbox to my computer. Note I could have uploaded them direct to the ASL with scp.
     
    2: I logged on to the ASL as root and created an folder under /var/storage. The reason for this is that it is the largest partition.
     
    3: I changed rights on the folder to allow full access for loginuser.
     
    4: I Uploaded my mailbox to that folder using WinSCP.
     
    5: I uses the sa-learn command (IMPORTANT you HAVE to run it with su or else the bayers db will end up in /root/.spamassassin/ where it will do us no good)
    su - nobody -- sa-learn --showdots --mbox --ham /var/storage/ham/my-mbox 
     
     
    This is a little more user friendly progress bar.
    su - nobody -- sa-learn --progress --mbox --ham /var/storage/ham/my-mbox
     
    If you have a large mailbox like I have. 30k mails or more this will take some time. On my 1.7Ghz P4 it went on for about 3hours. 
    To this date it has based on my mailbox 28506 ham mails, And from outside access 250 spam mails. 
     
    To get this even more accurate you could repeat this using a spam only mailbox. 
     
    That’s it. I guess. [:)] 
     
    PS: You can however still tweak it a bit. If you open a mail that has been couth by the spam protection an ended up in quarantine you might see that it has now been "tagged" but not by bayes. Then you can learn it again. For just this spam
     
    Copy your mail (Splitted in 2 files, If you have a lot of mails then remove all except the one you want. Makes life easier) from /var/storage/chroot-smtp/spool/Finput/1ThSm-Udsa-* 
    to /var/lib/nobody/.spamassassin/
     
    Go to your /var/lib/nobody/.spamassassin/ folder then merge the 2 files together
    cat 1ThSm-Udsa-D >> 1ThSm-Udsa-H
     
    Edit the file and remove junk info at the start of the file and some r283 combinations inside the header.
     
     
    Now we can tune it more. I always start with syncing the DB. Don’t know if you have to but I always do.
    su - nobody -- sa-learn --sync
    Then learn the system.
    su - nobody -- sa-learn --showdots --spam /var/lib/nobody/.spamassassin/1ThSm-Udsa-H
     
    Hope this helps! Still remember! This will void your warranty and support!! 
     
    DS:
     
    Happy hacking!
  • Hi!
     
    Today i sufferd the sad but true fact if you don't backup your system regulary. It fails and you loose data. In my case a month worth of my bayesdb. [:(] 
     
    My backup was from 27/5...
     
    So after restoring it I decided to do someting about it.
    In /etc/wfe/conf there is a file called "backup.ini" in it is the paths and files to backup in the standard astaro backup system.
    Just add these lines to it and your bayesdb will be backed up together with the rest of the system.
     
    etc/mail/spamassassin/local.cf
    var/lib/nobody/.spamassassin
     
     
    This will include them however the backup file will grow a lot, right now my is 4mb. But i guess that it will be 2mb larger in a month or 2.
     
    If you don't want an automated backup. This is how you manualy backup your bayes db and local.cf
     
    cd /var/lib/nobody/.spamassassin/
    su - nobody -- sa-learn --sync
    su - nobody -- sa-learn --backup > backup.txt
    Take backup of /etc/mail/spamassassin/local.cf
     
    To restore backup after a newinstallation (More work but it works...)
    Preprep
    copy old local.cf to the same spot and replace file
    mkdir /var/lib/nobody/.spamassassin
    chown nobody:nobody /var/lib/nobody/.spamassassin
     
    The restore
    copy your backup.txt to /root
    sa-learn --restore backup.txt
    mv .spamassassin/* /var/lib/nobody/.spamassassin/
    chown nobody:nobody /var/lib/nobody/.spamassassin/*
    /var/mdw/scripts/spamassassin restart
     
    This worked for me, And don't fall in to my trap and loose all. Backup your system. I still have not tested the automated backup today not enoght time but i will do so as soon as i find the time. [H] 
     
    Have a nice day! [:)]
  • Can I ask the really really obvious question of,

    1, Why isnt the Bayesian filter enabled?
    2, Why isnt the autowhitelist enabled?

    or at least why aren't the options to enable them available!!
Reply Children
  • Maybe they want to save some "new" features for V7 ??
  • You know I would never of thought that [;)]
  • Hi!
     
    I think that Godsbrother question is the most relevant... [:P] 
     
    I have given that some thought's and the only conclution is that it will require to mutch efford from the develpoers, and in the long run from the local Astaro administrators. 
     
    Remember as I wrote before, Without training it's not that good. Maybe not all admins have the time or knowlage to make it work. 
     
    However with not so mutch efford from my side I had untill yesterday a hitrate round 99,5% 
    My ASL websettings for spam is 1 = Quarantine 15 = Quarantine. 1 is normaly realy low!!! but... thanks to bayes i have no real mail in the quarantine since they all get -10 give or take a few points. [:)]
    The thing is to train it ones! In my case with ONLY HAM.
     
    I realy hope they would include bayes with it's settings and a spam-mbox upload in V7 but I don't beleve in it my self. Sad but true... [[:(]] 
     
    Things i would like to see in V7 regarding SMTP anti spam is...
    1: BayesDB
    2: DCC
    3: Razor2
    4: Seperated scoring for different parts of the spam protection. 
    As an example, 
    RBL = 5p, 
    BayesDB = 10p
    SPF = 5p
    URIBL/SURBL = 10p
     
    5: Then a 3 threshold system not 2 like today.
    6: Redirect spam to other mail address like spam@mydomain.org
     
    KKnecht, Lets hope you are right. But I sadley think not... [[:(]]
  • I've tried turning on use_bayes in local.cf, but I can't get it to actually use the feature.  If I run SpamAssassin from the command line, it uses the Bayesian analysis, but it's not running on incoming emails.  It also doesn't use it when I run spamc by hand.  I ran spamd -D from the command line, and the debug output reports the following problem:

    [21065] dbg: bayes: no dbs present, cannot tie DB R/O: /tmp/spamd-21065-init/.spamassassin/bayes_toks

    Looking at /usr/sbin/spamd, it seems that it changes its home directory to a /tmp directory before loading all the modules (presumably for security reasons); however, it seems that it's then looking there for the bayesian databases, where they obviously won't be.

    Am I the only one having this problem (I'm running 6.301)?

    Thanks for any help you can give me.

    Andrew
  • Hi,

    The path is incorrect /tmp there. I think that is due to your manual run with spamassassin.
    However do these checks please, to see if it has created it's own DB. Since spamassassin runs with nobody the database should be at /var/lib/nobody/.spamassassin/

    Then also spamassassin by default don't use bayes until it have 200 spam and 200 ham.

    Well do this.
    1: Check /var/lib/nobody/.spamassassin/ does it have bayes files in it?
    2: If not Make your changes to /etc/mail/spamassassin/local.cf and then restart spamassassin, /var/mdw/scripts/spamassassin restart

    Hope this will help. I run 6.301 and i have no problems. [:)]
  • I have also done some changes to the location of the bayesdb due to it's size after some time.

    Normaly you have /var/lib/nobody/.spamassassin/ as your database path.
    / in ASL is not very large so I moved it to /var/storage/bayesdb and then securing that path.

    Run as root and stop your spamassassin deamon (stop spamchecking from the smtp proxy webgui)
    1: cd /var/storage
    2: mkdir bayesdb
    3: chmod 700 bayesdb
    4: chown nobody:nobody bayesdb
    5: mv /var/lib/nobody/.spamassassin/* /var/storage/bayesdb/
    6: ln -s /var/storage/bayesdb/bayes.mutex bayes.mutex
    7: ln -s /var/storage/bayesdb/bayes_seen bayes_seen
    8: ln -s /var/storage/bayesdb/bayes_toks bayes_toks
    9: Start spamassassin and check  /var/log/contentfilter.log | grep spamd for errors. Should not be a problem but you never know. [;)]


    Now your files are stored at the larger area of /var/storage [:)]
    This is how it should look with rights and so on...
    firewall:/var/storage/bayesdb # ll
    -rw-r--r--  1 nobody nobody      360 Aug  5 11:14 bayes.mutex
    -rw-------  1 nobody nobody  2711552 Aug  5 11:14 bayes_seen
    -rw-------  1 nobody nobody 10379264 Aug  5 11:14 bayes_toks



     Note!! If you have to update your locations in the backup.ini, Just add var/storage/bayesdb at the end of the file.
  • In the contentfilter.log, I was getting the same error messages:

    2006:08:05-00:11:50 (none) spamd[21065]: bayes: no dbs present, cannot tie DB R/O: /tmp/spamd-21065-init/.spamassassin/bayes_toks 

    But then, suddenly it started working.  Not sure what changed, but whatever....

    Thanks for your help.

    Andrew
  • Hi,

    Okey [:)]
    But you have your db files at /var/lib/nobody/.spamassassin/ ?
    They should not be at /tmp that is bad.

    Please double check this.
  • My DB files are indeed where they should be.

    If you look at the startup script for spamassassin, you'll see that it creates a home directory in temp and then initializes all the modules there, causing it to look for them there.  However, when it processes a message, it seems to go back and look for them in the right place.  I haven't tracked it all down yet.

    If you want to see for yourself, edit the spamassassin startup script to turn on debug mode for spamd.  I don't have access to the firewall right now, so I'll post more explicit instructions in a bit.

    Andrew
  • Okey thats good. My thougt was that he continued to run from /tmp and that is not that good [[;)]]

    I have not gone that deep in the scripts [[;)]]
    I dont have that error in any of my logs as far as i can see. I tried the backup the other day on an new hardware and everything worked directly. No errors what so ever.

    The error could be a one and only apperance due to the lac of db files perheps? Or du you get it over and over again?

    Okey please do so if someone else have this issue it might help them. [:)]

    Btw here is my new local.cf
    # This is the right place to customize your installation of SpamAssassin.
    #
    # See 'perldoc Mail::SpamAssassin::Conf' for details of what can be
    # tweaked.
    #
    # Only a small subset of options are listed below
    #
    ################################################## #########################
    # Add *****SPAM***** to the Subject header of spam e-mails
    #
    # rewrite_header Subject *****SPAM*****

    # Save spam messages as a message/rfc822 MIME attachment instead of
    # modifying the original message (0: off, 2: use text/plain instead)
    #
    # report_safe 1

    # Set which networks or hosts are considered 'trusted' by your mail
    # server (i.e. not spammers) (My internal network)
    #
    trusted_networks 192.168.0.

    # Set file-locking method (flock is not safe over NFS, but is faster)
    #
    lock_method flock

    # Set the threshold at which a message is considered spam (default: 5.0)
    #
    # required_score 5.0

    # Email BULK checking (Not working due to need of seperate software)
    #use_pyzor 1
    #use_dcc 1
    #use_razor2 1


    # Blacklisted recipients
    blacklist_to sales@mydomain.com info@mydomain.com home@mydomain.com root@mydomain.com majordomo@mydomain.com test@mydomain.com uucp@mydomain.com help@mydomain.com service@mydomain.com support@mydomain.com guest@mydomain.com contact@mydomain.com billing@mydomain.com advertising@mydomain.com accounting@mydomain.com accounts@mydomain.com admin@mydomain.com administrator@mydomain.com mail@mydomain.com webmaster@mydomain.com

    # Whitelisted recipients
    whitelist_from pal@hisdomain.com *@otherpaldomain.com


    # Use Bayesian classifier (default: 1)
    #
    use_bayes 1
    use_bayes_rules 1
    bayes_use_hapaxes 1
    bayes_auto_expire 1
    bayes_expiry_max_db_size 10000000
    bayes_min_ham_num 200
    bayes_min_spam_num 200

    # Bayesian classifier auto-learning (default: 1)
    # Threshold have to be min 0.1 for ham and min 6.0 for spam
    bayes_auto_learn 1
    bayes_auto_learn_threshold_nonspam 0.1
    bayes_auto_learn_threshold_spam 6.0
    bayes_learn_to_journal 0

    # Set headers which may provide inappropriate cues to the Bayesian
    # classifier
    #
    bayes_ignore_header X-LOC-Sender-is-local
    bayes_ignore_header X-Bogosity
    bayes_ignore_header X-Virus-Scanned
    bayes_ignore_header X-Authentication-Warning
    bayes_ignore_header X-Trailer
    bayes_ignore_header X-Spam
    bayes_ignore_header X-Spam-Flag
    bayes_ignore_header X-Spam-Status
    bayes_ignore_header X-Spam-Score
    bayes_ignore_header X-Spam-Report
    bayes_ignore_header ReSent-Date
    bayes_ignore_header ReSent-From
    bayes_ignore_header ReSent-Message-ID
    bayes_ignore_header ReSent-Subject
    bayes_ignore_header ReSent-To
    bayes_ignore_header Resent-Date
    bayes_ignore_header Resent-From
    bayes_ignore_header Resent-Message-ID
    bayes_ignore_header Resent-Subject
    bayes_ignore_header Resent-To


    use_auto_whitelist 0

    # Custom score settings
    #
    # Always get low score for internal network
    score ALL_TRUSTED -100

    # Astaro score settings
    #
    score DRUGS_ERECTILE 2
    score DRUGS_ANXIETY_EREC 2
    score HTML_MIME_NO_HTML_TAG 1
    score HTML_MESSAGE 0.0
    score HTML_FONT_BIG 1
    score RCVD_NUMERIC_HELO 2
    score RCVD_BY_IP 1

    # Astaro extra adjust for asia emails
    score MIME_BASE64_TEXT 0.5

    # Astaro DELL and backhair...
    score J_BACKHAIR_11 0.5
    score J_BACKHAIR_12 0.5
    score J_BACKHAIR_13 0.5
    score J_BACKHAIR_14 0.5
    score J_BACKHAIR_15 0.5
    score J_BACKHAIR_16 0.5
    score J_BACKHAIR_17 0.5
    score J_BACKHAIR_21 0.5
    score J_BACKHAIR_21 0.5
    score J_BACKHAIR_22 0.5
    score J_BACKHAIR_23 0.5
    score J_BACKHAIR_24 0.5
    score J_BACKHAIR_25 0.5
    score J_BACKHAIR_26 0.5
    score J_BACKHAIR_27 0.5
    score J_BACKHAIR_31 0.5
    score J_BACKHAIR_31 0.5
    score J_BACKHAIR_32 0.5
    score J_BACKHAIR_33 0.5
    score J_BACKHAIR_34 0.5
    score J_BACKHAIR_35 0.5
    score J_BACKHAIR_36 0.5
    score J_BACKHAIR_37 0.5
    score J_BACKHAIR_41 0.5
    score J_BACKHAIR_41 0.5
    score J_BACKHAIR_42 0.5
    score J_BACKHAIR_43 0.5
    score J_BACKHAIR_44 0.5
    score J_BACKHAIR_45 0.5
    score J_BACKHAIR_46 0.5
    score J_BACKHAIR_47 0.5
    score J_BACKHAIR_51 0.5
    score J_BACKHAIR_51 0.5
    score J_BACKHAIR_52 0.5
    score J_BACKHAIR_53 0.5
    score J_BACKHAIR_54 0.5
    score J_BACKHAIR_55 0.5
    score J_BACKHAIR_56 0.5
    score J_BACKHAIR_57 0.5


    # Franks custom score
    # Special haxx
    #
    # Blacklisted addresses scoring and learning
    header USER_IN_BLACKLIST_TO     eval:check_to_in_blacklist()
    describe USER_IN_BLACKLIST_TO   User is listed in 'blacklist_to'
    tflags USER_IN_BLACKLIST_TO     learn
    #
    score USER_IN_BLACKLIST_TO 15.000

    # Whitelisted addresses scoring and learning nice
    #
    header USER_IN_WHITELIST        eval:check_from_in_whitelist()
    describe USER_IN_WHITELIST      From: address is in the user's white-list
    tflags USER_IN_WHITELIST        nice
    #
    score USER_IN_WHITELIST -15.000

    ##############
    # SenderBase information 
    # these are experimental example rules

    # sa.senderbase.org for SpamAssassin queries
    # query.senderbase.org for other queries
    header __SENDERBASE eval:check_rbl_txt('sb', 'sa.senderbase.org.')
    tflags __SENDERBASE net

    # S23 = domain daily magnitude, S25 = date of first message from this domain
    header SB_NEW_BULK              eval:check_rbl_sub('sb', 'sb:S23 > 6.2 && (time - S25  0.3" means at least a 59% volume spike
    header SB_NSP_VOLUME_SPIKE      eval:check_rbl_sub('sb', 'sb:S5 =~ /NSP/ && S41 > 3.0 && S40 - S41 > 0.3')
    describe SB_NSP_VOLUME_SPIKE    Sender IP hosted at NSP has a volume spike
    tflags SB_NSP_VOLUME_SPIKE      net

    # S5 = category, S40 = IP daily magnitude, S41 = IP monthly magnitude
    # note: accounting for rounding, "> 0.3" means at least a 59% volume spike
    header SB_ISP_VOLUME_SPIKE      eval:check_rbl_sub('sb', 'sb:S5 =~ /ISP/ && S41 > 3.0 && S40 - S41 > 0.3')
    describe SB_ISP_VOLUME_SPIKE    Sender IP hosted at ISP has a volume spike
    tflags SB_ISP_VOLUME_SPIKE      net

    #
    score __SENDERBASE 1.000
    score SB_NEW_BULK 3.000
    score SB_NSP_VOLUME_SPIKE 3.0000
    score SB_ISP_VOLUME_SPIKE 1.0000
    #############

    #
    # Gif
    full     SARE_GIF_ATTACH   /name=\"[a-zA-Z0-9.-]{3,18}\.gif\"/i
    describe SARE_GIF_ATTACH   Email has a inline gif and digits

    #############
    # Special score
    #
    # Extra points for softfail and negative score for pass
    # (Not working what i can see)
    score SPF_PASS -8.000
    score SPF_FAIL 8.000
    score SPF_SOFTFAIL 6.000
    score SPF_HELO_PASS -6.000
    score SPF_HELO_FAIL 6.000
    score SPF_HELO_SOFTFAIL 6.000

    # Extra points for picture spam
    score SARE_GIF_ATTACH 8.000
    score SARE_GIF_STOX 8.000

    # Bayers scoring
    score BAYES_99 15.000
    score BAYES_95 12.500
    score BAYES_80 8.000
    score BAYES_60 4.000
    score BAYES_50 0.000
    score BAYES_40 -4.000
    score BAYES_20 -8.000
    score BAYES_05 -12.500
    score BAYES_00 -15.000