我正在尝试使用 mysql 作为虚拟邮箱后端来重建运行 Postfix + Dovecot 的基于 Debian 的互联网邮件服务器。更新破坏了很多东西后,服务器变成了五彩纸屑。
目前,我可以将来自 mutt 和 squirrelmail 的电子邮件从服务器发送到 gmail 地址。没有报告任何错误,我可以在 Gmail 中看到我从两者发送的电子邮件。当我从 gmail 发送到我的服务器时,我从未看到使用 mutt 或 squirrel 的电子邮件。
我还可以从服务器上的 mutt/squirrel 发送电子邮件到服务器上的另一个虚拟邮箱。发送过程中没有报告错误。同样,我从未在收件箱中看到该电子邮件。
我将 cd 转到存储我的收件箱电子邮件文件的路径。对于我的设置,路径是 hwsrv-890039:/var/vmail/nostalgicmail.com/brad/Maildir/cur,我在那里看不到电子邮件。我看到尚未删除或移动的现有电子邮件。该电子邮件也不在 ../new 中。
我重新启动服务器作为最后的努力,可能有些东西被缓存了,或者服务没有重新启动。我想排除某个地方出现“陈旧”的可能性。
我对如何进一步排除故障或导致此问题的原因感到困惑。我确实看到了 postfix/lmtp 连接被拒绝的消息。下面发布了日志和配置。
/var/log/系统日志
Feb 6 23:02:16 hwsrv-890039 systemd[1857]: Reached target Main User Target.
Feb 6 23:02:16 hwsrv-890039 systemd[1857]: Startup finished in 141ms.
(END)
/var/log/postfix.log
Feb 06 23:04:03 hwsrv-890039 postfix/smtpd[1893]: connect from mail-qv1-f41.google.com[209.85.219.41]
Feb 06 23:04:03 hwsrv-890039 postfix/smtpd[1893]: A473025245: client=mail-qv1-f41.google.com[209.85.219.41]
Feb 06 23:04:03 hwsrv-890039 postfix/cleanup[1900]: A473025245: message-id=<CA+BfPHTAmE3bS4a9eftnwooS+fBoqnsqqOroG7oh08b5Lz3cbQ@mail.gmail.com>
Feb 06 23:04:03 hwsrv-890039 postfix/qmgr[1712]: A473025245: from=<[email protected]>, size=3328, nrcpt=1 (queue active)
Feb 06 23:04:03 hwsrv-890039 postfix/lmtp[1901]: A473025245: to=<[email protected]>, relay=none, delay=0.05, delays=0.03/0.01/0/0, dsn=4.4.1, status=deferred (connect to hwsrv-890039.nostalgicmail.com[private/dovecot-lmtp]: Connection refused)
Feb 06 23:04:03 hwsrv-890039 postfix/smtpd[1893]: disconnect from mail-qv1-f41.google.com[209.85.219.41] ehlo=2 starttls=1 mail=1 rcpt=1 bdat=1 quit=1 commands=7
Feb 06 23:07:23 hwsrv-890039 postfix/anvil[1895]: statistics: max connection rate 1/60s for (smtp:209.85.219.41) at Feb 6 23:04:03
Feb 06 23:07:23 hwsrv-890039 postfix/anvil[1895]: statistics: max connection count 1 for (smtp:209.85.219.41) at Feb 6 23:04:03
Feb 06 23:07:23 hwsrv-890039 postfix/anvil[1895]: statistics: max cache size 1 at Feb 6 23:04:03
(END)
/var/log/dovecot_info,日志
Feb 06 22:35:30 master: Info: Dovecot v2.3.13 (89f716dc2) starting up for imap, lmtp (core dumps disabled)
(END)
/var/log/dovecot_debug.log
Feb 06 23:04:03 auth: Debug: Module loaded: /usr/lib/dovecot/modules/auth/lib20_auth_var_expand_crypt.so
Feb 06 23:04:03 auth: Debug: Module loaded: /usr/lib/dovecot/modules/auth/libdriver_mysql.so
Feb 06 23:04:03 auth: Debug: Read auth token secret from /run/dovecot/auth-token-secret.dat
Feb 06 23:04:03 auth: Debug: auth client connected (pid=0)
(END)
/var/log/dovecot_errors_warnings.log
Feb 06 22:35:07 master: Warning: Killed with signal 15 (by pid=104901 uid=0 code=kill)
(END)
netstat -tulpn 的输出 | grep 听
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 1709/master
tcp 0 0 0.0.0.0:xxxxx 0.0.0.0:* LISTEN 683/sshd: /usr/sbin
tcp 0 0 0.0.0.0:993 0.0.0.0:* LISTEN 472/dovecot
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 634/mariadbd
tcp 0 0 0.0.0.0:587 0.0.0.0:* LISTEN 1709/master
tcp 0 0 127.0.0.1:783 0.0.0.0:* LISTEN 901/perl
tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN 472/dovecot
tcp 0 0 0.0.0.0:465 0.0.0.0:* LISTEN 1709/master
tcp6 0 0 :::443 :::* LISTEN 710/apache2
tcp6 0 0 :::xxxxx :::* LISTEN 683/sshd: /usr/sbin
tcp6 0 0 :::993 :::* LISTEN 472/dovecot
tcp6 0 0 ::1:783 :::* LISTEN 901/perl
tcp6 0 0 :::143 :::* LISTEN 472/dovecot
tcp6 0 0 :::80 :::* LISTEN 710/apache2
postconf -n 的输出
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
compatibility_level = 2
inet_interfaces = all
inet_protocols = ipv4
mailbox_size_limit = 0
maillog_file = /var/log/postfix.log
mydestination = $myhostname localhost.$mydomain localhost
mydomain = nostalgicmail.com
myhostname = hwsrv-890039.nostalgicmail.com
mynetworks = 127.0.0.0/8
mynetworks_style = host
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_CApath = /etc/ssl/certs
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/letsencrypt/live/nostalgicmail.com/cert.pem
smtpd_tls_key_file = /etc/letsencrypt/live/nostalgicmail.com/privkey.pem
smtpd_tls_security_level = may
smtpd_use_tls = yes
virtual_alias_maps = proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/sql/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/sql/mysql_virtual_mailbox_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp
doveconf -n 的输出
# 2.3.13 (89f716dc2): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.13 (cdd19fe3)
# OS: Linux 5.10.0-11-cloud-amd64 x86_64 Debian 11.2 ext4
# Hostname: hwsrv-890039.nostalgicmail.com
auth_debug = yes
auth_debug_passwords = yes
auth_mechanisms = plain login
auth_verbose = yes
auth_verbose_passwords = plain
debug_log_path = /var/log/dovecot_debug.log
first_valid_uid = 100
info_log_path = /var/log/dovecot_info.log
log_path = /var/log/dovecot_error_warnings.log
mail_gid = mail
mail_location = maildir:/var/vmail/%d/%n/Maildir
mail_privileged_group = mail
mail_uid = vmail
namespace inbox {
inbox = yes
location =
mailbox Drafts {
special_use = \Drafts
}
mailbox Junk {
special_use = \Junk
}
mailbox Sent {
special_use = \Sent
}
mailbox "Sent Messages" {
special_use = \Sent
}
mailbox Trash {
special_use = \Trash
}
prefix =
}
passdb {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
postmaster_address = [email protected]
protocols = imap lmtp
service auth-worker {
user = vmail
}
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0666
user = postfix
}
unix_listener auth-userdb {
mode = 0600
user = vmail
}
user = dovecot
}
service lmtp {
unix_listener lmtp {
group = postfix
mode = 0666
user = postfix
}
}
ssl_cert = </etc/letsencrypt/live/nostalgicmail.com/cert.pem
ssl_client_ca_dir = /etc/ssl/certs
ssl_dh = # hidden, use -P to show it
ssl_key = # hidden, use -P to show it
userdb {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
verbose_ssl = yes
答案1
我终于找到了一个适合我的答案: