(Apr 15, 2021 03:16 AM)duduch1995 Wrote: Im talking about DDoS Attacks yes
if for example I have a server that is DDoS protected and I do this method. Can he protect the other server?
thanks for your help
Absolutely. But you have to do a little more, in order to protect it than simply setting up a reverse proxy. You can use a reverse proxy as a so called "load balancer". The load balancer basically spreads the requests across your cluster of servers. It is hard to down a well set up load balancer, because it simply does not handle 'heavy' requests. You should also configure it to filter requests somehow. Requests that the system receives that are detected as malicious, should not be forwarded to your back end. You can also use some kind of captcha on your reverse proxy, like cloudflare does. A solved captcha generates a new session that lets the user access the website through the reverse proxy.
But preventing DDoS is pretty much impossible, you can only make it harder. If someone has enough power and some good endpoint to attack, he will probably be able to do it. Just try to make it as hard as possible for them, so most script kiddies cannot afford downing your site. As long as you don't get in trouble with the big boys, you should be good.
Here is a short summarization of some basic DDoS prevention methods:
(I assume you are not building some super big project that will be at high risk for DDoS attacks)
- Build a server cluster that consists of multiple servers that have enough power to handle your requests and also a bit more, in case someone should be able to get through with their bots
- Use a reverse proxy as a load balancer, I recommend Nginx
- Configure a WAF (= Web Application Firewall) with Nginx, I recommend 'Naxsi'
- Maybe use some sort of captcha solution or have one ready that you activate in case of an attack, it is not too hard to even code your own :)
- Use a super strict firewall on your back end server cluster, you can use the iptables command for that, only allow traffic that should be allowed, for instance: allow ssh connections so that you can connect to the server (I also recommend port knocking and using a non-common port for it, adds some extra security), allow traffic from and to your reverse proxy and localhost (i.e. for database stuff), this should be adapted, depending on your needs, the point is that your server should seem dead from the outside, because when someone finds out the IP of your server(s), they have more possible attack points for a DDoS
- Hiding your IP is important, because as I mentioned above, if someone finds out the true IP of your server and you did not set your firewall up correctly, they have a lot more options to attack you, so basically the reverse proxy would be pointless, maybe it would keep some skids away, but that is pretty much it, I already wrote a tutorial, about how someone can find the true IP behind cloudflare, this also applies for reverse proxies you set up on your own, maybe
check that out
- Make sure to make the load requests can generate as small as possible, close database connections after the script is done, use prepared statements, load stuff from external sources ... list is endless, you have to find your way for that, as I don't know what kind of application you want to host
- Use some kind of filtering in your back end as well, even when using Naxsi or some other WAF on your front end, that way you have 2 instances checking the requests
- Make sure to log important stuff!! When a DDoS occurs and you are for some reason not able to defend yourself, you can view the log files and find out what you could have done to prevent it
That is some basic stuff that you as an admin of a site should take care of to prevent DDoS. There is other stuff as well, but I don't want to make this post too long and I also don't know what kind of application we are talking about. Hope I could help you.