使用 postfix 和 dovecot 共享邮件地址

使用 postfix 和 dovecot 共享邮件地址

我正在尝试设置一些共享邮箱,如联系人或支持。

通过在 15-mailboxes.conf 中执行此操作,我可以在 Dovecot 中的用户之间共享 IMAP 文件夹

namespace {
  type = shared
  separator = /
  prefix = Shared/
  location = mbox:/mail/shared
  subscriptions = no
  list = children
  mailbox support {
    auto = subscribe
  }
  mailbox contact {
    auto = subscribe
  }
}

然后我使用 ACL 来控制谁有权访问每个文件夹。

我想公开支持和联系邮件地址,这样您就可以给他们发送电子邮件。但 postfix 一直说用户不存在。我创建了一个名为 /etc/postfix/virtualmaps 的文件并对其进行了 postmap。

[email protected] support
[email protected] contact

在我的 postfix main.cf 中,我添加了以下内容:

virtual_mailbox_base = /mail/shared
virtual_mailbox_maps = lmdb:/etc/postfix/virtualmaps

如果我添加 virtual_mailbox_domains = $mydomain,postfix 会抛出错误并说 mydestination 和 virtual_mailbox_domains 不能相同。

所有用户都是 ldap 用户

编辑1

@NikitaKipriyanov 向我指出了local_recipient_maps然后我发现local_delivery将所有东西都传递给dovecot。

它仍然不起作用,但现在 dovecot 找不到 ldap 用户

编辑2

Docecot 具有构建共享 IMAP 收件箱的功能:https://doc.dovecot.org/configuration_manual/shared_mailboxes/#shared-mailboxes

以下是 local_recipient_maps 处于活动状态的一些日志:

2023-07-17T14:18:21.117842+02:00 tst postfix/pickup[5200]: 1CA20213BC0: uid=0 from=<[email protected]>
2023-07-17T14:18:21.127591+02:00 tst postfix/cleanup[5212]: 1CA20213BC0: message-id=<64b5318d.5XutEBb44MdWM3yJ%[email protected]>
2023-07-17T14:18:21.167058+02:00 tst postfix/qmgr[5199]: 1CA20213BC0: from=<[email protected]>, size=449, nrcpt=1 (queue active)
2023-07-17T14:18:21.230250+02:00 tst postfix/local[5214]: 1CA20213BC0: to=<[email protected]>, 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=<[email protected]>
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=<[email protected]>, 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=<[email protected]>, size=449, nrcpt=1 (queue active)
2023-07-20T13:09:48.993036+02:00 tst dovecot: lda([email protected])<31682><>: Debug: Loading modules from directory: /usr/lib64/dovecot/modules
2023-07-20T13:09:48.993428+02:00 tst dovecot: lda([email protected])<31682><>: Debug: Module loaded: /usr/lib64/dovecot/modules/lib01_acl_plugin.so
2023-07-20T13:09:48.993549+02:00 tst dovecot: lda([email protected])<31682><>: Debug: auth-master: userdb lookup([email protected]): Started userdb lookup
2023-07-20T13:09:48.993643+02:00 tst dovecot: lda([email protected])<31682><>: Debug: auth-master: conn unix:/var/run/dovecot//auth-userdb: Connecting
2023-07-20T13:09:48.993756+02:00 tst dovecot: lda([email protected])<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([email protected])<31682><>: Debug: auth-master: userdb lookup([email protected]): auth USER input:
2023-07-20T13:09:48.996672+02:00 tst dovecot: lda([email protected])<31682><>: Debug: auth-master: userdb lookup([email protected]): 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=<[email protected]>, relay=dovecot, delay=903, delays=903/0.01/0/0.03, dsn=5.1.1, status=bounced (user unknown. Command output: lda([email protected]): 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=<[email protected]>
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([email protected])<31685><>: Debug: Loading modules from directory: /usr/lib64/dovecot/modules
2023-07-20T13:09:49.022500+02:00 tst dovecot: lda([email protected])<31685><>: Debug: Module loaded: /usr/lib64/dovecot/modules/lib01_acl_plugin.so
2023-07-20T13:09:49.022610+02:00 tst dovecot: lda([email protected])<31685><>: Debug: auth-master: userdb lookup([email protected]): Started userdb lookup
2023-07-20T13:09:49.022700+02:00 tst dovecot: lda([email protected])<31685><>: Debug: auth-master: conn unix:/var/run/dovecot//auth-userdb: Connecting
2023-07-20T13:09:49.022821+02:00 tst dovecot: lda([email protected])<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([email protected])<31685><>: Debug: auth-master: userdb lookup([email protected]): auth USER input:
2023-07-20T13:09:49.025181+02:00 tst dovecot: lda([email protected])<31685><>: Debug: auth-master: userdb lookup([email protected]): 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=<[email protected]>, relay=dovecot, delay=0.02, delays=0.01/0/0/0.01, dsn=5.1.1, status=bounced (user unknown. Command output: lda([email protected]): 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

答案1

我找到解决办法了!

如果我仅使用 postfix 别名功能,我可以让 postfix 直接将其发送到邮箱,而不是查找“用户”是否存在

所以我的方法是更新我的别名文件并添加:

support /mail/shared/support
contact /mail/shared/contact

我必须测试这是否意味着我绕过了 spamassasin 和病毒扫描程序。当我知道

相关内容