This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
networking:firewall:block_host [2013/07/01 16:54] gcooper created |
networking:firewall:block_host [2018/01/15 12:13] (current) gcooper |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Block Traffic From a Particular Host ====== | ====== Block Traffic From a Particular Host ====== | ||
- | :!: You can use DROP or REJECT depending on what you want the blocked host to know. | + | See also **[[networking:router:mikrotik_manual_blacklist|Manually Add and Remove IP Addresses |
- | < | + | :!: You can use '' |
- | iptables -I INPUT -s 66.184.141.132 -j DROP | + | |
- | iptables -I INPUT -s 64.139.76.21 -j DROP | + | |
- | iptables -I INPUT -s 85.25.176.237 -j DROP | + | < |
+ | iptables -I INPUT -s nnn.nnn.nnn.nnn -j DROP | ||
</ | </ | ||
Line 13: | Line 12: | ||
< | < | ||
- | iptables -D INPUT -s 66.184.141.132 -j DROP | + | iptables -D INPUT -s nnn.nnn.nnn.nnn -j DROP |
- | iptables -D INPUT -s 64.139.76.21 | + | |
</ | </ | ||
Line 26: | Line 24: | ||
< | < | ||
- | for ip in `grep Itau.com.br / | + | for ip in `grep spammer.com.br / |
+ | </ | ||
+ | |||
+ | ===== Block Hosts by User Agent String ===== | ||
+ | |||
+ | http:// | ||
+ | |||
+ | < | ||
+ | vim .htaccess | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | # Block bots by User Agent string | ||
+ | SetEnvIfNoCase User-Agent " | ||
+ | # Block empty User Agent string | ||
+ | SetEnvIfNoCase User-Agent ^$ bad_bot | ||
+ | SetEnvIfNoCase User-Agent " | ||
+ | SetEnvIfNoCase User-Agent " | ||
+ | SetEnvIfNoCase User-Agent " | ||
+ | |||
+ | <Limit GET POST HEAD> | ||
+ | Order Allow, | ||
+ | Allow from all | ||
+ | Deny from env=bad_bot | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | service httpd restart | ||
</ | </ |