Archiv verlassen und diese Seite im Standarddesign anzeigen : iptables eine IP blocken auf bestimmte Ports
Hallo,
ist es mit iptables mögliche eine IP zu blocken für bestimmte Ports? Und ggf. möglich einen Zeitrahmen anzugeben? Also sagen wir mal eine IP für 5 Stunden sperren auf Port 80 ? :confused:
Danke
Veierabend
10.05.08, 09:36
Für die Sperrung der Ports würde sich die Option "-m multiport" anbieten
multiport
This module matches a set of source or destination ports. Up to 15 ports can be specified. A port range (port:port) counts as two ports. It can only be used in conjunction with -p tcp or -p udp.
--source-ports [!] port[,port[,port:port...]]
Match if the source port is one of the given ports. The flag --sports is a convenient alias for this option.
--destination-ports [!] port[,port[,port:port...]]
Match if the destination port is one of the given ports. The flag --dports is a convenient alias for this option.
--ports [!] port[,port[,port:port...]]
Match if either the source or destination ports are equal to one of the given ports.
oder wenns nur ein Port ist dann halt Standard
iptables -A INPUT -s $IP -dport 80 -j DROP
und beim Zeitrahmen könnte man entweder über nen Cron Job oder per Skript und sleep die entsprechende Regel wieder löschen.
So wie ich das bei Multiport verstanden habe sperre ich den Port? Ich möchte nur bestimmte IPs für eine bestimmte Zeit von einigen Ports fern halten und nicht die port für alle dicht machen.
Wenn ich per iptable einen Port für die IP sperren kann, kann ich dann auch mehrere angeben? Oder für einen ipt mehrere Ports sperren?
Veierabend
10.05.08, 11:10
Wenn du nur für eine IP sperren willst, nimmst du die Option -s mit der IP dahinter und wenn du nur einen Port sperren willst reicht z.B. --dport 80 , wenn der Zugriff auf http geblockt werden soll.
Also
iptables -A INPUT -s 217.143.56.14 --dport 80 -j DROP
Bei mehreren Ports nimmst dann halt
iptables -A INPUT -s 217.143.56.14 -m multiport --dport 21,22,80,8080 usw. -j DROP
Vielen Dank! Ich werde es bei gelegen heit probieren!
Powered by vBulletin® Version 4.2.5 Copyright ©2024 Adduco Digital e.K. und vBulletin Solutions, Inc. Alle Rechte vorbehalten.