Postfix与Dovecot配置公共共享邮箱(support/contact)无法接收外部邮件问题求助
大家好,我现在碰到个头疼的问题:想搭建support@domain.extension、contact@domain.extension这类公共共享邮箱,让外部能发邮件进来,同时内部用户可以通过Dovecot的共享文件夹访问这些邮箱内容。目前卡在Postfix和Dovecot的衔接环节,邮件一直退信,想请各位帮忙看看哪里配置出错了。
已完成的Dovecot共享文件夹配置
我已经在Dovecot的15-mailboxes.conf里配置了共享命名空间,内部用户能看到Shared目录下的support和contact文件夹,并且用ACL控制访问权限:
namespace { type = shared separator = / prefix = Shared/ location = mbox:/mail/shared subscriptions = no list = children mailbox support { auto = subscribe } mailbox contact { auto = subscribe } }
Postfix的配置尝试与冲突问题
为了让support和contact邮箱能接收外部邮件,我创建了/etc/postfix/virtualmaps文件,内容如下:
support@domain.extension support contact@domain.extension contact
之后执行了postmap /etc/postfix/virtualmaps生成映射库。
接着在main.cf里添加了这些配置:
virtual_mailbox_base = /mail/shared virtual_mailbox_maps = lmdb:/etc/postfix/virtualmaps
但如果加上virtual_mailbox_domains = $mydomain,Postfix就报错说mydestination和virtual_mailbox_domains不能指向同一个域名,这部分不敢随便修改。另外,所有用户都是LDAP用户,不是系统本地用户。
后续调整及新问题
后来根据提示尝试调整local_recipient_maps,还配置了local_delivery把邮件转交给Dovecot,但还是没解决问题:
- 仅启用
local_recipient_maps时,Postfix直接返回“unknown user: support” - 加上
local_delivery后,Postfix把邮件转给Dovecot,但Dovecot提示找不到LDAP用户“support@domain.test”
我也参考了Dovecot官方的共享邮箱文档,但还是没找到解决方案。
相关日志信息
仅启用local_recipient_maps时的日志:
2023-07-17T14:18:21.117842+02:00 tst postfix/pickup[5200]: 1CA20213BC0: uid=0 from=<testmail@domain.test> 2023-07-17T14:18:21.127591+02:00 tst postfix/cleanup[5212]: 1CA20213BC0: message-id=<64b5318d.5XutEBb44MdWM3yJ%testmail@domain.test> 2023-07-17T14:18:21.167058+02:00 tst postfix/qmgr[5199]: 1CA20213BC0: from=<testmail@domain.test>, size=449, nrcpt=1 (queue active) 2023-07-17T14:18:21.230250+02:00 tst postfix/local[5214]: 1CA20213BC0: to=<support@domain.test>, relay=local, delay=0.13, delays=0.06/0.03/0/0.03, dsn=5.1.1, status=bounced (unknown user: "support") 2023-07-17T14:18:21.231069+02:00 tst postfix/cleanup[5212]: 38487213BC2: message-id=<20230717121821.38487213BC2@tst.nru.test> 2023-07-17T14:18:21.233902+02:00 tst postfix/bounce[5215]: 1CA20213BC0: sender non-delivery notification: 38487213BC2 2023-07-17T14:18:21.233966+02:00 tst postfix/qmgr[5199]: 38487213BC2: from=<>, size=2226, nrcpt=1 (queue active) 2023-07-17T14:18:21.234323+02:00 tst postfix/qmgr[5199]: 1CA20213BC0: removed 2023-07-17T14:18:21.235893+02:00 tst postfix/local[5214]: 38487213BC2: to=<testmail@domain.test>, relay=local, delay=0.01, delays=0/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
启用local_recipient_maps和local_delivery时的日志:
2023-07-20T13:09:48.958737+02:00 tst postfix/qmgr[31655]: 274CA215D35: from=<testmail@domain.test>, size=449, nrcpt=1 (queue active) 2023-07-20T13:09:48.993036+02:00 tst dovecot: lda(support@domain.test)<31682><>: Debug: Loading modules from directory: /usr/lib64/dovecot/modules 2023-07-20T13:09:48.993428+02:00 tst dovecot: lda(support@domain.test)<31682><>: Debug: Module loaded: /usr/lib64/dovecot/modules/lib01_acl_plugin.so 2023-07-20T13:09:48.993549+02:00 tst dovecot: lda(support@domain.test)<31682><>: Debug: auth-master: userdb lookup(support@domain.test): Started userdb lookup 2023-07-20T13:09:48.993643+02:00 tst dovecot: lda(support@domain.test)<31682><>: Debug: auth-master: conn unix:/var/run/dovecot//auth-userdb: Connecting 2023-07-20T13:09:48.993756+02:00 tst dovecot: lda(support@domain.test)<31682><>: Debug: auth-master: conn unix:/var/run/dovecot//auth-userdb (pid=26599,uid=0): Client connected (fd=8) 2023-07-20T13:09:48.996561+02:00 tst dovecot: lda(support@domain.test)<31682><>: Debug: auth-master: userdb lookup(support@domain.test): auth USER input: 2023-07-20T13:09:48.996672+02:00 tst dovecot: lda(support@domain.test)<31682><>: Debug: auth-master: userdb lookup(support@domain.test): Userdb lookup failed 2023-07-20T13:09:48.996765+02:00 tst dovecot: lda(31682): Debug: auth-master: conn unix:/var/run/dovecot//auth-userdb (pid=26599,uid=0): Disconnected: Connection closed (fd=8) 2023-07-20T13:09:49.003457+02:00 tst postfix/pipe[31681]: 274CA215D35: to=<support@domain.test>, relay=dovecot, delay=903, delays=903/0.01/0/0.03, dsn=5.1.1, status=bounced (user unknown. Command output: lda(support@domain.test): Error: net_connect_unix(/var/run/dovecot//stats-writer) failed: Permission denied ) 2023-07-20T13:09:49.009715+02:00 tst postfix/cleanup[31684]: 0233E215EBD: message-id=<20230720110949.0233E215EBD@tst.nru.test> 2023-07-20T13:09:49.012518+02:00 tst postfix/bounce[31683]: 274CA215D35: sender non-delivery notification: 0233E215EBD 2023-07-20T13:09:49.012577+02:00 tst postfix/qmgr[31655]: 0233E215EBD: from=<>, size=2430, nrcpt=1 (queue active) 2023-07-20T13:09:49.012611+02:00 tst postfix/qmgr[31655]: 274CA215D35: removed 2023-07-20T13:09:49.022166+02:00 tst dovecot: lda(testmail@domain.test)<31685><>: Debug: Loading modules from directory: /usr/lib64/dovecot/modules 2023-07-20T13:09:49.022500+02:00 tst dovecot: lda(testmail@domain.test)<31685><>: Debug: Module loaded: /usr/lib64/dovecot/modules/lib01_acl_plugin.so 2023-07-20T13:09:49.022610+02:00 tst dovecot: lda(testmail@domain.test)<31685><>: Debug: auth-master: userdb lookup(testmail@domain.test): Started userdb lookup 2023-07-20T13:09:49.022700+02:00 tst dovecot: lda(testmail@domain.test)<31685><>: Debug: auth-master: conn unix:/var/run/dovecot//auth-userdb: Connecting 2023-07-20T13:09:49.022821+02:00 tst dovecot: lda(testmail@domain.test)<31685><>: Debug: auth-master: conn unix:/var/run/dovecot//auth-userdb (pid=26599,uid=0): Client connected (fd=8) 2023-07-20T13:09:49.025074+02:00 tst dovecot: lda(testmail@domain.test)<31685><>: Debug: auth-master: userdb lookup(testmail@domain.test): auth USER input: 2023-07-20T13:09:49.025181+02:00 tst dovecot: lda(testmail@domain.test)<31685><>: Debug: auth-master: userdb lookup(testmail@domain.test): Userdb lookup failed 2023-07-20T13:09:49.025271+02:00 tst dovecot: lda(31685): Debug: auth-master: conn unix:/var/run/dovecot//auth-userdb (pid=26599,uid=0): Disconnected: Connection closed (fd=8) 2023-07-20T13:09:49.027037+02:00 tst postfix/pipe[31681]: 0233E215EBD: to=<testmail@domain.test>, relay=dovecot, delay=0.02, delays=0.01/0/0/0.01, dsn=5.1.1, status=bounced (user unknown. Command output: lda(testmail@domain.test): Error: net_connect_unix(/var/run/dovecot//stats-writer) failed: Permission denied ) 2023-07-20T13:09:49.027394+02:00 tst postfix/qmgr[31655]: 0233E215EBD: removed
现在实在找不到问题根源了,有没有大佬能指点一下,怎么让Postfix把邮件正确投递到Dovecot的共享邮箱里,同时不影响现有LDAP用户的邮件接收?
备注:内容来源于stack exchange,提问作者Kiwimarc

