Set up Linux VPS to disable SMTP port 25 to prevent spam

888u

Last update at :2024-07-11,Edit by888u

Snail received an email from a previous VPS merchant today, mentioning that the VPS has been suspended for sending SPAM emails. This small VPS was also activated during the previous test. I forgot that it existed and never used it. It is estimated that the password was set too simply or other factors were used to send emails. Many people must have encountered this problem.

First of all, if you encounter such a problem, just reinstall the system, then set complex passwords, change ports, set key login, etc., and then check the relevant information. It is best to block SMTP email port 25, so in this article , Snail will briefly sort out how to ban port 25 to prevent spam.

First, commonly used settings

1. Block all 25 port connections

iptables -I FORWARD -p tcp –dport 25 -j DROP

2. Allow specific IP to connect to port 25

iptables -I FORWARD -s xx.xx.xx.xx -p tcp –dport 25 -j ACCEPT

3. Prohibit specific IP connections to port 25

iptables -I FORWARD -s xx.xx.xx.xx -p tcp –dport 25 -j DROP

Second, save and take effect

/etc/rc.d/init.d/iptables save/etc/init.d/iptables restart

After setting iptables rules, you need to save and restart iptables to take effect. Otherwise, they will become invalid after restarting the server.

Recommended site searches: 1g US virtual host, US host rental, Hong Kong proxy server, external network IP query, com domain name registration virtual space purchase, Hong Kong vps host rental, nationwide mixed server, what is needed for website registration, domain name registration official website ,

Set up Linux VPS to disable SMTP port 25 to prevent spam

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码