使用 Postfix、Dovecot 和 Roundcube 的虚拟用户邮件系统
本文介绍如何设置虚拟用户邮件系统,即发件人和收件人与 Linux 系统用户不对应。
大致上,本文使用的组件是 Postfix 作为邮件服务器,Dovecot 作为 IMAP 服务器,Roundcube 作为 Webmail 界面,以及 PostfixAdmin 作为管理这一切的管理界面。
最终,提供的解决方案将允许您使用当前可用的最佳安全机制,您将能够通过 SMTP 和 SMTPS 发送邮件,并通过 POP3、POP3S、IMAP 和 IMAPS 接收邮件。此外,由于 PostfixAdmin,配置将变得容易,用户将能够通过 Roundcube 登录。
安装
在开始之前,您必须有一个正常工作的 MySQL 服务器(如 MySQL 中所述)和一个正常工作的 Postfix 服务器(如 Postfix 中所述)。
安装 postfix-mysql、dovecot 和 roundcubemail 包。
配置
用户
出于安全原因,应创建一个新用户来存储邮件
# groupadd -g 5000 vmail # useradd -u 5000 -g vmail -s /usr/bin/nologin -d /home/vmail -m vmail
在这两种情况下都使用了 5000 的 gid 和 uid,以便我们不会与常规用户发生冲突。所有邮件将存储在 /home/vmail 中。您可以将主目录更改为 /var/mail/vmail 之类的位置,但请注意在以下所有配置中也进行相应更改。
数据库
您需要创建一个空的数据库和相应的用户。在本文中,用户 postfix_user 将拥有对数据库 postfix_db 的读/写访问权限,密码为 hunter2。您应该自己创建数据库和用户,并授予用户使用该数据库的权限,如下面的代码所示。
$ mysql -u root -p
CREATE DATABASE postfix_db; GRANT ALL ON postfix_db.* TO 'postfix_user'@'localhost' IDENTIFIED BY 'hunter2'; FLUSH PRIVILEGES;
现在您可以访问 PostfixAdmin 的设置页面,让 PostfixAdmin 创建所需的表并在其中创建用户。
PostfixAdmin
参见 PostfixAdmin。
SSL 证书
您将需要一个 SSL 证书来处理所有加密的邮件通信(SMTPS/IMAPS/POP3S)。如果您还没有,请创建一个
# cd /etc/ssl/private/ # openssl req -new -x509 -nodes -newkey rsa:4096 -keyout vmail.key -out vmail.crt -days 1460 #days are optional # chmod 400 vmail.key # chmod 444 vmail.crt
或者,使用 Let's Encrypt 创建一个免费的可信证书。私钥将位于 /etc/letsencrypt/live/yourdomain/privkey.pem,证书将位于 /etc/letsencrypt/live/yourdomain/fullchain.pem。请相应地更改配置,或将密钥符号链接到 /etc/ssl/private
# ln -s /etc/letsencrypt/live/yourdomain/privkey.pem /etc/ssl/private/vmail.key # ln -s /etc/letsencrypt/live/yourdomain/fullchain.pem /etc/ssl/private/vmail.crt
Postfix
在复制粘贴下面的配置之前,请检查 relay_domains 是否已设置。如果您保留多个活动项,您将在运行时收到警告。
relay_domains 可能很危险。您通常不希望 Postfix 转发陌生人的邮件。$mydestination 是一个合理的默认值。在运行 postfix 之前,请仔细检查其值!请参阅 https://www.postfix.org/BASIC_CONFIGURATION_README.html#relay_to还要遵循 Postfix#Secure SMTP (receiving) 指向您在 #SSL certificate 中创建的文件。
设置 Postfix
将以下内容附加到 /etc/postfix/main.cf
relay_domains = $mydestination virtual_alias_maps = proxy:mysql:/etc/postfix/virtual_alias_maps.cf virtual_mailbox_domains = proxy:mysql:/etc/postfix/virtual_mailbox_domains.cf virtual_mailbox_maps = proxy:mysql:/etc/postfix/virtual_mailbox_maps.cf virtual_mailbox_base = /home/vmail virtual_mailbox_limit = 512000000 virtual_minimum_uid = 5000 virtual_transport = virtual virtual_uid_maps = static:5000 virtual_gid_maps = static:5000 local_transport = virtual local_recipient_maps = $virtual_mailbox_maps transport_maps = lmdb:/etc/postfix/transport smtpd_sasl_auth_enable = yes smtpd_sasl_type = dovecot smtpd_sasl_path = /var/run/dovecot/auth-client smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination smtpd_sasl_security_options = noanonymous smtpd_sasl_tls_security_options = $smtpd_sasl_security_options smtpd_tls_security_level = may smtpd_tls_auth_only = yes smtpd_tls_received_header = yes smtpd_tls_cert_file = /etc/ssl/private/vmail.crt smtpd_tls_key_file = /etc/ssl/private/vmail.key smtpd_sasl_local_domain = $mydomain smtpd_tls_loglevel = 1 smtp_tls_security_level = may smtp_tls_loglevel = 1
- 在上面的配置中,
virtual_mailbox_domains是您希望接收邮件的域列表。这不能包含在mydestination中设置的域。这就是为什么我们将mydestination保留为仅 localhost。
virtual_mailbox_maps将包含虚拟用户及其邮箱位置的信息。我们使用一个哈希文件来存储更永久的映射,然后这些映射将覆盖 MySQL 数据库中的转发。
virtual_mailbox_base是存储虚拟邮箱的基目录。
virtual_uid_maps 和 virtual_gid_maps 是虚拟邮件所属的实际系统用户 ID。这用于存储目的。
创建文件结构
这些新的附加设置引用了许多尚不存在的文件。我们将通过以下步骤创建它们。
如果您使用 PostfixAdmin 设置数据库,并且通过 PostfixAdmin 创建了数据库模式,则可以创建以下文件。不要忘记更改密码
/etc/postfix/virtual_alias_maps.cf
user = postfix_user password = hunter2 hosts = localhost dbname = postfix_db table = alias select_field = goto where_field = address
/etc/postfix/virtual_mailbox_domains.cf
user = postfix_user password = hunter2 hosts = localhost dbname = postfix_db table = domain select_field = domain where_field = domain
/etc/postfix/virtual_mailbox_maps.cf
user = postfix_user password = hunter2 hosts = localhost dbname = postfix_db table = mailbox select_field = maildir where_field = username
要实现别名域功能,请调整以下文件
/etc/postfix/main.cf
virtual_alias_maps = proxy:mysql:/etc/postfix/virtual_alias_maps.cf,proxy:mysql:/etc/postfix/virtual_alias_domains_maps.cf virtual_alias_domains = proxy:mysql:/etc/postfix/virtual_alias_domains.cf
/etc/postfix/virtual_alias_domains_maps.cf
user = postfix_user
password = hunter2
hosts = localhost
dbname = postfix_db
query = SELECT goto FROM alias,alias_domain WHERE alias_domain.alias_domain = '%d' and alias.address = CONCAT('%u', '@', alias_domain.target_domain) AND alias.active = '1' AND alias_domain.active='1'
/etc/postfix/virtual_alias_domains.cf
user = postfix_user password = hunter2 hosts = localhost dbname = postfix_db query = SELECT alias_domain FROM alias_domain WHERE alias_domain='%s' AND active = '1'
/etc/postfix/virtual_alias_maps.cf
user = postfix_user password = hunter2 hosts = localhost dbname = postfix_db table = domains select_field = virtual where_field = domain
/etc/postfix/virtual_mailbox_domains.cf
user = postfix_user password = hunter2 hosts = localhost dbname = postfix_db table = forwardings select_field = destination where_field = source
/etc/postfix/virtual_mailbox_maps.cf
user = postfix_user password = hunter2 hosts = localhost dbname = postfix_db table = users select_field = concat(domain,'/',email,'/') where_field = email
对 transport 运行 postmap 以生成其 db
# postmap /etc/postfix/transport
Dovecot
我们不使用提供的 Dovecot 示例配置文件,而是创建自己的 /etc/dovecot/dovecot.conf。请注意,这里的用户和组可能是 vmail,而不是 postfix!
/etc/dovecot/dovecot.conf
protocols = imap pop3
auth_mechanisms = plain
passdb {
driver = sql
args = /etc/dovecot/dovecot-sql.conf
}
userdb {
driver = sql
args = /etc/dovecot/dovecot-sql.conf
}
service auth {
unix_listener auth-client {
group = postfix
mode = 0660
user = postfix
}
user = root
}
mail_home = /home/vmail/%d/%n
mail_location = maildir:~
ssl_cert = </etc/ssl/private/vmail.crt
ssl_key = </etc/ssl/private/vmail.key
dovecot.conf.sample,请注意默认配置文件会导入 conf.d/*.conf 的内容。这些文件会调用其他不存在于我们配置中的文件。现在我们创建 /etc/dovecot/dovecot-sql.conf,我们刚刚在上面的配置中引用了它。使用以下内容,并检查所有内容是否根据您系统的配置进行了设置。
如果您使用了 PostfixAdmin,则添加以下内容
/etc/dovecot/dovecot-sql.conf
driver = mysql
connect = host=localhost dbname=postfix_db user=postfix_user password=hunter2
# It is highly recommended to not use deprecated MD5-CRYPT. Read more at http://wiki2.dovecot.org/Authentication/PasswordSchemes
default_pass_scheme = SHA512-CRYPT
# Get the mailbox
user_query = SELECT '/home/vmail/%d/%n' as home, 'maildir:/home/vmail/%d/%n' as mail, 5000 AS uid, 5000 AS gid, concat('dirsize:storage=', quota) AS quota FROM mailbox WHERE username = '%u' AND active = '1'
# Get the password
password_query = SELECT username as user, password, '/home/vmail/%d/%n' as userdb_home, 'maildir:/home/vmail/%d/%n' as userdb_mail, 5000 as userdb_uid, 5000 as userdb_gid FROM mailbox WHERE username = '%u' AND active = '1'
# If using client certificates for authentication, comment the above and uncomment the following
#password_query = SELECT null AS password, ‘%u’ AS user
如果您没有使用 PostfixAdmin,您可以使用
/etc/dovecot/dovecot-sql.conf
driver = mysql
connect = host=localhost dbname=postfix_db user=postfix_user password=hunter2
# It is highly recommended to not use deprecated MD5-CRYPT. Read more at http://wiki2.dovecot.org/Authentication/PasswordSchemes
default_pass_scheme = SHA512-CRYPT
# Get the mailbox
user_query = SELECT '/home/vmail/%d/%n' as home, 'maildir:/home/vmail/%d/%n' as mail, 5000 AS uid, 5000 AS gid, concat('dirsize:storage=', quota) AS quota FROM users WHERE email = '%u'
# Get the password
password_query = SELECT email as user, password, '/home/vmail/%d/%n' as userdb_home, 'maildir:/home/vmail/%d/%n' as userdb_mail, 5000 as userdb_uid, 5000 as userdb_gid FROM users WHERE email = '%u'
# If using client certificates for authentication, comment the above and uncomment the following
#password_query = SELECT null AS password, ‘%u’ AS user
DH 参数
使用 v2.3,您需要自行提供 ssl_dh = /path/to/dh.pem。
生成新的 DH 参数文件(这需要很长时间)
# openssl dhparam -out /etc/dovecot/dh.pem 4096
然后将文件添加到 /etc/dovecot/dovecot.conf
ssl_dh = </etc/dovecot/dh.pem
PostfixAdmin
参见 PostfixAdmin。
注意:为了与此文件中的配置匹配,config.inc.php 应包含以下内容。
# /etc/webapps/postfixadmin/config.inc.php ... $CONF['domain_path'] = 'YES'; $CONF['domain_in_mailbox'] = 'NO'; ...
Roundcube
参见 Roundcube。
确保在您的 php.ini 文件中取消注释了 extension=pdo_mysql 和 extension=iconv。同时检查 .htaccess 中的访问限制。假设 localhost 是您当前的服务器,请在浏览器中导航到 https:///roundcube/installer/ 并按照说明进行操作。
Roundcube 需要一个单独的数据库才能工作。您不应将 Roundcube 和 PostfixAdmin 使用同一个数据库。创建一个第二个数据库 roundcube_db 和一个名为 roundcube_user 的新用户。
在运行安装程序时...
- 对于 IMAP 主机的地址,即
imap_host,请使用ssl:///或tls:///,而不是仅仅localhost。 - 使用端口
993。SMTP 也一样。 - 对于 SMTP 主机的地址,即
smtp_host,如果您使用了 STARTTLS,请使用tls:///和端口587。如果您使用了 SMTPS,请使用ssl:///和端口465。如果建立会话失败,请尝试使用tls://yourservername,其中yourservername是您的服务器名称。 - 参见 #Postfix 以了解解释。
- 确保最终的配置文件包含
$config['smtp_user'] = '%u';和$config['smtp_pass'] = '%p';行,否则您将无法发送电子邮件。
安装后的过程与任何其他 Web 应用程序(如 PhpMyAdmin 或 PostFixAdmin)类似。配置文件位于 /etc/webapps/roundcubemail/config/config.inc.php,它会覆盖 defaults.inc.php。
Apache配置
如果您正在使用 Apache,请将示例配置文件复制到您的 Web 服务器配置目录。
# cp /etc/webapps/roundcubemail/apache.conf /etc/httpd/conf/extra/httpd-roundcubemail.conf
在以下位置添加此行
/etc/httpd/conf/httpd.conf
Include conf/extra/httpd-roundcubemail.conf
Roundcube:更改密码插件
要让用户从 Roundcube 内部更改密码,请执行以下操作
通过将此行添加到以下内容来启用密码插件
/etc/webapps/roundcubemail/config/config.inc.php
$config['plugins'] = ['password'];
配置密码插件,并确保相应地修改设置
/usr/share/webapps/roundcubemail/plugins/password/config.inc.php
<?php $config['password_driver'] = 'sql'; $config['password_db_dsn'] = 'mysql://<postfix_database_user>:<password>@localhost/<postfix_database_name>'; // If you are not using dovecot specify another algorithm explicitly e.g 'sha256-crypt' $config['password_algorithm'] = 'dovecot'; // For dovecot salted passwords only (above must be set to 'dovecot') // $config['password_algorithm_prefix'] = 'true'; // $config['password_dovecotpw'] = '/usr/bin/doveadm pw'; // $config['password_dovecotpw_method'] = 'SHA512-CRYPT'; // $config['password_dovecotpw_with_method'] = true; $config['password_query'] = 'UPDATE mailbox SET password=%P WHERE username=%u';
确保此文件仅对 http 用户和组可读,因为它包含敏感信息
# chown http:http /usr/share/webapps/roundcubemail/plugins/password/config.inc.php # chmod o-r /usr/share/webapps/roundcubemail/plugins/password/config.inc.php
启动
应启动所有必需的守护进程以测试配置。请启动 postfix 和 dovecot。
现在,为了进行测试,请在 PostfixAdmin 中创建一个域和邮箱帐户。尝试使用 Roundcube 登录该帐户。现在给自己发一封邮件。
测试
现在让我们看看 Postfix 是否会为我们的测试用户投递邮件。
nc servername 25 helo testmail.org mail from:<test@testmail.org> rcpt to:<cactus@virtualdomain.tld> data This is a test email. . quit
错误响应
451 4.3.0 <lisi@test.com>:Temporary lookup failure
您可能输入了错误的 MySQL 用户/密码,或者 MySQL 套接字不在正确的位置。
如果您在启动 postfix 之前至少运行一次 newaliases,也会出现此错误。对于仅本地使用的 postfix,不需要 MySQL。
550 5.1.1 <email@spam.me>: Recipient address rejected: User unknown in virtual mailbox table.
仔细检查 mysql_virtual_mailboxes.cf 的内容,并检查 main.cf 中的 mydestination
查看是否收到邮件
现在输入 $ find /home/vmailer。
您应该会看到类似以下内容
/home/vmailer/virtualdomain.tld/cactus@virtualdomain.tld /home/vmailer/virtualdomain.tld/cactus@virtualdomain.tld/tmp /home/vmailer/virtualdomain.tld/cactus@virtualdomain.tld/cur /home/vmailer/virtualdomain.tld/cactus@virtualdomain.tld/new /home/vmailer/virtualdomain.tld/cactus@virtualdomain.tld/new/1102974226.2704_0.bonk.testmail.org
关键在于最后一个条目。这是一个实际的电子邮件,如果您看到它,说明它正在工作。
可选项目
虽然这些项目不是必需的,但它们确实使您的设置更加完整
配额
要为 dovecot 启用邮箱配额支持,请执行以下操作
- 首先将以下行添加到 /etc/dovecot/dovecot.conf
dict {
quotadict = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext
}
service dict {
unix_listener dict {
group = vmail
mode = 0660
user = vmail
}
user = root
}
service quota-warning {
executable = script /usr/local/bin/quota-warning.sh
user = vmail
unix_listener quota-warning {
group = vmail
mode = 0660
user = vmail
}
}
mail_plugins=quota
protocol pop3 {
mail_plugins = quota
pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
pop3_uidl_format = %08Xu%08Xv
}
protocol lda {
mail_plugins = quota
postmaster_address = postmaster@yourdomain.com
}
protocol imap {
mail_plugins = $mail_plugins imap_quota
mail_plugin_dir = /usr/lib/dovecot/modules
}
plugin {
quota = dict:User quota::proxy::quotadict
quota_rule2 = Trash:storage=+10%%
quota_warning = storage=100%% quota-warning +100 %u
quota_warning2 = storage=95%% quota-warning +95 %u
quota_warning3 = storage=80%% quota-warning +80 %u
quota_warning4 = -storage=100%% quota-warning -100 %u # user is no longer over quota
}
- 创建一个新文件 /etc/dovecot/dovecot-sql.conf.ext,内容如下
connect = host=localhost dbname=yourdb user=youruser password=yourpassword
map {
pattern = priv/quota/storage
table = quota2
username_field = username
value_field = bytes
}
map {
pattern = priv/quota/messages
table = quota2
username_field = username
value_field = messages
}
- 创建一个警告脚本 /usr/local/bin/quota-warning.sh 并确保它可执行。此警告脚本也可与 postfix lmtp 配置配合使用。
#!/bin/sh
BOUNDARY="$1"
USER="$2"
MSG=""
if [[ "$BOUNDARY" = "+100" ]]; then
MSG="Your mailbox is now overfull (>100%). In order for your account to continue functioning properly, you need to remove some emails NOW."
elif [[ "$BOUNDARY" = "+95" ]]; then
MSG="Your mailbox is now over 95% full. Please remove some emails ASAP."
elif [[ "$BOUNDARY" = "+80" ]]; then
MSG="Your mailbox is now over 80% full. Please consider removing some emails to save space."
elif [[ "$BOUNDARY" = "-100" ]]; then
MSG="Your mailbox is now back to normal (<100%)."
fi
cat << EOF | /usr/lib/dovecot/dovecot-lda -d $USER -o "plugin/quota=maildir:User quota:noenforcing"
From: postmaster@yourdomain.com
Subject: Email Account Quota Warning
Dear User,
$MSG
Best regards,
Your Mail System
EOF
- 编辑 user_query 行,并在 dovecot-sql.conf 中添加 iterat_query,如下所示
user_query = SELECT '/home/vmail/%d/%n' as home, 'maildir:/home/vmail/%d/%n' as mail, 5000 AS uid, 5000 AS gid, concat('*:bytes=', quota) AS quota_rule FROM mailbox WHERE username = '%u' AND active = '1'
iterate_query = SELECT username AS user FROM mailbox
- 在 SpamAssassin 下设置 LDA。如果您不使用 SpamAssassin,则在 /etc/postfix/master.cf 中的管道应如下所示
dovecot unix - n n - - pipe
flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient}
如上所述,在 Postfix main.cf 中启用它
virtual_transport = dovecot
- 您可以在 postfixadmin 中为每个邮箱设置配额。确保 config.inc.php 中的相关行如下所示
$CONF['quota'] = 'YES'; $CONF['quota_multiplier'] = '1024000';
重新启动 postfix 和 dovecot 服务。如果一切顺利,您应该能够使用此命令列出所有用户的配额和使用情况
doveadm quota get -A
您应该也能在 roundcube 中看到配额。
Dovecot 中自动创建和自动订阅文件夹
要自动创建“常用”邮件层次结构,请按如下方式修改您的 /etc/dovecot/dovecot.conf,并根据您的具体需求进行编辑。
namespace inbox {
type = private
separator = /
prefix =
inbox = yes
}
namespace inbox {
mailbox Drafts {
auto = subscribe
special_use = \Drafts
}
mailbox Junk {
auto = subscribe
special_use = \Junk
}
mailbox Trash {
auto = subscribe
special_use = \Trash
}
mailbox Sent {
auto = subscribe
special_use = \Sent
}
}
Dovecot 公共文件夹和全局 ACL
在本节中,我们将启用 IMAP 命名空间公共文件夹,并结合全局和每个文件夹的 ACL。
首先,将以下行添加到 /etc/dovecot/dovecot.conf
### ACLs
mail_plugins = acl
protocol imap {
mail_plugins = $mail_plugins imap_acl
}
plugin {
acl = vfile
# With global ACL files in /etc/dovecot/dovecot-acls file (v2.2.11+):
acl = vfile:/etc/dovecot/dovecot-acl
}
### Public Mailboxes
namespace {
type = public
separator = /
prefix = public/
location = maildir:/home/vmail/public:INDEXPVT=~/public
subscriptions = no
list = children
}
创建根目录 /home/vmail/public 和您要公开共享的文件夹,例如(句点是必需的!) /home/vmail/public/.example-1。
更改根目录中所有文件的所有权
$ chown -R vmail:vmail /home/vmail/public
最后,创建并修改您的全局 ACL 文件以允许用户访问这些文件夹
/etc/dovecot/dovecot-acl
public/* user=admin@example.com lrwstipekxa
在上面的示例中,用户 admin@example.com 可以访问所有公共文件夹并对它们执行任何操作。请根据您的具体需求进行编辑。
lrwstipekxa是授予的权限。请访问 Dovecot wiki 了解更多详情。- 确保用户在其使用的客户端中订阅了这些文件夹。
对抗垃圾邮件
要使用 SpamAssassin,您必须 使用 SQL 数据库进行设置。否则,用户分数和过滤器数据将不会被保存,因为用户是虚拟的,没有主目录来保存这些。
作为 SpamAssassin 的替代方案,请考虑 rspamd。开箱即用,它提供了惊人的垃圾邮件减少量、灰名单等功能,并且包含一个漂亮的网络界面。另请参阅 [1]。
补充说明
其他 vmail 文件夹结构
与其拥有像 /home/vmail/example.com/user@example.com 这样的目录结构,不如通过替换 select_field 和 where_field 来拥有更简洁的子目录(不包含额外的域名)
query = SELECT CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/') FROM users WHERE email='%s'
故障排除
IMAP/POP3 客户端无法接收邮件
如果您遇到类似的错误,请查看 /var/log/mail.log 或以 root 身份运行 journalctl -xn --unit postfix.service 以了解更多信息。
如果至少有一封邮件等待,Maildir /home/vmail/mail@domain.tld 才会被创建。否则,在之前就不需要创建目录了。
Roundcube 无法删除邮件或查看任何“标准”文件夹
确保 Roundcube config.inc.php 文件包含以下内容
$config['default_imap_folders'] = ['INBOX', 'Drafts', 'Sent', 'Junk', 'Trash']; $config['create_default_folders'] = true; $config['protect_default_folders'] = true;
LMTP / Sieve
LMTP 没有连接到 sieve?请确保您的服务器没有将消息本地路由。这可以在 /etc/postfix/main.cf 中设置
mydestination =
发送给 Gmail 用户的电子邮件是否会进入其垃圾邮件/垃圾邮件文件夹?
如果您没有实施 SPF / DKIM / DMARC 策略,Google Gmail(以及大多数其他大型电子邮件提供商)会将您的电子邮件直接发送到收件人的垃圾邮件/垃圾邮件文件夹。(提示:Rspamd,通过上面的链接,展示了如何设置此项,并且它会为您的电子邮件添加 DKIM 签名。)
发送和接收邮件中断,日志显示“transport_maps lookup failure”以及“unsupported dictionary type: hash”
Postfix 3.9.0 移除了对“hash”传输映射类型的支持。要解决此问题,请停止 postfix.service 并编辑 /etc/postfix/main.cf,将所有 hash: 实例替换为 lmdb:。然后保存文件,删除 /etc/postfix/transport.db 并使用 postmap /etc/postfix/transport 以新格式重新生成它。之后,您可以启动 postfix.service。