udp REJECT....
hello... i have problems with dDoS attacks, and would like to set up my linux routers dDoS proof and not being relays like most of available commercial routers.
i am not very skilled in using iptables, but as far i know it is not possible to write following rule :
ip A is attacker ip V is victim.
R is our router.
udp packets go from A to V via R . Victim have soft/alive admin and starts to reject packtets from Attacker (udp flood) . they go via same route - because they're rejected. so first router hitted by them should be R .
router should then block 10x packets recieved from attacker - by rejecting them too, instead of forwarding them to victim.
so for each rejected packtet from victim router should reject next 10 packets recieved from attacker . this way victim'll recieve only 1/10 of original packets coming from attacker. it would be also nice to add feature to dynamically set how much packets Router should reject.
this way there is also possible shaping of traffic while Victim have congested connection - by rejecting packets which can't fit queue. this way Attacker can stop sending packets for a while, while they would be dropped anyway, so it could reduce network load ...
i think something like syncookies plugin could help - because it have to build up new iptables rule basing on analyse of incoming packets...
i think about quick nasty hack :
forward all rejected packets back to forward queue (to it's input) deny forwarding of rejected packets (on output of this queue, so victim'll not recieve his own rejected packets back, but they'll pass thru forward queue anyway...)
apply TBF on each forward queue and set it up so it would 'overflow' only if rejected packet is in . when overflowed it should block all traffic. i think there is iptables rule for counting packets. it should be set up this way, that this 'locked' state would last for at least 10 packets no matter rejected or not.
this is very ugly, as you need to set up tbf queue with detecting of rejected packet presence and drop queue for each rejected packet on out of this queue for each udp port you forward...
but if someone owns powerfull machine for router - it is better than leaving machine unprotected acting as dDoS relay.
i know this solution contains many logical errors, i would be gratefull if someone at least tried to understand what i meant, and wrote working solution...
Signature · 1 line
--
Quoted 2 lines · Bob Arctor
hello... i have problems with dDoS attacks, and would like to set up my linux routers dDoS proof
[SNIP]
In practise, the limit match is all you need for the scenario you described. Find out how many UDP packets your supposed victim sends during normal operation, and limit to two times that.
I usually use a user-defined chain like this:
# LRD for LOG/REJECT/DROP
iptables -N LRD
iptables -A LRD -m limit --limit 1/s -j LOG --log-prefix 'LRD: ' iptables -A LRD -p tcp -m limit --limit 2/s -j REJECT --reject-with tcp-reset iptables -A LRD -m limit --limit 2/s -j REJECT
iptables -A LRD -j DROP
Now, everywhere you now use '-j REJECT', use '-j LRD', instead.
If this does not cover your needs, look into the iplimit target (in patch-o-matic), which does the limit thing per source IP, instead of globally.
hope this helps
Patrick
Quoted 9 lines · Patrick Schaaf
Quoted 2 lines · Bob Arctor
hello... i have problems with dDoS attacks, and would like to set up my linux routers dDoS proof
[SNIP]
In practise, the limit match is all you need for the scenario you described. Find out how many UDP packets your supposed victim sends during normal operation, and limit to two times that.
hmm.. rather not... victim doesn't send _any_ udp packets during normal operation, but starts to reject UDP packets when there is need to block them on the router (thus rejecting them to router from which it doesn't want to have packets coming from )
so these should go to 'forward reject' queue, and be forwarded to original router.... _then_ any packets coming from 'attacker' (or relay - next router) should be rejected .