Skip to content

Commit 222fa42

Browse files
committed
feat: disable TimeoutAcceptor when TSL is enabled
The TimeoutAcceptor es a custom acceptor for Axum that sets a timeput for making a request after openning a connection. It does not work when TSL is enabled. This commit disables it, therefore the app does not have any way to avoid a DDos attacks where clients just open connections without making any request.
1 parent 0a04dde commit 222fa42

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/servers/apis/server.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,9 @@ impl Launcher {
239239
match tls {
240240
Some(tls) => custom_axum_server::from_tcp_rustls_with_timeouts(socket, tls)
241241
.handle(handle)
242-
.acceptor(TimeoutAcceptor)
242+
// The TimeoutAcceptor is commented because TSL does not work with it.
243+
// See: https://github.com/torrust/torrust-index/issues/204#issuecomment-2115529214
244+
//.acceptor(TimeoutAcceptor)
243245
.serve(router.into_make_service_with_connect_info::<std::net::SocketAddr>())
244246
.await
245247
.expect("Axum server for tracker API crashed."),

src/servers/http/server.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ impl Launcher {
6565
match tls {
6666
Some(tls) => custom_axum_server::from_tcp_rustls_with_timeouts(socket, tls)
6767
.handle(handle)
68-
.acceptor(TimeoutAcceptor)
68+
// The TimeoutAcceptor is commented because TSL does not work with it.
69+
// See: https://github.com/torrust/torrust-index/issues/204#issuecomment-2115529214
70+
//.acceptor(TimeoutAcceptor)
6971
.serve(app.into_make_service_with_connect_info::<std::net::SocketAddr>())
7072
.await
7173
.expect("Axum server crashed."),

0 commit comments

Comments
 (0)