在 CentOS 5、Postfix 上接收电子邮件

在 CentOS 5、Postfix 上接收电子邮件

问题如下:我们的服务器(CentOS 5,Postfix)无法接收邮件,但 bat 可以发送。

运行tcpdump port 25并从 Gmail 发送电子邮件显示有来自 Gmail 的传入请求

但是当我运行netstat -nltpil 时,显示没有进程在端口 25 上监听,以下是输出netstat -nltp

tcp        0      0 0.0.0.0:993                 0.0.0.0:*                   LISTEN      17434/couriertcpd
tcp        0      0 0.0.0.0:995                 0.0.0.0:*                   LISTEN      17451/couriertcpd
tcp        0      0 127.0.0.1:10025             0.0.0.0:*                   LISTEN      28215/master
tcp        0      0 127.0.0.1:10026             0.0.0.0:*                   LISTEN      28215/master
tcp        0      0 127.0.0.1:3306              0.0.0.0:*                   LISTEN      6151/mysqld
tcp        0      0 0.0.0.0:106                 0.0.0.0:*                   LISTEN      2147/xinetd
tcp        0      0 127.0.0.1:10027             0.0.0.0:*                   LISTEN      28215/master
tcp        0      0 0.0.0.0:110                 0.0.0.0:*                   LISTEN      17442/couriertcpd
tcp        0      0 0.0.0.0:143                 0.0.0.0:*                   LISTEN      17424/couriertcpd
tcp        0      0 0.0.0.0:8880                0.0.0.0:*                   LISTEN      32353/sw-cp-serverd
tcp        0      0 127.0.0.1:10001             0.0.0.0:*                   LISTEN      32353/sw-cp-serverd
tcp        0      0 **.***.**.***:53            0.0.0.0:*                   LISTEN      2292/named
tcp        0      0 127.0.0.1:53                0.0.0.0:*                   LISTEN      2292/named
tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LISTEN      2147/xinetd
tcp        0      0 0.0.0.0:2006                0.0.0.0:*                   LISTEN      32353/sw-cp-serverd
tcp        0      0 127.0.0.1:5432              0.0.0.0:*                   LISTEN      2488/postmaster
tcp        0      0 127.0.0.1:953               0.0.0.0:*                   LISTEN      2292/named
tcp        0      0 0.0.0.0:8443                0.0.0.0:*                   LISTEN      32353/sw-cp-serverd
tcp        0      0 :::80                       :::*                        LISTEN      18594/httpd
tcp        0      0 :::22                       :::*                        LISTEN      2135/sshd
tcp        0      0 :::443                      :::*                        LISTEN      18594/httpd

还有以下输出telnet 127.0.0.1 25

Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused

我需要做一些端口转发吗?

编辑:这是 main.cf

queue_directory = /var/spool/postfix
daemon_directory = /usr/libexec/postfix
mail_owner = postfix
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
unknown_local_recipient_reject_code = 550
alias_maps = hash:/etc/aliases, hash:/var/spool/postfix/plesk/aliases
alias_database = hash:/etc/aliases
debug_peer_level = 2
debugger_command =
     PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
     xxgdb $daemon_directory/$process_name $process_id & sleep 5
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_mailbox_domains = $virtual_mailbox_maps, hash:/var/spool/postfix/plesk/virtual_domains
virtual_alias_maps = $virtual_maps, hash:/var/spool/postfix/plesk/virtual
virtual_mailbox_maps = hash:/var/spool/postfix/plesk/vmailbox
transport_maps = hash:/var/spool/postfix/plesk/transport
smtpd_tls_cert_file = /etc/postfix/postfix_default.pem
smtpd_tls_key_file = $smtpd_tls_cert_file
smtpd_tls_security_level = may
smtpd_use_tls = yes
smtp_tls_security_level = may
smtp_use_tls = no
mynetworks = 127.0.0.0/8, **.***.**.***/31
smtpd_sender_restrictions = check_sender_access hash:/var/spool/postfix/plesk/blacklists, permit_sasl_authenticated, check_client_access pcre:/var/spool/postfix/plesk/non_auth.re
smtp_send_xforward_command = yes
smtpd_authorized_xforward_hosts = 127.0.0.0/8
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_mynetworks, check_client_access pcre:/var/spool/postfix/plesk/no_relay.re, permit_sasl_authenticated, reject_unauth_destination
virtual_mailbox_base = /var/qmail/mailnames
virtual_uid_maps = static:110
virtual_gid_maps = static:31
virtual_transport = plesk_virtual
plesk_virtual_destination_recipient_limit = 1
smtpd_client_restrictions = 
myhostname = *******.com
message_size_limit = 10240000

输出ps -ef |grep postfix

root     28215     1  0 20:39 ?        00:00:00 /usr/libexec/postfix/master
postfix  28218 28215  0 20:39 ?        00:00:00 qmgr -l -t fifo -u
postfix  28239 28215  0 20:40 ?        00:00:00 tlsmgr -l -t unix -u
postfix  28240 28215  0 20:40 ?        00:00:00 spawn -n 127.0.0.1:10027 -t inet user=mhandlers-user argv=/usr/lib64/plesk-9.0/postfix-queue 127.0.0.1 10026 before-remote
postfix  28242 28215  0 20:40 ?        00:00:00 smtpd -n 127.0.0.1:10026 -t inet -u -c -o smtpd_client_restrictions  -o smtpd_helo_restrictions  -o smtpd_sender_restrictions  -o smtpd_recipient_restrictions permit_mynetworks,reject -o smtpd_data_restrictions  -o receive_override_options no_unknown_recipient_checks
postfix  28539 28215  0 20:57 ?        00:00:00 trivial-rewrite -n rewrite -t unix -u
postfix  29058 28215  0 21:27 ?        00:00:00 pickup -l -t fifo -u -c -o content_filter smtp:127.0.0.1:10027
postfix  29314 28215  0 21:41 ?        00:00:00 bounce -z -t unix -u
postfix  29338 28215  0 21:44 ?        00:00:00 cleanup -z -t unix -u
postfix  29358 28215  0 21:46 ?        00:00:00 smtp -t unix -u
postfix  29457 28215  0 21:56 ?        00:00:00 smtp -t unix -u
postfix  29716 28215  0 22:08 ?        00:00:00 bounce -z -t unix -u
root     29749 29571  0 22:10 pts/3    00:00:00 grep postfix

答案1

看起来您的 postfix master pid 正在监听端口 10025 和 10025。

查看 /etc/postfix/master.cf 中的 smtpd 守护进程。我的看起来像这样

smtp      inet  n       -       n       -       -       smtpd

您的邮件中似乎没有“smtp”,而是 10025,还有一行是 10026。另一种(不太可能的)可能性是,您有smtp 10025/tcp/etc/services

更新你的 master.cf 使其看起来像给出的示例,然后

sudo service postfix restart

答案2

输出是什么:

sudo service postfix status 

如果已停止,请运行:

sudo service postfix start

确保/etc/postfix/main.cf将 inet_interfaces 设置为全部或者您希望 Postfix 监听的特定接口。

相关内容