Blocking SMTP connections: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
==Blocking== | |||
If a VPS user has been found to be spamming other users, you can block them temporarily from accessing SMTP ports by issuing commands similar to the following on the node that their VPS is situated on: | If a VPS user has been found to be spamming other users, you can block them temporarily from accessing SMTP ports by issuing commands similar to the following on the node that their VPS is situated on: | ||
| Line 7: | Line 9: | ||
iptables -t mangle -D POSTROUTING -s <IP ADDRESS> -p tcp --source-port 25 -j DROP | iptables -t mangle -D POSTROUTING -s <IP ADDRESS> -p tcp --source-port 25 -j DROP | ||
iptables -t mangle -D POSTROUTING -s <IP ADDRESS> -p tcp --destination-port 25 -j DROP | |||
==Rate Limiting== | |||
If you want to reduce their SMTP limits to around 1Mbit per second (66 packets at ~1500 bytes per packet), use the following commands: | |||
iptables -t mangle -A POSTROUTING -s <IP ADDRESS> -p tcp --destination-port 25 -m limit --limit 66/sec -j ACCEPT | |||
iptables -t mangle -A POSTROUTING -s <IP ADDRESS> -p tcp --destination-port 25 -j DROP | |||
To unblock, just use the -D rules: | |||
iptables -t mangle -D POSTROUTING -s <IP ADDRESS> -p tcp --destination-port 25 -m limit --limit 66/sec -j ACCEPT | |||
iptables -t mangle -D POSTROUTING -s <IP ADDRESS> -p tcp --destination-port 25 -j DROP | iptables -t mangle -D POSTROUTING -s <IP ADDRESS> -p tcp --destination-port 25 -j DROP | ||
Revision as of 20:02, 20 April 2013
Blocking
If a VPS user has been found to be spamming other users, you can block them temporarily from accessing SMTP ports by issuing commands similar to the following on the node that their VPS is situated on:
iptables -t mangle -I POSTROUTING -s <IP ADDRESS> -p tcp --source-port 25 -j DROP iptables -t mangle -I POSTROUTING -s <IP ADDRESS> -p tcp --destination-port 25 -j DROP
To unblock, just use the -D rules:
iptables -t mangle -D POSTROUTING -s <IP ADDRESS> -p tcp --source-port 25 -j DROP iptables -t mangle -D POSTROUTING -s <IP ADDRESS> -p tcp --destination-port 25 -j DROP
Rate Limiting
If you want to reduce their SMTP limits to around 1Mbit per second (66 packets at ~1500 bytes per packet), use the following commands:
iptables -t mangle -A POSTROUTING -s <IP ADDRESS> -p tcp --destination-port 25 -m limit --limit 66/sec -j ACCEPT iptables -t mangle -A POSTROUTING -s <IP ADDRESS> -p tcp --destination-port 25 -j DROP
To unblock, just use the -D rules:
iptables -t mangle -D POSTROUTING -s <IP ADDRESS> -p tcp --destination-port 25 -m limit --limit 66/sec -j ACCEPT iptables -t mangle -D POSTROUTING -s <IP ADDRESS> -p tcp --destination-port 25 -j DROP