The Curity Identity Server provides built-in DoS (Denial of Service) protection designed for relatively simpler deployments.
Hint
For comprehensive DoS protection that can handle very large attacks, we recommend using specialized services instead of, or together with, the built-in DoS feature.
The DoS protection feature attempts to reject excessive requests from certain clients while minimizing server resource usage. For the system to work, it has to track client addresses, which introduces some memory overhead and may affect performance. For this reason, it is recommended that before enabling this feature, tests are used to validate that this protection mechanism meets your specific performance requirements.
Note
The DoS protection data is local to each Curity instance. In other words, Curity cluster nodes do not share information about clients between themselves. If a load balancer is placed in front of the Curity servers, then a single client will be able to make more requests over time than it could make against a single server instance. That is important to consider when configuring this feature.
The DoS Protection feature uses the Leaky Bucket Algorithm.
This algorithm works as follows:
The system tracks clients by their IP address or host. To resolve the client address, Curity may take into consideration the X-Forwarded-For header, but that requires configuring White-listed-proxies. If the header is not set, the client IP address is used directly, which may not work correctly if a reverse proxy is always used before Curity receives any requests (because all requests will appear to come from a single IP address), hence it is highly recommended to configure appropriate white-listed proxies.
X-Forwarded-For
The maximum number of tracked clients can be configured. When the limit is reached, new clients receive a 503 (Service Unavailable) status code.
503
Requests rejected due to rate limiting receive a 429 (Too Many Requests) status code.
429
To enable DoS Protection, activate the dos-protection setting on the service role.
dos-protection
The following configuration parameters are available (all parameters have sensible default values):
0
Notice that because of the algorithm used, max-requests-per-second can be exceeded while the bucket for a client has not completely filled up.
max-requests-per-second
Given a bucket size of 50, and max-requests-per-second is 10:
50
10
In the above scenario, it is recommended that the idle-timeout should be at least 5 seconds, allowing the client’s bucket to completely empty before the client tracker is removed.
idle-timeout