The old left received an email from a previous VPS merchant today and mentioned that the SPAM message sent by VPS was suspended. This small VPS was also activated during the test. I forgot to use it later. It is estimated that the password was too simple or other factors were used to send emails. Many people may have encountered this problem.
First of all, if you encounter such a problem, reinstall the system, set a complicated password, modify the port, set the key to log on, and so on. Then, check the relevant information to shield the SMTP mail port 25, therefore, in this article, the old Left will simply organize how to disable port 25 to prevent spam.
1. Common settings
1. Shield all port 25 connections
Iptables-I FORWARD-p tcp -- dport 25-j DROP
2. Allow specific IP addresses to connect to port 25.
Iptables-I FORWARD-s xx. xx-p tcp -- dport 25-j ACCEPT
3. Disable specific IP addresses from connecting to port 25.
Iptables-I FORWARD-s xx. xx-p tcp -- dport 25-j DROP
2. Save and take effect
/Etc/rc. d/init. d/iptables save
/Etc/init. d/iptables restart
After setting iptables rules, you must save the rules and restart iptables to make the rules take effect. Otherwise, the system becomes invalid after the server is restarted.