解决SMTP 发信暴露服务器源IP的方法
侧边栏壁纸
  • 累计撰写 20 篇文章
  • 累计收到 0 条评论

解决SMTP 发信暴露服务器源IP的方法

247
247
2023-05-25 / 0 评论 / 53 阅读 / 正在检测是否收录...

我们以 CentOS、阿里云邮件推送 为例:

第一步 需要安装 Haproxy:
yum -y install haproxy
然后清空 haproxy.cfg 文件内容

cd /etc/haproxy/

haproxy.cfg
然后将下面内容粘贴到 haproxy.cfg 中

global
ulimit-n 51200
defaults
log global
mode tcp
option dontlognull
timeout connect 1000ms
timeout client 150000ms
timeout server 150000ms
listen status
bind 0.0.0.0:1080
mode http
log global
stats refresh 30s
stats uri /admin?stats
stats realm Private lands
stats auth admin:password
stats hide-version
frontend ssin
bind *:465
default_backend ssout
backend ssout
server server1 11.22.33.44 maxconn 204800
// 如果是普通模式,那这里就填25,如果是SSL模式,就需要填465

bind *:465
//这里的IP需要改成SMTP地址的IP,ping一下SMTP域名即可得到地址

server server1 11.22.33.44 maxconn 204800
修改完成后,执行重启命令,并设为开机启动

service haproxy restart
chkconfig haproxy on
第二步 修改 Web 服务器的发信 Hosts 地址!
在 Web 服务器上输入

echo "22.33.44.55 smtpdm.aliyun.com" >> /etc/hosts
然后重启网卡

service network restart
现在去发邮件试一下,是不是隐藏掉了源站的 IP。

0

评论 (0)

取消