我有一个安装并配置了 sendmail 的 VPS。我在该 VPS 上托管了多个域,最近为其中一个域添加了专用 IP 地址。
我为该域创建了一个单独的 sendmail 配置文件。当我使用-C
这个新配置选项调用 sendmail 时,一切都运行良好,只是电子邮件未使用 DKIM 签名。实际上,它不依赖于所使用的配置文件(以及 IP)——即使我尝试默认配置(-C/etc/mail/sendmail.cf
),opendkim 过滤器也不会应用。
手册页上写道:
-Cfile 使用备用配置文件。如果指定了备用配置文件,Sendmail 将放弃任何增强权限(设置用户 ID 或设置组 ID)。
那么,这与增强的权限有什么关系吗?如果有,有什么解决方法吗?
我已按照以下方式在 sendmail 配置中启用了 DKIM:
INPUT_MAIL_FILTER(`opendkim', `S=inet:8891@localhost')dnl
以下是使用和不使用-C
选项时运行 sendmail 的一些日志:
-C/etc/mail/sendmail.cf
用过的:发送邮件输出:
# sendmail -vt [email protected] -C/etc/mail/sendmail.cf < /path/to/mail.txt [email protected]... Connecting to gmail-smtp-in.l.google.com. via esmtp... ... [some output from google] ...
/var/log/mail.log:
Dec 5 00:06:24 myvps sendmail[6279]: vB556OlG006279: [email protected], size=805, class=0, nrcpts=1, msgid=<201712050506.vB556OlG006279@myvps>, relay=root@localhost Dec 5 00:06:25 myvps sendmail[6279]: STARTTLS=client, relay=gmail-smtp-in.l.google.com., version=TLSv1.2, verify=FAIL, cipher=ECDHE-RSA-CHACHA20-POLY1305, bits=256/256 Dec 5 00:06:25 myvps sendmail[6279]: vB556OlG006279: [email protected], delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=30805, relay=gmail-smtp-in.l.google.com. [173.194.205.27], dsn=2.0.0, stat=Sent (OK 1512450385 e185si2018511qkc.351 - gsmtp)
没有这样的选项:
发送邮件输出:
# sendmail -vt [email protected] < /path/to/mail.txt [email protected]... Connecting to [127.0.0.1] via relay... ... [some output from localhost] ... 050 <[email protected]>... Connecting to gmail-smtp-in.l.google.com. via esmtp... ... [some output from google] ...
/var/log/mail.log:
Dec 5 00:08:11 myvps sendmail[6296]: vB558AuH006296: [email protected], size=805, class=0, nrcpts=1, msgid=<201712050508.vB558AuH006296@myvps>, relay=root@localhost Dec 5 00:08:11 myvps sm-mta[6297]: vB558BNE006297: from=<[email protected]>, size=910, class=0, nrcpts=1, msgid=<201712050508.vB558AuH006296@myvps>, proto=ESMTP, daemon=MTA-v4, relay=localhost [127.0.0.1] Dec 5 00:08:11 myvps sm-mta[6297]: vB558BNE006297: Milter insert (1): header: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mydomain.com;\n\ts=myvpsmail; t=1512450491;\n\tbh=uGDrXIzqExx4lUFxarebEDLDOoCY8YQTsl6PaOLZSPc=;\n\th=Date:To:Subject:From:List-Unsubscribe:List-Subscribe:List-Help:\n\t From;\n\tb=AzeSIjsaNBKAPe7sma3WwqjytilL4P6b7Yn3mySarov5oWMDrq6wRFbVwexrZOfVv\n\t 8jE1kTNx4kBuJLLEx43WVqpnTxfxupz5FrLYiAADBK8JvDoswOjsIswUN5PNF9Me9G\n\t 8ob+akVOtiNo/A/WwH4hhrT8l4lYQwqnUfEzcihy= Dec 5 00:08:11 myvps sm-mta[6297]: STARTTLS=client, relay=gmail-smtp-in.l.google.com., version=TLSv1.2, verify=FAIL, cipher=ECDHE-RSA-CHACHA20-POLY1305, bits=256/256 Dec 5 00:08:12 myvps sm-mta[6297]: vB558BNE006297: to=<[email protected]>, delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=30910, relay=gmail-smtp-in.l.google.com. [209.85.201.26], dsn=2.0.0, stat=Sent (OK 1512450492 k44si3222076qtc.439 - gsmtp) Dec 5 00:08:12 myvps sendmail[6296]: vB558AuH006296: [email protected], [email protected] (0/0), delay=00:00:02, xdelay=00:00:01, mailer=relay, pri=30805, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (vB558BNE006297 Message accepted for delivery)
UPD 2017-12-05:目前我决定通过将新 IP 地址添加到主配置来从新 IP 地址发送所有邮件/etc/mail/sendmail.cf
。如果我找不到可接受的解决方案,我稍后会将该域名移至专用 VPS。