LINUX.ORG.RU
решено ФорумAdmin

sieve-filter не видит виртуальных пользователей

 ,


1

1

Добрый день Хочется прогнать sieve скрипты на уже существующих письмах, но sieve-filter не видит виртуальных пользователей.

sieve-filter -v -u postmaster@domain.tld ~/sieve/managesieve.sieve INBOX
sieve-filter(root): Fatal: Unknown user

Во всяких формах писал пользователя, и даже подсовывал конфиг, и от vmail запускал

sudo -u vmail sieve-filter -c /etc/dovecot/dovecot.conf -v -u test@domain.tld /var/vmail/sieve/dovecot.sieve INBOX
sieve-filter(vmail): Fatal: Unknown user

Если не указать пользователя -u, то он пытается всё проделать в домашней папке текущего пользователя.

Как его заставить увидеть виртуальных пользователей?

Ubuntu 20.04, iRedMail, dovecot 2.3.7.2 (3c910f64b), база в OpenLDAP



Последнее исправление: abyss (всего исправлений: 1)

Без конфигов dovecot-а сложно что-то сказать

doveadm виртуальных пользователей видит нормально?

Pinkbyte ★★★★★
()
Ответ на: комментарий от Pinkbyte

dovecot -n

# 2.3.7.2 (3c910f64b): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.7.2 ()
# OS: Linux 5.4.0-96-generic x86_64 Ubuntu 20.04.3 LTS 
# Hostname: mail.domain.tld
auth_default_realm = domain.tld
auth_master_user_separator = *
auth_mechanisms = PLAIN LOGIN
deliver_log_format = from=%{from}, envelope_sender=%{from_envelope}, subject=%{subject}, msgid=%m, size=%{size}, delivery_time=%{delivery_time}ms, %$
dict {
  acl = mysql:/etc/dovecot/dovecot-share-folder.conf
  lastlogin = mysql:/etc/dovecot/dovecot-last-login.conf
  quotadict = mysql:/etc/dovecot/dovecot-used-quota.conf
}
first_valid_uid = 2000
last_valid_uid = 2000
listen = * [::]
login_log_format_elements = user=<%u> method=%m rip=%r lip=%l mpid=%e %c %k session=<%{session}>
mail_attachment_dir = /var/vmail/attachment/%d/
mail_gid = 2000
mail_location = maildir:%Lh/Maildir/:INDEX=%Lh/Maildir/
mail_plugins = quota mailbox_alias acl mail_log notify
mail_uid = 2000
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 = yes
  location = 
  mailbox Archive {
    auto = no
    special_use = \Archive
  }
  mailbox Archives {
    auto = no
    special_use = \Archive
  }
  mailbox "Deleted Messages" {
    auto = no
    special_use = \Trash
  }
  mailbox Drafts {
    auto = subscribe
    special_use = \Drafts
  }
  mailbox Junk {
    auto = subscribe
    special_use = \Junk
  }
  mailbox "Junk E-mail" {
    auto = no
    special_use = \Junk
  }
  mailbox Sent {
    auto = subscribe
    special_use = \Sent
  }
  mailbox "Sent Items" {
    auto = no
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    auto = no
    special_use = \Sent
  }
  mailbox Spam {
    auto = no
    special_use = \Junk
  }
  mailbox Trash {
    auto = subscribe
    special_use = \Trash
  }
  prefix = 
  separator = /
  type = private
}
namespace {
  list = children
  location = maildir:%%Lh/Maildir/:INDEX=%%Lh/Maildir/Shared/%%Ld/%%Ln
  prefix = Shared/%%u/
  separator = /
  subscriptions = yes
  type = shared
}
passdb {
  args = /etc/dovecot/dovecot-ldap.conf
  driver = ldap
}
passdb {
  args = /etc/dovecot/dovecot-master-users
  driver = passwd-file
  master = yes
}
plugin {
  acl = vfile
  acl_shared_dict = proxy::acl
  last_login_dict = proxy::lastlogin
  last_login_key = # hidden, use -P to show it
  mail_log_events = delete undelete expunge copy mailbox_create mailbox_delete mailbox_rename
  mail_log_fields = uid box msgid size from subject flags
  mailbox_alias_new = Sent Messages
  mailbox_alias_new2 = Sent Items
  mailbox_alias_old = Sent
  mailbox_alias_old2 = Sent
  quota = dict:user::proxy::quotadict
  quota_grace = 10%%
  quota_status_nouser = DUNNO
  quota_status_overquota = 552 5.2.2 Mailbox is full
  quota_status_success = DUNNO
  quota_warning = storage=100%% quota-warning 100 %u
  quota_warning2 = storage=95%% quota-warning 95 %u
  quota_warning3 = storage=90%% quota-warning 90 %u
  quota_warning4 = storage=85%% quota-warning 85 %u
  sieve = ~/sieve/dovecot.sieve
  sieve_before = /var/vmail/sieve/dovecot.sieve
  sieve_dir = ~/sieve
  sieve_global_dir = /var/vmail/sieve
  sieve_max_redirects = 30
  sieve_vacation_send_from_recipient = yes
}
protocols = pop3 imap sieve lmtp
service auth {
  unix_listener /var/spool/postfix/private/dovecot-auth {
    group = postfix
    mode = 0666
    user = postfix
  }
  unix_listener auth-master {
    group = vmail
    mode = 0666
    user = vmail
  }
  unix_listener auth-userdb {
    group = vmail
    mode = 0660
    user = vmail
  }
}
service dict {
  unix_listener dict {
    group = vmail
    mode = 0660
    user = vmail
  }
}
service imap-login {
  process_limit = 500
  service_count = 1
}
service lmtp {
  executable = lmtp -L
  inet_listener lmtp {
    address = 127.0.0.1
    port = 24
  }
  process_min_avail = 5
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    group = postfix
    mode = 0600
    user = postfix
  }
  user = vmail
}
service managesieve-login {
  inet_listener sieve {
    address = 127.0.0.1
    port = 4190
  }
}
service pop3-login {
  service_count = 1
}
service quota-status {
  client_limit = 1
  executable = quota-status -p postfix
  inet_listener {
    address = 127.0.0.1
    port = 12340
  }
}
service quota-warning {
  executable = script /usr/local/bin/dovecot-quota-warning.sh
  unix_listener quota-warning {
    group = vmail
    mode = 0660
    user = vmail
  }
}
service stats {
  fifo_listener stats-mail {
    mode = 0644
    user = vmail
  }
  inet_listener {
    address = 127.0.0.1
    port = 24242
  }
  unix_listener stats-writer {
    group = vmail
    mode = 0660
    user = vmail
  }
}
ssl = required
ssl_cert = </etc/ssl/certs/iRedMail.crt
ssl_cipher_list = EECDH+CHACHA20:EECDH+AESGCM:EDH+AESGCM:AES256+EECDH
ssl_dh = # hidden, use -P to show it
ssl_key = # hidden, use -P to show it
ssl_min_protocol = TLSv1.2
ssl_prefer_server_ciphers = yes
syslog_facility = local5
userdb {
  args = /etc/dovecot/dovecot-ldap.conf
  driver = ldap
}
protocol lda {
  lda_mailbox_autocreate = yes
  lda_mailbox_autosubscribe = yes
  mail_plugins = quota mailbox_alias acl mail_log notify sieve
}
protocol lmtp {
  lmtp_save_to_detail_mailbox = yes
  mail_plugins = quota mailbox_alias acl mail_log notify sieve
  recipient_delimiter = +
}
protocol imap {
  imap_client_workarounds = tb-extra-mailbox-sep
  mail_max_userip_connections = 30
  mail_plugins = quota mailbox_alias acl mail_log notify imap_quota imap_acl last_login
}
protocol pop3 {
  mail_max_userip_connections = 30
  mail_plugins = quota mailbox_alias acl mail_log notify last_login
  pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
  pop3_uidl_format = %08Xu%08Xv
}

