如何在haproxy后面配置postfix?

Joe*_*cio 4 postfix haproxy hardening vulnerability

在过去的几年里,我的小型企业运行了一个电子邮件服务器,没有出现任何问题。

现在我的公司已经发展壮大,我想添加一些冗余,并添加了一个故障转移电子邮件服务器,前面有一个负载均衡器(haproxy)。

一切都很顺利,直到 1 周前我们成为垃圾邮件发送者的受害者,我不得不关闭所有功能。经常使用谷歌,我发现没有正确配置的负载均衡器会将我的后缀转换为开放中继。

我想解决这个问题,也找到了很多文档,但坦率地说,现在我有点迷失了。我知道我必须在 haproxy.cfg 中添加 send-proxy 以及其他更改,但我只是不知道如何添加 postscreen 以便再次强化 postfix。

谁能指导我,或者至少给我一些我没有找到的手册或教程的链接,以说明如何实现这一点?

我承认我在 postfix 官方文档中迷失了方向。

提前谢谢了

Chr*_*mas 5

也许这可以帮助某人。我对 haproxy 的配置有所不同,因为我在 kubernetes 集群内运行。但是postfix的配置,你更新两个文件,相应的

大师.cf

# Exposed SMTP service (postscreen support is needed to support the proxy protocol [search postscreen_upstream_proxy_protocol in main.cf])
smtp      inet  n       -       -       -       1       postscreen
smtpd     pass  -       -       -       -       -       smtpd
Run Code Online (Sandbox Code Playgroud)

主文件

# This is required to support the proxy protocol to acquire the correct source ip address from whoever is connecting to this server
# It's really important to get this information because otherwise ALL your connections will come from your internal ip address
# Guess what you allow to send emails, without question? Thats right! You're $mynetworks. Which means because you cannot get the
# correct source ip address, it permits EVERYBODY TO SEND EMAIL THROUGH YOUR SERVER! You basically become an open relay
postscreen_upstream_proxy_protocol = haproxy
postscreen_upstream_proxy_timeout = 5s
Run Code Online (Sandbox Code Playgroud)