指定执行 spamc 的用户时,Postfix/spamassassin 不会传递到别名

指定执行 spamc 的用户时,Postfix/spamassassin 不会传递到别名

我已经安装了 SpamAssassin 并将其配置为从 sql 中读取首选项。我意识到它没有读取用户的首选项,检查日志后我发现客户端发送的所有请求spamc都是以 spamd 用户身份执行的。

以下是 spamc 客户端如何按照master.cf文件 (Postfix) 中的配置执行:

spamassassin unix -     n       n       -       -       pipe
        user=spamd argv=/usr/bin/spamc  -f -e
        /usr/sbin/sendmail -oi -f ${sender} ${recipient}

我将其添加-u ${recipient}到 spamc,并在日志中看到它起作用了,现在用户的偏好设置已被正确获取。

然而,这种情况会破坏我对别名的传递。

考虑[email protected]作为[email protected]和 的后缀别名[email protected]。将上述内容添加到-uspamc导致无法向别名发送电子邮件。

当 Postfix 无法发送电子邮件时,会出现以下情况:

Feb 14 21:12:36 mail postfix/qmgr[51620]: 6EFD11003F5: from=<[email protected]>, size=2588, nrcpt=2 (queue active)
Feb 14 21:12:37 mail postfix/pipe[51637]: 6EFD11003F5: to=<[email protected]>, orig_to=<[email protected]>, relay=spamassassin, delay=1.3, delays=0.03/0/0/1.3, dsn=2.0.0, status=sent (delivered via spamassassin service (X-Spam-Level:  X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,SPF_HELO_PASS  autolearn=ha))
Feb 14 21:12:37 mail postfix/pipe[51637]: 6EFD11003F5: to=<[email protected]>, orig_to=<[email protected]>, relay=spamassassin, delay=1.3, delays=0.03/0/0/1.3, dsn=2.0.0, status=sent (delivered via spamassassin service (X-Spam-Level:  X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,SPF_HELO_PASS  autolearn=ha))
Feb 14 21:12:37 mail postfix/qmgr[51620]: 6EFD11003F5: removed

我删除了-u ${recipient},一切又恢复正常了,但是从以下日志中我没有找到太多帮助:

Feb 14 21:14:36 mail postfix/master[51877]: daemon started -- version 3.4.13, configuration /etc/postfix
Feb 14 21:15:26 mail postfix/qmgr[51880]: B9C531003F5: from=<[email protected]>, size=2580, nrcpt=2 (queue active)
Feb 14 21:15:27 mail postfix/pipe[51932]: B9C531003F5: to=<[email protected]>, orig_to=<[email protected]>, relay=spamassassin, delay=1.2, delays=0.04/0.01/0/1.1, dsn=2.0.0, status=sent (delivered via spamassassin service)
Feb 14 21:15:27 mail postfix/pipe[51932]: B9C531003F5: to=<[email protected]>, orig_to=<[email protected]>, relay=spamassassin, delay=1.2, delays=0.04/0.01/0/1.1, dsn=2.0.0, status=sent (delivered via spamassassin service)
Feb 14 21:15:27 mail postfix/qmgr[51880]: B9C531003F5: removed
Feb 14 21:15:27 mail postfix/qmgr[51880]: E19B7106C31: from=<[email protected]>, size=2969, nrcpt=2 (queue active)
Feb 14 21:15:28 mail postfix/qmgr[51880]: 01875106C30: from=<[email protected]>, size=3336, nrcpt=1 (queue active)

当 spamassassin 不起作用时,其日志如下:

Sun Feb 14 21:12:36 2021 [50514] info: spamd: processing message <[email protected]> for [email protected]:5000
Sun Feb 14 21:12:36 2021 [50514] info: dns: no callback for id 21026/IN/A/bluetreehotels.com.br.dbl.spamhaus.org, ignored, packet on next debug line
Sun Feb 14 21:12:36 2021 [50514] info: dns: no likely matching queries for id 21026
Sun Feb 14 21:12:37 2021 [51696] info: util: setuid: ruid=5000 euid=5000 rgid=5000 5000 5000 egid=5000 5000 5000
Sun Feb 14 21:12:37 2021 [50514] info: spamd: clean message (-1.9/3.0) for [email protected]:5000 in 1.3 seconds, 2502 bytes.
Sun Feb 14 21:12:37 2021 [50514] info: spamd: result: . -1 - BAYES_00,SPF_HELO_PASS scantime=1.3,size=2502,[email protected],uid=5000,required_score=3.0,rhost=127.0.0.1,raddr=127.0.0.1,rport=43164,mid=<[email protected]>,bayes=0.000000,autolearn=ham autolearn_force=no
Sun Feb 14 21:12:37 2021 [50512] info: prefork: child states: II

当它正常工作时,就像这样:

Sun Feb 14 21:15:26 2021 [50514] info: spamd: connection from 127.0.0.1 [127.0.0.1]:43402 to port 783, fd 5
Sun Feb 14 21:15:26 2021 [50514] info: spamd: processing message <[email protected]> for spamd:5000
Sun Feb 14 21:15:26 2021 [51934] info: util: setuid: ruid=5000 euid=5000 rgid=5000 5000 5000 egid=5000 5000 5000
Sun Feb 14 21:15:27 2021 [50514] info: spamd: clean message (-0.0/5.0) for spamd:5000 in 1.1 seconds, 2494 bytes.
Sun Feb 14 21:15:27 2021 [50514] info: spamd: result: . 0 - SPF_HELO_PASS scantime=1.1,size=2494,user=spamd,uid=5000,required_score=5.0,rhost=127.0.0.1,raddr=127.0.0.1,rport=43402,mid=<[email protected]>,autolearn=ham autolearn_force=no

有什么线索可以解释为什么会发生这种情况吗?这里明显的区别是,当 spamassassin 无法工作时,我们在 spamassassin 日志中看到 是spamc使用用户调用的[email protected](而不是使用[email protected][email protected])。别名所代表的所有收件人都没有收到电子邮件。第二次尝试时,没有参数-u,则 spamc 在没有发送用户名的情况下执行(无法使用默认spamd用户),并且邮件被传递给用户ab

可能吗sendmail

最好的,

弗朗西斯

答案1

我认为我已经修复了这个问题。添加spamassassin_destination_recipient_limit = 1main.cf(postfix) 就可以解决问题。

相关内容