Видит пользователей

root@mail:~# doveadm user test@domain.tld
field   value
uid     2000
gid     2000
home    /var/vmail/vmail1/domain.tld/t/e/s/test-2022.01.22.05.55.26/
mail    sdbox:~/sdbox/
master_user     test@domain.tld
quota_rule      *:bytes=1073741824

Вся система работает нормально, sieve скрипты на входящие отрабатывают

Как я понимаю внешней альтернативы sieve-filter нет? Нужна интеграция с dovecot?

abyss
() автор топика
Ответ на: комментарий от abyss

Нужна интеграция с dovecot?

Отдельно ничего делать не надо, если dovecot видит пользователей и правила sieve отрабатывают, то и sieve-filter должен видеть пользователей

Попробовал на корпоративном почтовом ящике - sieve-filter работает.

Как выглядят настройки в /etc/dovecot/conf.d/90-sieve.conf ?

Pinkbyte ★★★★★
()
Ответ на: комментарий от Pinkbyte

Как выглядят настройки в /etc/dovecot/conf.d/90-sieve.conf ?

Всё по-умолчанию, единственная раскоментированная строка

sieve = file:~/sieve;active=~/.dovecot.sieve

Попробовал на корпоративном почтовом ящике - sieve-filter работает.

ОС такая же? Ubuntu 20.04 ?

