我们系统上的本地用户使用 procmail 通过 spamd 传递邮件。我们在 Ubuntu 22.04 上使用 Postfix。
Postfix 邮件条目首先显示邮件 ID,例如:
Jul 30 07:54:18 alice postfix/qmgr[235769]: 2C704BA328: from=<[email protected]>, size=61699, nrcpt=1 (queue active)
日志中的 spamd 行如下所示,但未提及 ID:
Jul 30 07:54:18 alice spamd[1860392]: spamd: connection from ::1 [::1]:44212 to port 783, fd 5
Jul 30 07:54:18 alice spamd[1860392]: spamd: setuid to slucy succeeded
Jul 30 07:54:18 alice spamd[1860392]: spamd: processing message <NM63EC74D6C01FA8E1Fbootsuk_mid_prod1-Ym91bmNlQG1haWwuYm9vdHMuY29t@mail.boots.com> for sslucy:1832
Jul 30 07:54:20 alice spamd[2047327]: util: setuid: ruid=1832 euid=1832 rgid=1835 1951 egid=1835 1951
Jul 30 07:54:23 alice spamd[1860392]: spamd: clean message (-3.1/7.8) for slucy:1832 in 5.0 seconds, 61039 bytes.
Jul 30 07:54:23 alice spamd[1860392]: spamd: result: . -3 - DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,HTML_FONT_LOW_CONTRAST,HTML_MESSAGE,MAILING_LIST_MULTI,MIME_HTML_ONLY,RCVD_IN_DNSWL_NONE,RCVD_IN_VALIDITY_SAFE,SPF_HELO_NONE,SPF_PASS,T_KAM_HTML_FONT_INVALID scantime=5.0,size=61039,user=sslucy,uid=1832,required_score=7.8,rhost=::1,raddr=::1,rport=44212,mid=<NM63EC74D6C01FA8E1Fbootsuk_mid_prod1-Ym91bmNlQG1haWwuYm9vdHMuY29t@mail.boots.com>,autolearn=ham autolearn_force=no
Jul 30 07:54:23 alice spamd[1734900]: prefork: child states: II
如果我们仅搜索邮件 ID,我们会看到:
Jul 30 07:54:18 alice postfix/smtpd[2047298]: 2C704BA328: client=r105.mail.boots.com[130.248.198.105]
Jul 30 07:54:18 alice postfix/cleanup[2046192]: 2C704BA328: message-id=<NM63EC74D6C01FA8E1Fbootsuk_mid_prod1-Ym91bmNlQG1haWwuYm9vdHMuY29t@mail.boots.com>
Jul 30 07:54:18 alice opendmarc[411763]: 2C704BA328: SPF(mailfrom): mail.boots.com pass
Jul 30 07:54:18 alice opendmarc[411763]: 2C704BA328: mail.boots.com pass
Jul 30 07:54:18 alice postfix/qmgr[235769]: 2C704BA328: from=<[email protected]>, size=61699, nrcpt=1 (queue active)
Jul 30 07:54:23 alice postfix/local[2046202]: 2C704BA328: to=<[email protected]>, orig_to=<[email protected]>, relay=local, delay=5.8, delays=0.74/0/0/5, dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION")
Jul 30 07:54:23 alice postfix/qmgr[235769]: 2C704BA328: removed
根据Spamassassin 文档,mid
spamd 日志中的字段表示邮件 ID,但它似乎仅在某些情况下对应于 Postfix 邮件 ID,但并非所有情况(据我所知)都如此。
有没有一种方法可以可靠地将 spamd 进程与给定的 Postfix 邮件 ID 关联起来,以便我们可以分析整个流程?