User Tools

Site Tools


networking:firewall:block_host

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
networking:firewall:block_host [2013/07/01 16:55]
gcooper
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 to a Mikrotik Blacklist]]** 
 + 
 +:!: You can use ''DROP'' or ''REJECT'' depending on what you want the blocked host to know.
  
 <file> <file>
-iptables -I INPUT -s 66.184.141.132 -j DROP+iptables -I INPUT -s nnn.nnn.nnn.nnn -j DROP
 </file> </file>
  
Line 10: Line 12:
  
 <file> <file>
-iptables -D INPUT -s 66.184.141.132 -j DROP+iptables -D INPUT -s nnn.nnn.nnn.nnn -j DROP
 </file> </file>
  
Line 22: Line 24:
  
 <file> <file>
-for ip in `grep Itau.com.br /var/log/httpd/error_log|egrep -o "client [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+"|sort |uniq|cut -f 2 -d " "`; do iptables -I INPUT -s $ip -j DROP; done+for ip in `grep spammer.com.br /var/log/httpd/error_log|egrep -o "client [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+"|sort |uniq|cut -f 2 -d " "`; do iptables -I INPUT -s $ip -j DROP; done 
 +</file> 
 + 
 +===== Block Hosts by User Agent String ===== 
 + 
 +http://en.linuxreviews.org/HOWTO_stop_automated_spam-bots_using_.htaccess 
 + 
 +<file> 
 +vim .htaccess 
 +</file> 
 + 
 +<file> 
 +# Block bots by User Agent string 
 +SetEnvIfNoCase User-Agent "^Mozilla\/4.0 \(compatible\; MSIE 6.0\; Windows NT 5.1\; SV1\)" bad_bot 
 +# Block empty User Agent string 
 +SetEnvIfNoCase User-Agent ^$ bad_bot 
 +SetEnvIfNoCase User-Agent "^AESOP_com_SpiderMan" bad_bot 
 +SetEnvIfNoCase User-Agent "^Alexibot" bad_bot 
 +SetEnvIfNoCase User-Agent "^Zyborg" bad_bot 
 + 
 +<Limit GET POST HEAD> 
 +Order Allow,Deny 
 +Allow from all 
 +Deny from env=bad_bot 
 +</Limit> 
 +</file> 
 + 
 +<file> 
 +service httpd restart
 </file> </file>
networking/firewall/block_host.1372719314.txt.gz · Last modified: 2013/07/01 16:55 by gcooper