Author Topic: [SOLVED] Spam is not moved to the Spam folder  (Read 2473 times)

devnull

  • Zen Apprentice
  • *
  • Posts: 17
  • Karma: +12/-0
    • View Profile
[SOLVED] Spam is not moved to the Spam folder
« on: May 13, 2020, 12:11:39 pm »
Hi,
I have a problem with a Mailfilter. Spam messages seem to be detected as spam but they are not moved to Spam folder.

logs:
Code: [Select]
May 13 11:57:26 zmail amavis[21919]: (21919-06) Passed SPAM, [127.0.0.1] <ebqydmv@balanates.network> -> <somemail@test.pl>, Message-ID: <ebqydmv81588488.46120154@mail.balanates.network>, Hits: 9.671
May 13 11:57:26 zmail postfix/smtp[23215]: C8022A406B9: to=<somemail@test.pl>, orig_to=<somemail@test.pl>, relay=127.0.0.1[127.0.0.1]:10024, delay=4.5, delays=1.8/0/0/2.7, 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 7EAE9A406D7)
May 13 11:57:26 zmail postfix/qmgr[31053]: C8022A406B9: removed
May 13 11:57:26 zmail dovecot: lda(somemail@test.pl): sieve: msgid=<ebqydmv81588488.46120154@mail.balanates.network>: stored mail into mailbox 'INBOX'


/var/vmail/default.sieve:
Code: [Select]
require ["fileinto"];
# rule:[SPAM]
if header :contains "X-Spam-Flag" "YES" {
 fileinto "Spam";
}
if header :contains "subject" ["***UNCHECKED***", "SPAM"] {
 fileinto "Spam";
}

dovecot -n:
Code: [Select]
# 2.2.33.2 (d6601f4ec): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.21 (92477967)
# OS: Linux 4.15.0-99-generic x86_64 Ubuntu 18.04.4 LTS ext4
auth_gssapi_hostname = zmail.test.pl
auth_krb5_keytab = /etc/dovecot/dovecot.keytab
auth_mechanisms = gssapi plain
first_valid_gid = 113
first_valid_uid = 107
listen = *
log_timestamp = "%Y-%m-%d %H:%M:%S "
mail_gid = ebox
mail_home = /var/vmail/%d/%u
mail_location = maildir:/var/vmail/%d/%u/Maildir
mail_uid = ebox
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext
namespace inbox {
  inbox = yes
  location =
  mailbox Drafts {
    auto = subscribe
    special_use = \Drafts
  }
  mailbox Sent {
    auto = subscribe
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    auto = no
    special_use = \Sent
  }
  mailbox Spam {
    auto = create
    special_use = \Junk
  }
  mailbox Trash {
    auto = subscribe
    special_use = \Trash
  }
  prefix =
  separator = /
  subscriptions = yes
}
passdb {
  args = /etc/dovecot/dovecot-ldap.conf
  driver = ldap
}
plugin {
  quota = maildir:User quota
  quota_rule = *:storage=0
  sieve = /var/vmail/%Ld/%Ln/sieve-script
  sieve_dir = /var/vmail/%Ld/%Ln
  sieve_global_path = /var/vmail/default.sieve
  sieve_storage = /var/vmail/%Ld/%Ln
}
protocols = pop3 imap sieve
service auth {
  executable = /usr/lib/dovecot/auth
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0660
    user = postfix
  }
  unix_listener auth-master {
    group = ebox
    mode = 0600
    user = ebox
  }
}
service imap-login {
  inet_listener imap {
    address = *
    port = 143
  }
  inet_listener imaps {
    address = *
    port = 993
  }
}
service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    group = postfix
    mode = 0666
    user = postfix
  }
}
service managesieve-login {
  inet_listener sieve {
    port = 4190
  }
}
service pop3-login {
  inet_listener pop3 {
    port = 110
  }
  inet_listener pop3s {
    port = 995
  }
}
ssl_cert = </etc/dovecot/private/dovecot.pem
ssl_key =  # hidden, use -P to show it
userdb {
  args = /etc/dovecot/dovecot-ldap.conf
  default_fields = uid=107 gid=113
  driver = ldap
}
protocol imap {
  mail_max_userip_connections = 20
  mail_plugins = quota imap_quota
}
protocol pop3 {
  mail_plugins = quota
}
protocol lda {
  auth_socket_path = /var/run/dovecot/auth-master
  mail_plugins = sieve quota
  postmaster_address = postmaster
}





EDIT:
It reveals that after the upgrade some unwanted config files appeared in /etc/amavis/conf.d/

Code: [Select]
sudo grep -rnw '/etc/amavis/conf.d/' -e '@local_domains_acl ='
/etc/amavis/conf.d/01-zentyal:102:@local_domains_acl = qw( mydomain.pl mydomain-internal.pl zmail.mydomain-internal.pl );  # $mydomain and its subdomains
/etc/amavis/backup/05-domain_id:17:@local_domains_acl = ( ".$mydomain" );

@local_domains_acl
in /etc/amavis/backup/05-domain_id file has overwritten the @local_domains_acl from /etc/amavis/conf.d/01-zentyal

I've found also 20-debian_defaults  and 21-ubuntu_defaults which shoulden't be there. On the clean install of the Zentysal 6.1 there are only: 01-debian.dpkg-dist  01-zentyal  15-av_scanners.dpkg-dist  amavisd.conf

« Last Edit: May 15, 2020, 10:32:17 am by devnull »