使用 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
在两种情况下都使用 gid 和 uid 5000,这样我们就不会与普通用户发生冲突。然后,您的所有邮件都将存储在 /home/vmail
中。您可以将主目录更改为类似 /var/mail/vmail
的目录,但请注意在下面的任何配置中也更改此项。
数据库
您将需要创建一个空数据库和相应的用户。在本文中,用户 postfix_user 将使用密码 hunter2 对数据库 postfix_db 具有读/写访问权限。您需要自己创建数据库和用户,并授予用户使用数据库的权限,如下面的代码所示。
$ 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 之前仔细检查其值!参见 http://www.postfix.org/BASIC_CONFIGURATION_README.html#relay_to另请按照 Postfix#安全 SMTP (接收) 指向您在 #SSL 证书 中创建的文件。
设置 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
我们将创建自己的 /etc/dovecot/dovecot.conf
,而不是使用提供的 Dovecot 示例配置文件。请注意,此处的用户和组可能是 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://127.0.0.1/roundcube/installer/
并按照说明进行操作。
Roundcube 需要一个单独的数据库才能工作。您不应将同一数据库用于 Roundcube 和 PostfixAdmin。创建第二个数据库 roundcube_db
和一个名为 roundcube_user
的新用户。
在运行安装程序时 ...
- 对于 IMAP 主机的地址,即
imap_host
,请使用ssl://127.0.0.1/
或tls://127.0.0.1/
,而不仅仅是localhost
。 - 使用端口
993
。SMTP 也是如此。 - 对于 SMTP 主机的地址,即
smtp_host
,如果您使用 STARTTLS,请使用tls://127.0.0.1/
和端口587
。如果您使用 SMTPS,请使用ssl://127.0.0.1/
和端口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-dict-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。它开箱即用地提供了惊人的垃圾邮件减少、灰名单等功能,并包含一个简洁的 WebUI。另请参见 [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
。