refactor(mail): 统一邮件认证策略请求与返回格式。

- 将 `auth-policy` 调整为读取 `login`、`remote` 等字段,并返回数值型 `status`。
- 支持按邮箱定位用户与邮箱箱体,补充 IMAP/POP3 认证策略校验。
- 更新 Dovecot 与 Postfix 配置,移除原有的发件人 BCC 依赖。
- 补充相关测试并同步部署说明。
This commit is contained in:
LanQin_
2026-06-23 21:52:05 +08:00
parent 8d434b9ca8
commit f2457c63ee
6 changed files with 68 additions and 25 deletions
+1 -1
View File
@@ -128,7 +128,7 @@ docker compose -f docker-compose.stack.yml -f docker-compose.stack.build.yml up
- Rspamd 会周期性从 SQLite 导出域名 DKIM 私钥到容器内 `/var/lib/rspamd/dkim`
- Go API 是 Webmail 和管理后台入口;浏览器不直接连接 SMTP/IMAP/POP3。
- Go API 会读取 `LANQIN_MAILDIR_ROOT=/var/mail/vhosts`,周期扫描 Maildir,把 Postfix/Dovecot 入站邮件同步成 Webmail 索引。
- 第三方客户端通过 SMTP `465/587` 发信时,Postfix 会把已认证发件人的邮件自动 BCC 到 `发件人+Sent@域名`Dovecot LMTP 会保存到该邮箱的 `Sent` 文件夹,Webmail 扫描后会显示在“已发送”
- 第三方客户端通过 SMTP `465/587` 发信;Webmail 内的“已发送”由 Webmail API 发信流程写入
## 邮件客户端 TLS 证书
+1 -1
View File
@@ -24,7 +24,7 @@ auth_policy_server_api_header = Content-Type: application/json
auth_policy_hash_mech = sha256
auth_policy_hash_truncate = 12
auth_policy_hash_nonce = __LANQIN_AUTH_POLICY_HASH_NONCE__
auth_policy_request_attributes = protocol=imap username=user
auth_policy_request_attributes = login=%{requested_username} remote=%{rip} protocol=%s
namespace inbox {
inbox = yes
-2
View File
@@ -4,13 +4,11 @@ submission inet n - n - - smtpd
-o smtpd_tls_security_level=may
-o smtpd_sasl_auth_enable=yes
-o smtpd_relay_restrictions=permit_sasl_authenticated,reject
-o sender_bcc_maps=sqlite:/etc/postfix/sqlite-sender-bcc.cf
smtps inet n - n - - smtpd
-o syslog_name=postfix/smtps
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
-o smtpd_relay_restrictions=permit_sasl_authenticated,reject
-o sender_bcc_maps=sqlite:/etc/postfix/sqlite-sender-bcc.cf
pickup unix n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr unix n - n 300 1 qmgr