获取权限被拒绝 lmtp/sieve 错误

获取权限被拒绝 lmtp/sieve 错误

我第一次在运行 postfix/dovecot/lmtp 的 Debian 机器上设置 sieve。它可以正常工作,但是我想清除一直出现的错误:

lmtp(joeblow)<17980><GG5KL91cf188RgAAajKqBA>: Error: sieve: binary save: failed to create temporary file: open(/var/lib/dovecot/sieve/default.svbin.) failed: Permission denied (euid=1008(joeblow) egid=1009(joeblow) missing +w perm: /var/lib/dovecot/sieve, dir owned by 0:0 mode=0755)

lmtp(joeblow)<17980><GG5KL91cf188RgAAajKqBA>: Error: sieve: The LDA Sieve plugin does not have permission to save global Sieve script binaries; global Sieve scripts like '/var/lib/dovecot/sieve/default.sieve' need to be pre-compiled using the sievec tool

据我所知,它是在收到电子邮件时进入的。如果我有 lmtp,我不太确定我是否需要 lda,但我真的不知道我在做什么,所以完全不知道该怎么做。我花了一段时间才弄清楚这个配置,几天前我就搞定了。

我的 90-sieve.conf 文件:

plugin {
  sieve = file:~/sieve;active=~/.dovecot.sieve
  sieve_default = /var/lib/dovecot/sieve/default.sieve
  sieve_default_name = Defaults
  sieve_global = /var/lib/dovecot/sieve
  sieve_user_log = ~/.dovecot.sieve.log
}
# 2.3.4.1 (f79e8e7e4): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.4 ()
# OS: Linux 4.19.0-11-cloud-amd64 x86_64 Debian 10.6
auth_debug = yes
auth_debug_passwords = yes
auth_mechanisms = plain login
auth_username_format = %Ln
auth_verbose = yes
mail_debug = yes
mail_location = maildir:~/Maildir
mail_privileged_group = mail
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 {
    special_use = \Drafts
  }
  mailbox Junk {
    auto = subscribe
    special_use = \Junk
  }
  mailbox Sent {
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    special_use = \Sent
  }
  mailbox Trash {
    special_use = \Trash
  }
  prefix =
}
passdb {
  driver = pam
}
plugin {
  sieve = file:~/sieve;active=~/.dovecot.sieve
  sieve_default = /var/lib/dovecot/sieve/default.sieve
  sieve_default_name = Defaults
  sieve_global = /var/lib/dovecot/sieve
  sieve_user_log = ~/.dovecot.sieve.log
}
protocols = " imap lmtp sieve pop3 sieve"
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0666
    user = postfix
  }
  unix_listener auth-userdb {
    mode = 0666
  }
}
service imap-login {
  inet_listener imap {
    port = 143
  }
  inet_listener imaps {
    port = 993
    ssl = yes
  }
  service_count = 1
}
service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    group = postfix
    mode = 0600
    user = postfix
  }
}
service managesieve-login {
  inet_listener sieve {
    port = 4190
  }
  process_min_avail = 1
}
service pop3-login {
  inet_listener pop3s {
    port = 995
    ssl = yes
  }
}
service pop3 {
  process_limit = 1024
}
service submission {
  process_limit = 1024
}
ssl_cert = </opt/bitnami/letsencrypt/certificates/email.example.org.crt
ssl_client_ca_dir = /etc/ssl/certs
ssl_dh = # hidden, use -P to show it
ssl_key = # hidden, use -P to show it
userdb {
  driver = passwd
}
protocol lmtp {
  mail_plugins = " sieve"
}
protocol lda {
  mail_plugins = " sieve"

答案1

让我们解析这个错误信息

lmtp (joeblow)<17980>:

这是 LMTP 服务正在与您对话

错误:筛选:LDA Sieve 插件没有权限保存全局 Sieve 脚本二进制文件;

您正在全局应用一些筛选过滤,并且 LMTP 服务(更具体地说,交付部分,因此称为术语LDA)被配置为调用筛选过滤,而筛选过滤目前无法写入全局脚本的二进制缓存。

全局 Sieve 脚本(例如“/var/lib/dovecot/sieve/default.sieve”)需要使用 sievec 工具进行预编译

这正是您可以采取的措施来解决这个问题 - 编译您的文件:

sievec /var/lib/dovecot/sieve/default.sieve

这将创建该文件的二进制缓存,/var/lib/dovecot/sieve/default.svbin可供筛选插件使用。

Dovecot 本来可以自动调用这个,但是你的文件权限禁止它(在你的设置中这是理所当然的,因为通过 PAM 进行身份验证意味着用户以自己的身份登录,如euid=上面的提示所示)。因此只能sievec手动调用。

相关内容