Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
it:net:iptables [2006-07-09 16:50] rosenkeit:net:iptables [2007-02-04 14:17] (current) – Recent-Modul rosenke
Line 1: Line 1:
 =====Notizen zu iptables===== =====Notizen zu iptables=====
 +
 +====Das Recent-Modul====
 +
 +Das Recent-Modul von iptables/Netfilter ist sehr nützlich, wenn es darum geht Brute-Force-Attacken abzufangen, die zum Beispiel gegen SSH gerichtet sind und dabei hauptsächlich die Logs vollmüllen.
 +
 +Dieses Ziel erreicht man beispielsweise mit dem folgenden Codeschnippsel((die Variablen sind natürlich vorher entsprechend zu setzen, ebenso sollte eine Chain //ssh// vorhanden und eingebaut sein)):
 +
 +<code>
 +#setup ssh chain
 +${iptables} -A ssh --protocol tcp --destination ${own_ip} \
 + --destination-port 22 --match state --state ! NEW,INVALID \
 + --jump RETURN
 +${iptables} -A ssh --protocol tcp --destination ${own_ip} \
 + --destination-port 22 --match state --state NEW,INVALID \
 + --match recent --name ssh --update --seconds 90 --hitcount 4 \
 + --match limit --limit 2/minute \
 + --jump LOG --log-prefix "ssh_brute_force "
 +${iptables} -A ssh --protocol tcp --destination ${own_ip} \
 + --destination-port 22 --match state --state NEW,INVALID \
 + --match recent --name ssh --update --seconds 90 --hitcount 4 \
 + --jump REJECT --reject-with tcp-reset
 +${iptables} -A ssh --protocol tcp --destination ${own_ip} \
 + --destination-port 22 --match state --state NEW,INVALID \
 + --match recent --name ssh --set --jump RETURN
 +</code>
 +
 +Einige weitere Beispiele finden sich auf der [[http://snowman.net/projects/ipt_recent/|Homepage des Autors]].
  
 ====Miscellen==== ====Miscellen====
it/net/iptables.txt · Last modified: 2007-02-04 14:17 by rosenke
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0