Skip to content

Commit d7dba35

Browse files
authored
Merge pull request #2564 from ahardin-rh/dos-attacks
Bug 1354145, added Using a Router Image to Protect Against DDoS Attacks
2 parents c2aa6e0 + fe79def commit d7dba35

File tree

1 file changed

+67
-1
lines changed

1 file changed

+67
-1
lines changed

Diff for: install_config/install/deploy_router.adoc

+67-1
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,72 @@ If you used a non-default name for the router, you must change *_dc/router_*
11131113
accordingly.
11141114

11151115

1116+
[[deploy-router-protecting-against-ddos-attacks]]
1117+
=== Protecting Against DDoS Attacks
1118+
1119+
Add *timeout http-request* to the default HAProxy router image to
1120+
protect the deployment against distributed denial-of-service (DDoS) attacks (for
1121+
example, slowloris):
1122+
1123+
====
1124+
----
1125+
# and the haproxy stats socket is available at /var/run/haproxy.stats
1126+
global
1127+
stats socket ./haproxy.stats level admin
1128+
1129+
defaults
1130+
option http-server-close
1131+
mode http
1132+
timeout http-request 5s
1133+
timeout connect 5s <1>
1134+
timeout server 10s
1135+
timeout client 30s
1136+
----
1137+
<1> *timeout http-request* is set up to 5 seconds. HAProxy gives a client 5 seconds
1138+
*to send its whole HTTP request. Otherwise, HAProxy shuts the connection with
1139+
*an error.
1140+
====
1141+
1142+
Also, when the environment variable `*ROUTER_SLOWLORIS_TIMEOUT*` is set, it
1143+
limits the amount of time a client has to send the whole HTTP request.
1144+
Otherwise, HAProxy will shut down the connection.
1145+
1146+
Setting the environment variable allows information to be captured as part
1147+
of the router's deployment configuration and does not require manual
1148+
modification of the template, whereas manually adding the HAProxy setting
1149+
requires you to rebuild the router pod and maintain your router template file.
1150+
1151+
Using annotations implements basic DDoS protections in the HAProxy template
1152+
router, including the ability to limit the:
1153+
1154+
* number of concurrent TCP connections
1155+
* rate at which a client can request TCP connections
1156+
* rate at which HTTP requests can be made
1157+
1158+
These are enabled on a per route basis because applications can have extremely
1159+
different traffic patterns.
1160+
1161+
.HAProxy Template Router Settings
1162+
[cols="2",options="header"]
1163+
|===
1164+
1165+
|Setting |Description
1166+
1167+
|`*haproxy.router.openshift.io/rate-limit-connections*`
1168+
|Enables the settings be configured (when set to *true*, for example).
1169+
1170+
|`*haproxy.router.openshift.io/rate-limit-connections.concurrent-tcp*`
1171+
|The number of concurrent TCP connections that can be made by the same IP
1172+
address on this route.
1173+
1174+
|`*haproxy.router.openshift.io/rate-limit-connections.rate-tcp*`
1175+
|The number of TCP connections that can be opened by a client IP.
1176+
1177+
|`*haproxy.router.openshift.io/rate-limit-connections.rate-http*`
1178+
|The number of HTTP requests that a client IP can make in a 3-second
1179+
period.
1180+
|===
1181+
11161182
[[deploying-customized-router]]
11171183
== Deploying a Customized HAProxy Router
11181184

@@ -1287,8 +1353,8 @@ backend be_tcp_{{$cfgIdx}}
12871353
====
12881354

12891355
After this modification, you can xref:rebuilding-your-router[rebuild your router].
1290-
[[rebuilding-your-router]]
12911356

1357+
[[rebuilding-your-router]]
12921358
=== Rebuilding Your Router
12931359

12941360
After you have made any desired modifications to the template, such as the

0 commit comments

Comments
 (0)