Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best practices for preventing Denial of Service Attack in Django [closed]

What are the best practices in Django to detect and prevent DoS attacks... Are there any ready to use apps or middleware available which prevents website access and scan through bots?

like image 753
Software Enthusiastic Avatar asked Jul 31 '11 14:07

Software Enthusiastic


People also ask

Which is a method to prevent denial of service attacks?

Firewalls are effective because they can block the offending IP addresses or the ports they're attacking.

How do I provide security in Django?

Django CSRF provides protection against CSRF using its CSRF middleware and creating a secret value, a.k.a CSRF token. A CSRF token is a unique, secret value that is sent to the client-side from the server. And for every subsequent request from the client, the server checks this secret value.

How does DDoS protection work?

Specifically, DDoS protection works by using algorithms and advanced software to monitor incoming traffic to the website. Any traffic that isn't legitimate is denied access, whereas legitimate traffic continues to filter through to the site. DDoS protection options generally guard against attacks up to certain size.


2 Answers

You might want to read the following 3 questions over on Security Stack Exchange.

A quick description of the problem:

  • How does DoS/DDoS attack work?

Possible solutions and limitations of attempting mitigation in software:

  • How can a software application defend against DoS/DDoS?

And a bit of discussion around commonly used anti-DDoS techniques at the perimeter, rather than the application:

  • What techniques do advanced firewalls use to protect against DoS/DDoS?

It is really difficult to do at the application level - the earlier in the path you can drop the attack, the better.

like image 134
Rory Alsop Avatar answered Oct 28 '22 18:10

Rory Alsop


I'd probably aim to deal with DoS at a higher level in the stack. If you're using Apache, take a look at mod_security. Or maybe a nice set of firewall rules.

Edit: Depending on your situation, you also might want to take a look at a caching server like Varnish. It's a lot harder to DoS you, if the vast majority of hits are served by the lightning quick Varnish before they even reach your regular web server.

like image 33
Eli Avatar answered Oct 28 '22 19:10

Eli