How to prevent your VPS from being hacked and used to send spam

888u

Last update at :2024-02-06,Edit by888u

Recently, a friend said that the VPS he bought was hacked and used to send spam emails, causing his VPS to be blocked by the merchant. Moreover, many merchants have zero tolerance for spam emails. Once discovered, they will be banned immediately. Yes, so today I will talk about how to prevent VPS from being hacked and sending spam emails. The solution we use is to block port 25 of the VPS. Port 25 is specially used for sending emails. Blocking this port can effectively prevent spam from being sent.

First, we must install iptables and run it correctly.

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

4. Save to take effect

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

After setting the iptables rules, you need to save and restart iptables to take effect. However, sometimes the restart will fail. You can try adding a Crontab to execute the command regularly.

After setting this up, your VPS will not be able to send out emails through port 25.

Recommended site searches: me domain name vip domain name, mainland China bgp cloud host, US asp space, free virtual space, foreign vps server rental, ip rental, Taobao virtual host, cheapest cloud server, US domain name registration,

How to prevent your VPS from being hacked and used to send spam

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