From 7b7f101218591d5af8106e9dde74ef4bf0b08fa6 Mon Sep 17 00:00:00 2001 From: Aaron van Meerten Date: Wed, 9 Oct 2024 11:39:01 -0500 Subject: [PATCH] feat(prosody): new flags to disable incoming client and server conection limits (#1928) --- docker-compose.yml | 2 ++ prosody/rootfs/defaults/prosody.cfg.lua | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1c48103..f9f87e1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -269,6 +269,8 @@ services: - PROSODY_C2S_REQUIRE_ENCRYPTION - PROSODY_RESERVATION_ENABLED - PROSODY_RESERVATION_REST_BASE_URL + - PROSODY_DISABLE_C2S_LIMIT + - PROSODY_DISABLE_S2S_LIMIT - PROSODY_ENABLE_RATE_LIMITS - PROSODY_ENABLE_RECORDING_METADATA - PROSODY_ENABLE_STANZA_COUNTS diff --git a/prosody/rootfs/defaults/prosody.cfg.lua b/prosody/rootfs/defaults/prosody.cfg.lua index af7ac1c..347d3e9 100644 --- a/prosody/rootfs/defaults/prosody.cfg.lua +++ b/prosody/rootfs/defaults/prosody.cfg.lua @@ -1,4 +1,6 @@ {{ $C2S_REQUIRE_ENCRYPTION := .Env.PROSODY_C2S_REQUIRE_ENCRYPTION | default "1" | toBool -}} +{{ $DISABLE_C2S_LIMIT := .Env.PROSODY_DISABLE_C2S_LIMIT | default "0" | toBool -}} +{{ $DISABLE_S2S_LIMIT := .Env.PROSODY_DISABLE_S2S_LIMIT | default "0" | toBool -}} {{ $ENABLE_AUTH := .Env.ENABLE_AUTH | default "0" | toBool -}} {{ $ENABLE_GUEST_DOMAIN := and $ENABLE_AUTH (.Env.ENABLE_GUESTS | default "0" | toBool) -}} {{ $ENABLE_IPV6 := .Env.ENABLE_IPV6 | default "true" | toBool -}} @@ -165,15 +167,17 @@ modules_disabled = { -- For more information see http://prosody.im/doc/creating_accounts allow_registration = false; -{{ if ne .Env.PROSODY_MODE "brewery" -}} --- Enable rate limits for incoming client and server connections +{{ if and (ne .Env.PROSODY_MODE "brewery") (or (not $DISABLE_C2S_LIMIT) (not $DISABLE_S2S_LIMIT)) -}} +-- Enable rate limits for incoming connections limits = { -{{ if ne $PROSODY_C2S_LIMIT "" }} +{{ if not $DISABLE_C2S_LIMIT }} +-- Limit incoming client connections c2s = { rate = "{{ $PROSODY_C2S_LIMIT }}"; }; {{ end }} -{{ if ne $PROSODY_S2S_LIMIT "" }} +{{ if not $DISABLE_S2S_LIMIT }} +-- Limit incoming server connections s2sin = { rate = "{{ $PROSODY_S2S_LIMIT }}"; };