How to reject spam?

Discussion in 'Tips/Tricks/Mods' started by djkoelkast, Dec 31, 2011.

  1. djkoelkast

    djkoelkast New Member

    I've installed ISPConfig 3 with dovecot like on howtoforge.
    It works all very nice, but I can't get the spam rejection working.

    It only tags mails ***SPAM***
    but I changed it to tag: [[SPAM]], it just doesn't
    Also rejection does not work. What am I doing wrong?

    My /etc/amavis/conf.d/50-user is:

    Code:
    use strict;
    
    #
    # Place your configuration directives here.  They will override those in
    # earlier files.
    #
    # See /usr/share/doc/amavisd-new/ for documentation and examples of
    # the directives you can use in this file
    #
    
    @bypass_virus_checks_maps = (
       \%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re);
    
    @bypass_spam_checks_maps = (
       \%bypass_spam_checks, \@bypass_spam_checks_acl, \$bypass_spam_checks_re);
    
    #   
    # Database connection settings
    #
    
    @lookup_sql_dsn =
       ( ['DBI:mysql:database=dbispconfig;host=127.0.0.1;port=3306', 'ispconfig', 'df750c165bef0e83b1b067bbe4fe2f7f'] );
    
    # @storage_sql_dsn = @lookup_sql_dsn;  # none, same, or separate database
    #$sql_select_policy = 'SELECT "Y" as local FROM mail_domain WHERE CONCAT("@",domain) IN (%k)';
    # $banned_files_quarantine_method = 'sql';
    # $spam_quarantine_method         = 'sql';
    
    #
    # SQL Select statements
    #
    
    $sql_select_policy =
       'SELECT *,spamfilter_users.id'.
       ' FROM spamfilter_users LEFT JOIN spamfilter_policy ON spamfilter_users.policy_id=spamfilter_policy.id'.
       ' WHERE spamfilter_users.email IN (%k) ORDER BY spamfilter_users.priority DESC';
    
    
    $sql_select_white_black_list = 'SELECT wb FROM spamfilter_wblist'.
        ' WHERE (spamfilter_wblist.rid=?) AND (spamfilter_wblist.email IN (%k))' .
        ' ORDER BY spamfilter_wblist.priority DESC';
    
    #
    # Quarantine settings
    #
    
    $final_virus_destiny = D_REJECT;
    $final_spam_destiny = D_REJECT;
    $final_banned_destiny = D_REJECT;
    $final_bad_header_destiny = D_PASS;
    
    # Default settings, we st this very high to not filter aut emails accidently
    $sa_spam_subject_tag = '[[SPAM]] ';
    $sa_tag_level_deflt  = 5;  # add spam info headers if at, or above that level
    $sa_tag2_level_deflt = 6; # add 'spam detected' headers at that level
    $sa_kill_level_deflt = 6; # triggers spam evasive actions
    $sa_dsn_cutoff_level = 9;   # spam level beyond which a DSN is not sent
    
    #
    # Disable spam and virus notifications for the admin user.
    # Can be overridden by the policies in mysql
    #
    
    $virus_admin = undef;
    $spam_admin = undef;
    
    
    #
    # Enable Logging
    #
    
    $DO_SYSLOG = 1;
    $LOGFILE = "/var/log/amavis.log";  # (defaults to empty, no log)
    
    # Set the log_level to 5 for debugging
    $log_level = 1;                # (defaults to 0)
    
    
    #------------ Do not modify anything below this line -------------
    1;  # insure a defined return
    
    
    I restarted amavis, still it tags: ***SPAM*** and does not reject.
    Although I put log_level to 1 it does not log (or is there only 0 and 5).

    Any help would be great, I get a huge amount of spam.
     
  2. madsage

    madsage New Member

    I too am experiencing the same issue.


    and have set 50-user to D_REJECT

    Still my clients are receiving email marked ***SPAM***


    also, i find no /var/log/amavis.log as per the 50-user in /etc/amavis/conf.d
    I touched one and chowned it to amavis, also tunred debug level to 5 in 50-user, nothing output.


    EDIT:
    Fixed logging. you have to set;
    $DO_SYSLOG = 0
    $LOGFILE = "/var/log/amavis.log"
    $log_level = 5

    I guess its either syslog or logfile, not both. so turn off syslog if you want amavis.log



    I'm waiting on spam now. to see if it rejects

    madsage
    3.0.4.1 on debian-6 x64 multiserver
     
    Last edited: Jan 4, 2012
  3. madsage

    madsage New Member

    Mine seems to have quit passing emails marked ***SPAM*** now.

    Changing the /etc/amavis/conf.d/user-50 to $final_spam_destiny = D_REJECT;
    Seems to have resolved this issue, Also I set the users spam level to trigger happy. (I assume this just changes the spam score to a more sensitive threshold?)

    madsage
     
  4. djkoelkast

    djkoelkast New Member

    I already did (please see my config file, it's there).
    Also: I changed it to [[SPAM]] but it still uses ***SPAM*** so it seems to ignore this all together.
     
  5. madsage

    madsage New Member

    weird, it seems like your is not parsing the user-50. possibly..
    i was able to confirm my by turning syslog to 0;
    and touching the logfile for amavis in the second line.

    you sure you are using amavis-ng? or maybe the old version.

    madsage
     
  6. djkoelkast

    djkoelkast New Member

    I can't tell you, how van I check the version? I installed ISPConfig 3 through the howto and for as far as I know everything is the latest version.
    Could it be because I don't use courier but dovecot in stead?
     
  7. nveid

    nveid New Member

    This might not completely answer your question.. But this is how I manage reject spam..

    Subscribe to some RBL's :)

    There may be better setups, but this works form.. I reject based upon RBL listing, invalid RDNS, non-fqdn, among other things. works great, :)

    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated,reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_unknown_client, reject_unauth_destination, reject_rhsbl_client blackhole.securitysage.com, reject_rhsbl_sender blackhole.securitysage.com, reject_rbl_client relays.ordb.org, reject_rbl_client blackholes.easynet.nl, reject_rbl_client cbl.abuseat.org, reject_rbl_client proxies.blackholes.wirehub.net, reject_rbl_client bl.spamcop.net, reject_rbl_client sbl.spamhaus.org, reject_rbl_client opm.blitzed.org,
    reject_rbl_client dnsbl.njabl.org,
    reject_rbl_client list.dsbl.org ,
    reject_rbl_client multihop.dsbl.org,
    check_recipient_access mysql:/etc/postfix/mysql-virtual_recipient.cf
     
    Last edited: Jan 17, 2012
  8. djkoelkast

    djkoelkast New Member

    My spam *tagging* works fine, so it does detect spam, I have had no false positives whatsoever. I just want to reject them in stead of tagging and I can't find where, it's not on the normal places.
     
  9. radim_h

    radim_h Member HowtoForge Supporter

    In ISPConfig go to the menu
    Email=>Email Mailbox=>then click on mailbox=>then click on Mail Filter=>Then check the checkbox =>Move Spam Emails to Junk directory
     
    Last edited: Jan 17, 2012
  10. djkoelkast

    djkoelkast New Member

    That's per mailbox, I'd like to have it done server wide, so globally reject all spam. It should be able to configure this.
     
  11. radim_h

    radim_h Member HowtoForge Supporter

Share This Page