web-dev-qa-db-fra.com

Spam-Mail toujours dans la boîte de réception et non dans le répertoire ".Spam" (Postfix + Dovecot + SpamAssasian + ClamAV)

Comme le titre l'indique déjà, je reçois toujours des courriers indésirables dans ma boîte de réception et je ne suis pas redirigé vers le répertoire Postfix Spam ".Spam" pour chaque utilisateur de messagerie. Des idées pourquoi? (Ubuntu 14.04.1 avec Postfix + Dovecot + SpamAssasian + ClamAV)

Ma configuration est la suivante:

/etc/amavis/conf.d/20-debian_defaults

$QUARANTINEDIR = "$MYHOME/virusmails";

/etc/amavis/conf.d/20-debian_defaults

@whitelist_sender_acl = qw( .$mydomain );
$final_virus_destiny      = D_DISCARD; # (defaults to D_BOUNCE)
$final_banned_destiny     = D_DISCARD;  # (defaults to D_BOUNCE)
$final_spam_destiny       = D_PASS;  # D_DISCARD (defaults to D_REJECT)
$final_bad_header_destiny = D_PASS;  # (defaults to D_PASS), D_BOUNCE suggested

/var/log/mail.log

    Jan  2 01:11:47 h2376680 dovecot: imap-login: Login: user=<[email protected]>, method=PLAIN, rip=::1, lip=::1, mpid=29949, TLS, session=<LwXFL6ALuQAAAAAAAAAAAAAAAAAAAAAB>
Jan  2 01:11:47 h2376680 dovecot: imap([email protected]): Disconnected: Logged out in=59 out=477
Jan  2 01:11:50 h2376680 postfix/smtpd[29951]: connect from localhost[127.0.0.1]
Jan  2 01:11:50 h2376680 postfix/smtpd[29951]: 78A6D36502180: client=localhost[127.0.0.1]
Jan  2 01:11:50 h2376680 postfix/cleanup[29943]: 78A6D36502180: message-id=<[email protected]>
Jan  2 01:11:50 h2376680 postfix/qmgr[26016]: 78A6D36502180: from=<[email protected]>, size=2115, nrcpt=1 (queue active)

Jan  2 01:11:50 h2376680 amavis[29933]: (29933-01) Passed SPAM {RelayedTaggedInternal,Quarantined}, LOCAL [::1]:54297 [::1] <[email protected]> -> <[email protected]>, quarantine: Z/spam-ZbwHIOZCG3mB.gz, Queue-ID: 2CFFD36501BFF, Message-ID: <[email protected]>, mail_id: ZbwHIOZCG3mB, Hits: 999.002, size: 1265, queued_as: 78A6D36502180, 3183 ms

Jan  2 01:11:50 h2376680 postfix/smtp[29945]: 2CFFD36501BFF: to=<[email protected]>, relay=127.0.0.1[127.0.0.1]:10024, delay=3.3, delays=0.06/0.1/0.01/3.2, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 78A6D36502180)
Jan  2 01:11:50 h2376680 postfix/qmgr[26016]: 2CFFD36501BFF: removed
Jan  2 01:11:50 h2376680 dovecot: lmtp(29953): Connect from local
Jan  2 01:11:50 h2376680 dovecot: lmtp(29953, [email protected]): rfsRIEbipVQBdQAA6SEkQA: msgid=<[email protected]>: saved mail to INBOX
Jan  2 01:11:50 h2376680 postfix/lmtp[29952]: 78A6D36502180: to=<[email protected]>, relay=example.com[private/dovecot-lmtp], delay=0.07, delays=0.01/0.02/0.01/0.03, dsn=2.0.0, status=sent (250 2.0.0 <[email protected]> rfsRIEbipVQBdQAA6SEkQA Saved)
Jan  2 01:11:50 h2376680 dovecot: lmtp(29953): Disconnect from local: Successful quit
Jan  2 01:11:50 h2376680 postfix/qmgr[26016]: 78A6D36502180: removed
1
udgru

La solution qui fonctionne pour mon système Ubuntu 14.04, merci à vous les gars:

Sudo apt-get install dovecot-sieve

Sudo nano /etc/dovecot/conf.d/20-lmtp.conf

protocol lmtp {
    mail_plugins = $mail_plugins sieve
}

Sudo nano /etc/dovecot/conf.d/90-sieve.conf

plugin {
    sieve_before = /var/mail/sieve/spam-global.sieve
    sieve_dir = /var/mail/vhosts/%d/%n/sieve/scripts/
    sieve = /var/mail/vhosts/%d/%n/sieve/active-script.sieve
}

cd /var/mail
mkdir sieve
cd sieve
touch spam-global.sieve
chown -R vmail:mail /var/mail/sieve/

Sudo nano /var/mail/sieve/spam-global.sieve

    require "fileinto";
    if header :contains "X-Spam-Flag" "YES" {
      fileinto "Spam";
    }

service dovecot restart
1
udgru