abyss
() автор топика

А ларчик просто открывался…

sieve-filter -u test

Jan 27 03:38:03 mail dovecot: auth: Debug: master in: USER#0111#011test#011service=sieve-filter
Jan 27 03:38:03 mail dovecot: auth: Debug: ldap(test@domain.tld): Performing userdb lookup
Jan 27 03:38:03 mail dovecot: auth: Debug: ldap(test@domain.tld): user search: base=o=domains,dc=mail,dc=domain,dc=tld scope=subtree filter=(&(objectClass=mailUser)(accountStatus=active)(!(domainStatus=disabled))(enabledService=mail)(enabledService=sieve-filter)(|(mail=test@domain.tld)(&(enabledService=shadowaddress)(shadowAddress=test@domain.tld)))) fields=mail,mail,homeDirectory,mailboxFormat,mailboxFolder,mailQuota
Jan 27 03:38:03 mail dovecot: auth: Debug: ldap(test@domain.tld): no fields returned by the server
Jan 27 03:38:03 mail dovecot: auth: ldap(test@domain.tld): unknown user
Jan 27 03:38:03 mail dovecot: auth: Debug: ldap(test@domain.tld): Finished userdb lookup
Jan 27 03:38:03 mail dovecot: auth: Debug: userdb out: NOTFOUND#0111

doveadm user test

Jan 27 03:38:08 mail dovecot: auth: Debug: master in: USER#0111#011test#011service=doveadm#011debug
Jan 27 03:38:08 mail dovecot: auth: Debug: ldap(test@domain.tld): Performing userdb lookup
Jan 27 03:38:08 mail dovecot: auth: Debug: ldap(test@domain.tld): user search: base=o=domains,dc=mail,dc=domain,dc=tld scope=subtree filter=(&(objectClass=mailUser)(accountStatus=active)(!(domainStatus=disabled))(enabledService=mail)(enabledService=doveadm)(|(mail=test@domain.tld)(&(enabledService=shadowaddress)(shadowAddress=test@domain.tld)))) fields=mail,mail,homeDirectory,mailboxFormat,mailboxFolder,mailQuota
Jan 27 03:38:08 mail dovecot: auth: Debug: ldap(test@domain.tld): result: mail=test@domain.tld homeDirectory=/var/vmail/vmail1/domain.tld/t/r/a/test-2022.01.21.10.09.47/ mailQuota=1073741824 mailboxFolder=sdbox mailboxFormat=sdbox; mailboxFormat,homeDirectory,mailQuota,mail,mailboxFolder unused
Jan 27 03:38:08 mail dovecot: auth: Debug: ldap(test@domain.tld): Finished userdb lookup
Jan 27 03:38:08 mail dovecot: auth: Debug: userdb out: USER#0111#011test@domain.tld#011master_user=test@domain.tld#011home=/var/vmail/vmail1/domain.tld/t/r/a/test-2022.01.21.10.09.47/#011mail=sdbox:~/sdbox/#011quota_rule=*:bytes=1073741824

(enabledService=sieve-filter) не включен для пользователей…

но сообщение об ошибке Unknown user конечно вводит в заблуждение

abyss
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.