5 ms·
Roughly, a somewhat lackluster response to a somewhat lackluster DDoS attempt. They tried blocking specific ip addresses, which didn't work, because the attack
by tyingq 11y ago
Roughly, a somewhat lackluster response to a somewhat lackluster DDoS attempt.
They tried blocking specific ip addresses, which didn't work, because the attack was somewhat distributed. They then just turned on some caching, which allowed the site to function, albeit with an unknown excess bandwidth charge pending.
And, the DDoS itself can't of been terribly impressive, as all it took to mitigate was a bit of caching. He mentions 10 requests / sec as the scale of the attack.
- tyingq 11y agoThinking on this some more, this story makes even less sense. He first mentions having to change Apache to recognize X-Forwarded-For, because there is Amazon Elastic Load Balancing between his site and the internet. This means, of course, that the "attacking ips" aren't making direct connections to his EC2 instance. They are proxied connections, all from the internal ELB service. So later, when he mentions trying to use iptables to block traffic...that just doesn't make sense. There are no connections from those ips to the EC2 instance. You could use .htaccess rules, since Apache is aware of X-Forwarded-For. Lastly...why would you put an elastic load balancer in front of a single web server?
- Remiii 11y agoI can't answer for LaurentGh but if I well remember is a temporary situation (for few months).
- spatten 11y agoYou do this by telling iptables to look at the X-Forwarded-For header when deciding what IP that request is coming from. This blog posts explains the whole thing: https://centos.tips/fail2ban-behind-a-proxyload-balancer/ https://centos.tips/fail2ban-behind-a-proxyload-balancer/ I have no idea if using .htaccess rules would be better than this solution, I just know that this one works.
- tyingq 11y agoThe article shows the run of the mill iptables syntax being used, no packet inspection... And, it's possible this is https, which would render the packet inspection useless.
- ckinnan 11y agoYou might use ELB + one EC2 to serve an SSL certificate. That takes the encryption load off of EC2 and is durable. AWS has a new SSL service though, but this was a recommended way until recently.
- LaurentGh 11y agoExactly our situation :)
- ckozlowski 11y agoThere's a few cases; some have mentioned scenarios where you might want SSL offload. Those are perfectly valid. I'll contribute another. Let's say you have a single web server you need to have up all of the time. You need high availability, but not necessarily instant fail-over, because you want to keep your costs low, and so you don't want two instances running all of the time. It may not serve much traffic at all, so there isn't much load to spread. What you can do is place an ELB in front of the web server, set a condition to start a new instance if the page becomes non-responsive (i.e., a failure), and set the auto-scaling to "min 1, max 1." This way, you'll always have a pool of one server, that will automatically rebuild if the instance fails. I admit, it's not a common use case, but it's one of the more clever uses of the ELB I've heard. =)
- Xorlev 11y agoWe do this. We have 50+ ASGs for the same reason. Often it's min=3, max=3 for HA, but if a machine fails it's automatically replaced. Every service in our infrastructure runs the same way. Some have scaling policies, some don't. DBs like Cassandra are also in ASGs since if one of them terminates and new one can come up and bootstrap without operator intervention.
- LaurentGh 11y agoI think you're absolutely right for iptables, as I didn't changed anything to use the X-Forwarded-For IP, so this part might have been fully useless. About the EC2, it's because it's managing the SSL for us, and we used to have two servers behind it. Everything could have been planed way better (cached, written with a fancy language...), we could have had 10 mil requests/µsec... the main idea was just to get tell how we tried to manage the situation, with the website and skill we have. I also think my testimony is nearer to what most of web dev can be confronted to, in contrary to one Cloudflare/Gihub BS press release written by 10 experts to increase valuation :p
- SomeCallMeTim 11y agoI was shocked that 12 requests/second could take down any site. I use async logic (previously OpenResty, more recently NodeJS and Go) and largely pregenerated sites, so 2500 requests/second is a minimum baseline -- on a much lower end instance than an m4.xlarge. There's a reason I don't use PHP (or any primarily synchronous language like Ruby) any more.
- nonamegdsa 11y agoIf the request is performing heavy calculations you will see fever req/sec obviously. Say an API call spins up a Linux VM and makes it available some user. Or a bulk upload of data which needs to be indexed. Or whatever. The idea that a site should be able to handle X requests/sec because the stack can handle X NOOPs per second is odd.
- SomeCallMeTim 11y agoNot talking NOOPs. I'm talking multiple full round trips to the database per query. Node can render more NOOPs per second than that; I've heard of a well tuned Node server hitting 100k. But because of the async nature of the handling of responses, you don't need dozens or hundreds of threads to handle thousands of clients, and it's the threads that kill you. Unless you've just got an awful architecture, in which case that will kill you first.
- nonamegdsa 11y agoI still don't understand what point you are trying to make. Surely you must agree that the number of requests per second your server will depends on what the server is doing? If your operation calls a DB or calculates something and that is heavy, then your db or internal calculation service might run out of resources. I'm not sorry, but your lack of experience with large scale systems is visible.
- SomeCallMeTim 11y agoMost web sites are just grabbing data from databases. If you use an async front-end, it's the database servers that need to scale, because they're doing the heavy lifting. But scaling your database infrastructure can be orthogonal to scaling the application layer; in Node, except for under extreme load, you may never NEED to scale the application layer. And for really high load situations, you may need 25-50x fewer Node servers than PHP. It's the poor design of most systems that cause them to not scale; there are certainly exceptions where the server needs to do a lot of complex calculations, but those calculations can most of the time be handled in microservices and, again, scaled orthogonally to the application layer.