我在配置 postfix 服务器时遇到了问题,目前当我发出:telnet myhost 25 输出:
[root@******** init.d]# telnet localhost 25
Trying 127.0.0.1...
Connected to host-********* (127.0.0.1).
Escape character is '^]'.
我没有收到 220 线。
这是我的 main.cnf
# SOFT BOUNCE
#
# LOCAL PATHNAME INFORMATION
#
queue_directory = /var/spool/postfix
# The command_directory parameter specifies the location of all
# postXXX commands.
#
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
# QUEUE AND PROCESS OWNERSHIP
#
mail_owner = postfix
# INTERNET HOST AND DOMAIN NAMES
#
myhostname = mail.xxxxxxxxxx.com
mydomain = xxxxxxxxxx.com
# SENDING MAIL
#
# RECEIVING MAIL
#
inet_interfaces = localhost
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
# REJECTING MAIL FOR UNKNOWN LOCAL USERS
#
#unknown_local_recipient_reject_code = 550
# TRUST AND RELAY CONTROL
#
mynetworks = 192.168.0.0/16, 127.0.0.0/8
#relay_domains = $mydestination
relay_domains = /etc/postfix/relaydomains
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual_mailbox_maps.cf
# INTERNET OR INTRANET
#
# REJECTING UNKNOWN RELAY USERS
#
# ADDRESS REWRITING
#
# ADDRESS REDIRECTION (VIRTUAL DOMAIN)
#
# "USER HAS MOVED" BOUNCE MESSAGES
#
# TRANSPORT MAP
#
# ALIAS DATABASE
#
#alias_maps = dbm:/etc/aliases
alias_maps = hash:/etc/aliases
#alias_maps = hash:/etc/aliases, nis:mail.aliases
#alias_maps = netinfo:/aliases
#alias_database = dbm:/etc/aliases
#alias_database = dbm:/etc/mail/aliases
alias_database = hash:/etc/aliases
#alias_database = hash:/etc/aliases, hash:/opt/majordomo/aliases
# ADDRESS EXTENSIONS (e.g., user+foo)
#
# DELIVERY TO MAILBOX
#
# JUNK MAIL CONTROLS
#
# FAST ETRN SERVICE
#
# SHOW SOFTWARE VERSION OR NOT
#
# PARALLEL DELIVERY TO THE SAME DESTINATION
#
# DEBUGGING CONTROL
#
debug_peer_level = 2
debug_peer_list = 127.0.0.1
#debug_peer_list = some.domain
# INSTALL-TIME CONFIGURATION INFORMATION
#
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.3.3/samples
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
virtual_alias_domains = mynaturalcure.com
#virtual_alias_maps = hash:/etc/postfix/virtual
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual_alias_maps.cf,
regexp:/etc/postfix/virtual_regexp
virtual_mailbox_base = /home/vmail
virtual_transport = virtual
virtual_uid_maps = static:89
virtual_minimum_uid = 89
#dovecot_destination_recipient_limit = 1
# authentication
#
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
主配置文件
#
# Postfix master process configuration file. For details on the format
# of the file, see the Postfix master(5) manual page.
#
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n - n - - smtpd -v -v -D
# -o content_filter=smtp-amavis:127.0.0.1:10024
# -o receive_override_options=no_address_mappings
#submission inet n - n - - smtpd
# -o smtpd_etrn_restrictions=reject
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
# smtps inet n - n - - smtpd -v -v -D
# -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes
#submission inet n - n - - smtpd
# -o smtpd_etrn_restrictions=reject
# -o smtpd_enforce_tls=yes -o smtpd_sasl_auth_enable=yes
#628 inet n - n - - qmqpd
pickup fifo n - n 60 1 pickup
-o content_filter=
-o receive_override_options=no_header_body_checks
cleanup unix n - n - 0 cleanup
qmgr fifo n - n 300 1 qmgr
#qmgr fifo n - n 300 1 oqmgr
tlsmgr unix - - n 1000? 1 tlsmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
smtp unix - - n - - smtp -v -v -D
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay unix - - n - - smtp
-o fallback_relay=
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - n - - showq
error unix - - n - - error
discard unix - - n - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
scache unix - - n - 1 scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent. See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
#
# The Cyrus deliver program has changed incompatibly, multiple times.
#
old-cyrus unix - n n - - pipe
flags=R user=cyrus argv=/usr/lib/cyrus-imapd/deliver -e -m ${extension} ${user}
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
cyrus unix - n n - - pipe
user=cyrus argv=/usr/lib/cyrus-imapd/deliver -r ${sender} -m ${extension} ${user}
#
# See the Postfix UUCP_README file for configuration details.
#
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
ifmail unix - n n - - pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp unix - n n - - pipe
flags=Fq. user=foo argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient
#
# spam/virus section
#
smtp-amavis unix - - y - 2 smtp
# -o smtp_data_done_timeout=1200
# -o disable_dns_lookups=yes
-o smtp_send_xforward_command=yes
#127.0.0.1:10025 inet n - y - - smtpd
# -o content_filter=
# -o smtpd_helo_restrictions=
# -o smtpd_sender_restrictions=
# -o smtpd_recipient_restrictions=permit_mynetworks,reject
# -o mynetworks=127.0.0.0/8
# -o smtpd_error_sleep_time=0
# -o smtpd_soft_error_limit=1001
# -o smtpd_hard_error_limit=1000
# -o receive_override_options=no_header_body_checks
# -o smtpd_bind_address=127.0.0.1
# -o smtpd_helo_required=no
# -o smtpd_client_restrictions=
# -o smtpd_restriction_classes=
# -o disable_vrfy_command=no
# -o strict_rfc821_envelopes=yes
#
答案1
对于初学者来说,您已经将配置弄得乱七八糟了;这意味着很多事情都可能出错。
首先验证 postfix 是否确实在监听端口 25;netstat -plnt |grep master
应该在所有 IP 或单个 IP 上显示端口 25。
如果您不幸也触碰了 master.cf,那么您可能会把事情搞得比这里看到的更糟 ;)
我建议您消除大部分损害并按照官方文档了解如何配置 TLS 和 SASL:
http://www.postfix.org/TLS_README.html
http://www.postfix.org/SASL_README.html
答案2
从文档来看,smtpd_banner 至少需要包含 $myhostname。
“您必须在文本开头指定 $myhostname。这是 SMTP 协议所要求的。”
从:http://www.postfix.org/postconf.5.html#smtpd_banner
您当前的配置中没有此功能。