我正在尝试使用 Dovecot 虚拟用户和 sendmail,基于这个帖子使用 sendmail、dovecot-lda 和 sendmail 的 mailertable 查找。
这是大多工作正常。剩下的唯一问题是来自本地主机的电子邮件(来自 cron 或其他)。在这种情况下,似乎忽略了 sendmail 邮件程序定义中的 username:group,并且 sendmail 在运行 dovecot-lda 时使用发送邮件的本地用户的 uid/gid。
Sendmail.mc 有以下内容:
Mdovecot,
P=/usr/lib/dovecot/dovecot-lda,
F=l59DFMPhnu,
S=EnvFromL/HdrFromL,
R=EnvToL/HdrToL,
M=51200000,
U=vmail:vmail,
T=DNS/RFC822/X-Unix,
A=/usr/lib/dovecot/dovecot-lda -d $u
这对于该主机接收的外部电子邮件来说工作正常,但是当 sendmail 尝试传递本地发送的电子邮件时,它会失败并出现 dovecot-lda 的以下错误(当本地用户 bitnami 向虚拟用户 greg 发送电子邮件时):
Nov 24 09:59:46 aws dovecot: lda(greg): Fatal: setgid(122(vmail) from userdb lookup) failed with euid=1000(bitnami), gid=1000(bitnami), egid=1000(bitnami): Operation not permitted (This binary should probably be called with process group set to 122(vmail) instead of 1000(bitnami))
Nov 24 09:59:46 aws sm-mta[24675]: 0AO9rRtq024592: to=greg@vmail, ctladdr=<bitnami@*deleted*> (1000/1000), delay=00:06:19, xdelay=00:00:00, mailer=dovecot, pri=180630, relay=dummy, dsn=4.0.0, stat=Deferred: dovecot mailer (/usr/lib/dovecot/dovecot-lda) exited with EX_TEMPFAIL
EX_TEMPFAIL 导致邮件排队,并且它会卡在 sendmail 队列中(每次队列运行时都会引发相同的错误)直到超时并反弹。
这个错误似乎是说U=vmail:vmail
在这种情况下 Sendmail 邮件程序定义中的条目被忽略了,但是(假设)在电子邮件来自该站点之外的情况下,它会被遵守。
谁能解释一下这里发生了什么以及如何解决它?
根据要求,完整日志
Nov 24 09:53:27 aws sm-mta[24592]: 0AO9rRtq024592: from=<bitnami@aws.*deleted*>, size=347, class=0, nrcpts=1, msgid=<202011240953.0AO9rRPG024591@aws.*deleted*>, proto=ESMTPS, daemon=MTA
-v4, relay=localhost [127.0.0.1]
Nov 24 09:53:27 aws sendmail[24591]: 0AO9rRPG024591: to=<greg@*deleted*>, ctladdr=bitnami@aws.*deleted* (1000/1000), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30089, relay=[127
.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (0AO9rRtq024592 Message accepted for delivery)
Nov 24 09:53:27 aws sm-mta[24593]: 0AO9rRtq024592: to=/home/greg/greg.mbox, ctladdr=<greg@*deleted*> (8/0), delay=00:00:00, xdelay=00:00:00, mailer=*file*, pri=90630, dsn=2.0.0, stat=Sent
Nov 24 09:53:27 aws sm-mta[24593]: 0AO9rRtq024592: to=greg@vmail, ctladdr=<bitnami@aws.*deleted*> (1000/1000), delay=00:00:00, xdelay=00:00:00, mailer=dovecot, pri=90630, relay=dummy, ds
n=4.0.0, stat=Deferred: dovecot mailer (/usr/lib/dovecot/dovecot-lda) exited with EX_TEMPFAIL
Nov 24 09:53:28 aws sm-mta[24593]: 0AO9rRtq024592: to=*myuser*@*also-deleted*, ctladdr=<bitnami@aws.*deleted*> (1000/1000), delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=90630, relay=asav.*also-deleted*. [x.x.x.x], dsn=2.0.0, stat=Sent (ok: Message 473950264 accepted)
Nov 24 09:59:46 aws sm-mta[24675]: 0AO9rRtq024592: SYSERR(root): putbody: write error: Broken pipe
Nov 24 09:59:46 aws sm-mta[24675]: 0AO9rRtq024592: 0: fl=0x8000, mode=20666: CHR: dev=0/6, ino=6, nlink=1, u/gid=0/0, size=0
Nov 24 09:59:46 aws sm-mta[24675]: 0AO9rRtq024592: 1: fl=0x8001, mode=20666: CHR: dev=0/6, ino=6, nlink=1, u/gid=0/0, size=0
Nov 24 09:59:46 aws sm-mta[24675]: 0AO9rRtq024592: 2: fl=0x8001, mode=20666: CHR: dev=0/6, ino=6, nlink=1, u/gid=0/0, size=0
Nov 24 09:59:46 aws sm-mta[24675]: 0AO9rRtq024592: 3: fl=0x2, mode=140777: SOCK localhost->[[UNIX: /run/systemd/journal/dev-log]]
Nov 24 09:59:46 aws sm-mta[24675]: 0AO9rRtq024592: 4: fl=0x8002, mode=100640: dev=202/1, ino=1283627, nlink=1, u/gid=0/118, size=981
Nov 24 09:59:46 aws sm-mta[24675]: 0AO9rRtq024592: 5: fl=0x8000, mode=100640: dev=202/1, ino=1285769, nlink=1, u/gid=0/118, size=13
Nov 24 09:59:46 aws sm-mta[24675]: 0AO9rRtq024592: 6: fl=0x8000, mode=100640: dev=202/1, ino=1037622, nlink=1, u/gid=0/118, size=12288
Nov 24 09:59:46 aws sm-mta[24675]: 0AO9rRtq024592: 7: fl=0x8000, mode=100640: dev=202/1, ino=1037622, nlink=1, u/gid=0/118, size=12288
Nov 24 09:59:46 aws sm-mta[24675]: 0AO9rRtq024592: 8: fl=0x8000, mode=100640: dev=202/1, ino=1037621, nlink=1, u/gid=0/118, size=12288
Nov 24 09:59:46 aws sm-mta[24675]: 0AO9rRtq024592: 9: fl=0x8000, mode=100640: dev=202/1, ino=1037621, nlink=1, u/gid=0/118, size=12288
Nov 24 09:59:46 aws sm-mta[24675]: 0AO9rRtq024592: 11: fl=0x1, mode=10600: FIFO: dev=0/10, ino=10889509, nlink=1, u/gid=0/118, size=0
Nov 24 09:59:46 aws sm-mta[24675]: 0AO9rRtq024592: 12: fl=0x0, mode=10600: FIFO: dev=0/10, ino=10889510, nlink=1, u/gid=0/118, size=0
Nov 24 09:59:46 aws sm-mta[24675]: 0AO9rRtq024592: MCI@0x0: NULL
Nov 24 09:59:46 aws sm-mta[24675]: 0AO9rRtq024592: MCI@0x0: NULL
Nov 24 09:59:46 aws sm-mta[24675]: 0AO9rRtq024592: to=greg@vmail, ctladdr=<bitnami@aws.*deleted*> (1000/1000), delay=00:06:19, xdelay=00:00:00, mailer=dovecot, pri=180630, relay=dummy, d
sn=4.0.0, stat=Deferred: dovecot mailer (/usr/lib/dovecot/dovecot-lda) exited with EX_TEMPFAIL
初始电子邮件被发送到三个目的地,一个本地文件(这样我就不会在发生这一切时丢失邮件),一个 ISP 邮箱,以及通过 dovecot-lda 的失败尝试。9:59 处的序列最初每 10 分钟重复一次,直到 5 天后消息最终超时。
通过此主机的 SMTP 接收的邮件传送正常,只有源自此主机的邮件出现故障。
答案1
它看起来像直接传递尝试,而不是将消息传递给以 root 身份运行的本地 sendmail 守护程序 [sendmail-8.12+ 默认安装方式]
您的 sendmail 二进制文件是否已安装为设置组 ID?
是否存在 /etc/mail/submit.cf?
您是否已从发行版软件包安装了 sendmail?[哪个发行版?]