centos – 尝试设置邮件服务器,无法使端口(25,587)正常工作

前端之家收集整理的这篇文章主要介绍了centos – 尝试设置邮件服务器,无法使端口(25,587)正常工作前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我到处搜索,我真的在努力解决这个问题.我想我已经尝试了一切.

背景信息

>使用CentOS 6.7的VPS
> Postfix 2.6.6
> dovecot,amavis,mysql,fail2ban
>我已经与我的VPS提供商验证他们没有阻止任何端口.

我做过的事情

>删除了股票sendmail
>我已经安装了postfix,dovecot,MysqL等完整的邮件解决方
>我只允许使用STARTTLS的imap,smtp(端口143和587)
>仅使用密钥禁用SSH登录
>我可以收到邮件(通过端口143)
>我可以从localhost telnet到两个端口(587,25),我得到后缀问候语
>尝试连接到587或25(邮件客户端或telnet)得到零响应,即连接超时

我尝试过的事情

1)港口是否开放?是的,iptables:

  1. Chain INPUT (policy DROP 11 packets,1375 bytes)
  2. pkts bytes target prot opt in out source destination
  3. 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:587
  4. 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:587
  5. 25 2579 f2b-dovecot tcp -- * * 0.0.0.0/0 0.0.0.0/0 multiport dports 110,995,143,993,587,465,4190
  6. 68 7788 f2b-postfix tcp -- * * 0.0.0.0/0 0.0.0.0/0 multiport dports 25,587
  7. 0 0 f2b-sshd tcp -- * * 0.0.0.0/0 0.0.0.0/0 multiport dports 22
  8. 25 2579 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:143
  9. 7 600 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080
  10. 23464 2662K ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
  11. 49 2940 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
  12. 0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmp type 8
  13. 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:3915
  14. 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
  15. 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:443
  16. 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:143
  17. 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:587
  18. 5 300 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:25
  19.  
  20. Chain FORWARD (policy DROP 0 packets,0 bytes)
  21. pkts bytes target prot opt in out source destination
  22.  
  23. Chain OUTPUT (policy ACCEPT 23235 packets,2494K bytes)
  24. pkts bytes target prot opt in out source destination
  25.  
  26. Chain f2b-dovecot (1 references)
  27. pkts bytes target prot opt in out source destination
  28. 25 2579 RETURN all -- * * 0.0.0.0/0 0.0.0.0/0
  29.  
  30. Chain f2b-postfix (1 references)
  31. pkts bytes target prot opt in out source destination
  32. 68 7788 RETURN all -- * * 0.0.0.0/0 0.0.0.0/0
  33.  
  34. Chain f2b-sshd (1 references)
  35. pkts bytes target prot opt in out source destination
  36. 0 0 RETURN all -- * * 0.0.0.0/0 0.0.0.0/0

2)后缀是否在端口587上侦听?是.它只在localhost上侦听吗?不,任何主持人.

这是netstat:

  1. Active Internet connections (only servers)
  2. Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
  3. tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 7173/master
  4. tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 917/httpd
  5. tcp 0 0 127.0.0.1:4190 0.0.0.0:* LISTEN 749/dovecot
  6. tcp 0 0 0.0.0.0:587 0.0.0.0:* LISTEN 7173/master
  7. tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN 749/dovecot
  8. tcp 0 0 127.0.0.1:24 0.0.0.0:* LISTEN 749/dovecot

这里也是postfix / main.cf,以防万一:

  1. # Enable both IPv4 and/or IPv6: ipv4,ipv6,all.
  2. inet_protocols = ipv4
  3.  
  4. # Enable all network interfaces.
  5. inet_interfaces = all

3)您是否正确强制安全连接?据我所知,是的,这是postfix / master.cf:

  1. # Submission,port 587,force TLS connection.
  2. submission inet n - n - - smtpd
  3. -o syslog_name=postfix/submission
  4. -o smtpd_tls_security_level=encrypt
  5. -o smtpd_sasl_auth_enable=yes
  6. -o smtpd_client_restrictions=permit_mynetworks,permit_sasl_authenticated,reject
  7. -o content_filter=smtp-amavis:[127.0.0.1]:10026

4)smtpd限制怎么样?好像可以:

  1. # HELO restriction
  2. smtpd_helo_required = yes
  3. smtpd_helo_restrictions =
  4. permit_mynetworks
  5. permit_sasl_authenticated
  6. reject_non_fqdn_helo_hostname
  7. reject_invalid_helo_hostname
  8. check_helo_access pcre:/etc/postfix/helo_access.pcre

5)后缀是否正常工作?

是的,登录服务器并从控制台工程发送测试邮件,另一端收到电子邮件,即:

  1. echo "Test mail from postfix" | mail -s "Test Postfix" user@something.com

6)在端口587上连接时会发生什么?

显然,什么都没有.如果我尝试telnet到任何随机端口,我至少得到一些东西.例如,尝试telnet到端口666(未打开)不会产生对客户端的回复,但至少我在tcpdump中得到了一些东西:

  1. 15:22:20.305697 IP xxx > xxx.com.mdqs: Flags [S],seq 3195304468,win 8192,options [mss 1352,nop,wscale 8,sackOK],length 0

当tcpdumping端口587时,尝试telnet到它时绝对没有任何反应.

我还缺少什么?

上面的一切都耗尽了我对仍然可以尝试的事物的了解.我已经设法将它钉在我的587端口被完全阻挡了.正如我所说,我的VPS提供商确认他们根本没有阻止任何端口.我尝试过25端口,这是同一个故事.

我能看到的唯一另一件事是我在设置我的服务器时以某种方式阻止了这些端口,但我不记得是否是这种情况而且我不知道如何测试它.

我真的很感激你能给我的任何帮助.事实上,我买了一杯啤酒,无论谁帮助我解决这个问题,我已经浪费了两天时间,而且开始变得非常讨厌.

Reachergilt,欢迎来到SF,并感谢您提出优秀的第一个问题.你可能觉得我们已经拯救了你,但老实说 – 你已经完成了所有繁重的任务,并且非常系统地展示了它.有了这样的法医心态,我希望你能在这些部分保持一段时间.

tcpdump输出特别诅咒.它无可置疑地证明你的连接尝试甚至没有到达你的服务器,这可以免除服务器的防火墙,postfix的绑定以及服务器端的所有其他内容.

有了这个指针,你已经离开并确认你的出站连接被阻止了,所以你的测试从来没有达到你的服务器.由于垃圾邮件发送僵尸网络使用它们,因此从现代网络中阻止出站25(并且在较小程度上,587)是相当(令人沮丧)正常的.

无论如何,您现在很高兴您的新邮件服务器正如宣传的那样工作,这很好.

猜你在找的CentOS相关文章