Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Amavisd on SQL + per-user quarantine

2007-03-14
2013-04-11
  • Hello list,

    I'm trying to configure amavisd-new to work with virtual users (in Postfix), and policy of them are stored in Postgres.
    I've alrealdy managed to set per-user policy, such as spam-tags, spam-score, etc ...works fine.
    But I want to have a per-user quarantine, but i dont want to store spams in postgres, but in dedicated folders for each virtual users.

    I've try to use recipient delimiter n o managed per user quarantine, like this :
    * when i send a spam to jo@test.net, I've configured his user policy (in amavis) to quarantine to jo+spam@test.net
       (with my SQL policy table as  - spam_quarantine_to='spam-quarantine'
                                                        - addr_extension_spam='spam'
                                                        - spam_tag_level=3, spam_tag2_level=6.9,
                                                        - spam_kill_level=999
                                                        - spam_quarantine_cutoff_level=999
    *with this trick with recipient delimiter, I want the spam to go in the subfolder "spam" of jo@test.net 's mailbox

    I really don't manage to do it, when i send a (gtube)spam to such a mailbox, it goes directly in the normal inbox.

    *********************************
    For more precisions, my setup for amavisd-new :

    $final_virus_destiny      = D_BOUNCE;  # (data not lost, see virus quarantine)
    $final_banned_destiny     = D_BOUNCE;   # D_REJECT when front-end MTA
    $final_spam_destiny       = D_DISCARD;
    $final_bad_header_destiny = D_PASS;

    @lookup_sql_dsn =
      ( ['DBI:Pg:database=abms2;host=localhost', 'mailreader', 'secret']);

    #lookup des politiques spam via sql : indique comment amavis delivre le spam en quarantaine
    $spam_quarantine_method = 'local:';

    ##decommenter pour activer le stockage des mails dans postgres
    #@storage_sql_dsn = @lookup_sql_dsn;

    #Redefinition requete SQL de récupération des information sur la politique de l'utilisateur %k
    $sql_select_policy = 'SELECT *,users.id FROM users,policy'.
      ' WHERE (users.policy_id=policy.id) AND (users.email IN (%k))'.
      ' ORDER BY users.priority DESC';

    #Redefinition requete SQL de récupération des informations sur les white/black listes de l'utilisateur %k
      $sql_select_white_black_list = 'SELECT wb FROM wblist,mailaddr'.
        ' WHERE (wblist.rid=?) AND (wblist.sid=mailaddr.id)'.
        '   AND (mailaddr.email IN (%k))'.
        ' ORDER BY mailaddr.priority DESC';

    $recipient_delimiter = '+';
    #@addr_extension_spam_maps = ('spam');
    *********************************

    Does anybody have some info to solve my problem ?
    Or is there any other way to have per user quarantine in some dedicated folder ?

    Regards, Jo.