![Arch Linux:Dovecot Sieve 脚本无法编译](https://linux22.com/image/709795/Arch%20Linux%EF%BC%9ADovecot%20Sieve%20%E8%84%9A%E6%9C%AC%E6%97%A0%E6%B3%95%E7%BC%96%E8%AF%91.png)
- Arch Linux
- Linux 内核 4.9.36(64 位)
- Dovecot 2.2.31 (65cde28)
- SpamAssassin 版本 3.4.1 在 Perl 版本 5.26.0 上运行
- 鸽巢 0.4.19-1
尝试按照 Arch Linux Wiki 的说明设置邮件服务器筛子教程(这是我在关注虚拟用户邮件系统教程)。
这应该可以启用spamtest
和。逐字逐句地实现 Wiki 所要求的功能,但为了易读性,删除文档注释spamtestplus
除外。sieve_trace_debug
/etc/dovecot/conf.d/90-sieve.conf
:
plugin {
sieve = file:~/sieve;active=~/.dovecot.sieve
# Start Arch Linux Wiki Config <https://wiki.archlinux.org/index.php/Dovecot#Sieve>
sieve_extensions = +spamtest +spamtestplus
sieve_spamtest_status_type = score
sieve_spamtest_status_header = \
X-Spam_score: (-?[[:digit:]]+\.[[:digit:]]).*
sieve_spamtest_max_value = 5.0
sieve_before = /var/lib/dovecot/sieve/global_sieves/move_to_spam_folder.sieve
# End Arch Linux Wiki Config
sieve_trace_debug = yes
}
这应该将垃圾邮件路由到垃圾邮件文件夹。
/var/lib/dovecot/sieve/global_sieves/move_to_spam_folder.sieve
:
require "spamtestplus";
require "fileinto";
require "relational";
require "comparator-i;ascii-numeric";
if spamtest :value "ge" :comparator "i;ascii-numeric" "5" {
fileinto "Junk";
}
尝试编译以上内容。
$ sudo sievec /var/lib/dovecot/sieve/global_sieves/move_to_spam_folder.sieve
:
move_to_spam_folder: line 1: error: require command: unknown Sieve capability `spamtestplus'.
move_to_spam_folder: line 6: error: unknown test 'spamtest' (only reported once at first occurrence).
move_to_spam_folder: error: validation failed.
sievec(foo): Error: failed to compile sieve script '/var/lib/dovecot/sieve/global_sieves/move_to_spam_folder.sieve’
由于找不到spamtest
和,所以不起作用spamtestplus
。所以我测试了配置。
sudo sieve-test -t - -Tlevel=matching /etc/dovecot/conf.d/90-sieve.conf /home/foo/test.eml
:
90-sieve.conf: line 2: error: unexpected character(s) starting with '='.
90-sieve.conf: line 2: error: expected end of command ';' or the beginning of a compound block '{', but found unknown characters.
90-sieve.conf: line 2: error: unexpected character(s) starting with '~'.
90-sieve.conf: line 2: error: unexpected character(s) starting with '='.
90-sieve.conf: line 2: error: expected end of command ';' or the beginning of a compound block '{', but found unknown characters.
90-sieve.conf: line 2: error: unexpected character(s) starting with '.'.
90-sieve.conf: line 2: error: unexpected character(s) starting with '.'.
90-sieve.conf: line 5: error: unexpected character(s) starting with '='.
90-sieve.conf: line 5: error: unexpected character(s) starting with '+'.
90-sieve.conf: line 5: error: unexpected character(s) starting with '+'.
90-sieve.conf: line 7: error: unexpected character(s) starting with '='.
90-sieve.conf: line 8: error: unexpected character(s) starting with '='.
90-sieve.conf: line 8: error: unexpected character(s) starting with '\'.
90-sieve.conf: line 9: error: unexpected character(s) starting with '-'.
90-sieve.conf: line 9: error: unexpected character(s) starting with '-'.
90-sieve.conf: line 9: error: unexpected character(s) starting with '+'.
90-sieve.conf: line 9: error: unexpected character(s) starting with '.'.
90-sieve.conf: line 10: error: unexpected character(s) starting with '='.
90-sieve.conf: line 10: error: unexpected character(s) starting with '.'.
90-sieve.conf: line 12: error: unexpected character(s) starting with '='.
90-sieve.conf: line 12: error: unexpected character(s) starting with '.'.
90-sieve.conf: line 15: error: unexpected character(s) starting with '='.
90-sieve.conf: error: parse failed.
显然它根本读不懂/etc/dovecot/conf.d/90-sieve.conf
?而且它还写不清等号??
似乎如果我修复这个错误,我就可以启用spamtest
和spamtestplus
,这反过来会[潜在地]修复sievec
编译错误。
doveconf -n
:
# 2.2.31 (65cde28): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.19 (e5c7051)
# OS: Linux 4.9.36-x86_64-linode85 x86_64 Arch Linux
mail_home = /home/vmail/%d/%n
mail_location = maildir:~
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
passdb {
args = /etc/dovecot/dovecot-sql.conf
driver = sql
}
protocols = imap pop3
service auth {
unix_listener auth-client {
group = postfix
mode = 0660
user = postfix
}
user = root
}
ssl_cert = </etc/ssl/private/vmail.crt
ssl_key = # hidden, use -P to show it
userdb {
args = /etc/dovecot/dovecot-sql.conf
driver = sql
}
答案1
您的特定于筛选器的配置根本不来自 Dovecot。如果您使用“每个功能”配置文件,您的/etc/dovecot/dovecot.conf
文件应该包含类似这样的语句
# Most of the actual configuration gets included below. The filenames are
# first sorted by their ASCII value and parsed in that order. The 00-prefixes
# in filenames are intended to make it easier to understand the ordering.
!include conf.d/*.conf
该文件包含 中的各个配置文件conf.d
。