我正在设置 Postfix 和 Dovecot 作为邮件解决方案。当我尝试telnet localhost 25
连接时,连接关闭了。
日志中看到的错误是:
postfix/smtpd[22958]: initializing the server-side TLS engine
postfix/smtpd[22958]: connect from localhost[::1]
postfix/smtpd[22958]: fatal: no SASL authentication mechanisms
postfix/master[32651]: warning: process /usr/libexec/postfix/smtpd pid 22958 exit status 1
postfix/master[32651]: warning: /usr/libexec/postfix/smtpd: bad command startup -- throttling
该服务器是 CentOS 7 服务器
Linux <redacted> 3.10.0-123.8.1.el7.x86_64 #1 SMP Mon Sep 22 19:06:58 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
以下是摘录postconf -n
postconf: warning: /etc/postfix/main.cf: undefined parameter: virtual_mailbox_limit_maps
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
dovecot_destination_recipient_limit = 1
html_directory = no
inet_interfaces = all
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
message_size_limit = 30720000
mydestination = $myhostname, localhost, localhost.localdomain
myhostname = <redacted>
mynetworks = 127.0.0.0/8
newaliases_path = /usr/bin/newaliases.postfix
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
sample_directory = /usr/share/doc/postfix-2.10.1/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_cert_file = /etc/pki/dovecot/certs/dovecot.pem
smtpd_tls_key_file = /etc/pki/dovecot/private/dovecot.pem
smtpd_tls_loglevel = 4
smtpd_use_tls = yes
unknown_local_recipient_reject_code = 550
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_gid_maps = static:5000
virtual_mailbox_base = /home/vmail
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_transport = dovecot
virtual_uid_maps = static:5000
postconf: warning: /etc/postfix/main.cf: unused parameter: virtual_create_maildirsize=yes
postconf: warning: /etc/postfix/main.cf: unused parameter: virtual_maildir_extended=yes
以及来自doveconf -n
# 2.2.10: /etc/dovecot/dovecot.conf
# OS: Linux 3.10.0-123.8.1.el7.x86_64 x86_64 CentOS Linux release 7.0.1406 (Core) ext4
auth_mechanisms = plain login
log_timestamp = "%Y-%m-%d %H:%M:%S "
mail_location = maildir:/home/vmail/%d/%n/Maildir
namespace {
inbox = yes
location =
prefix = INBOX.
separator = .
type = private
}
passdb {
args = /etc/dovecot-sql.conf
driver = sql
}
protocols = imap pop3
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0660
user = postfix
}
unix_listener auth-master {
mode = 0660
user = vmail
}
user = root
}
ssl_cert = /etc/pki/dovecot/certs/dovecot.pem
ssl_key = /etc/pki/dovecot/private/dovecot.pem
userdb {
args = uid=5000 gid=5000 home=/home/vmail/%d/%n allow_all_users=yes
driver = static
}
protocol lda {
auth_socket_path = /var/run/dovecot/auth-master
log_path = /home/vmail/dovecot-deliver.log
postmaster_address = [email protected]
}
protocol pop3 {
pop3_uidl_format = %08Xu%08Xv
}
对于rpm -qa | grep sasl
cyrus-sasl-md5-2.1.26-17.el7.x86_64
cyrus-sasl-gssapi-2.1.26-17.el7.x86_64
libgsasl-1.8.0-2.el7.x86_64
cyrus-sasl-ldap-2.1.26-17.el7.x86_64
cyrus-sasl-lib-2.1.26-17.el7.x86_64
cyrus-sasl-plain-2.1.26-17.el7.x86_64
cyrus-sasl-sql-2.1.26-17.el7.x86_64
cyrus-sasl-gs2-2.1.26-17.el7.x86_64
cyrus-sasl-2.1.26-17.el7.x86_64
cyrus-sasl-scram-2.1.26-17.el7.x86_64
cyrus-sasl-devel-2.1.26-17.el7.x86_64
并且ps ax | grep sasl
,显示 authsasld 正在运行?
23280 ? Ss 0:00 /usr/sbin/saslauthd -m /run/saslauthd -a pam
23281 ? S 0:00 /usr/sbin/saslauthd -m /run/saslauthd -a pam
23282 ? S 0:00 /usr/sbin/saslauthd -m /run/saslauthd -a pam
23283 ? S 0:00 /usr/sbin/saslauthd -m /run/saslauthd -a pam
23284 ? S 0:00 /usr/sbin/saslauthd -m /run/saslauthd -a pam
有人能看出我的配置有什么问题吗?
答案1
1:首先需要检查服务saslauthd
是否正在运行
2:因为 postfix 在 chroot 中运行,所以你需要编辑/etc/sysconfig/saslauthd
并将变量更改OPTIONS
为
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"
现在在 postfix chroot 下为 saslauthd 创建目录
mkdir /var/spool/postfix/var/run/saslauthd
3:完成这些步骤后,您可以重新启动 saslauthd 服务