diff --git a/cmdeploy/src/cmdeploy/__init__.py b/cmdeploy/src/cmdeploy/__init__.py index 6cd991c..06401b4 100644 --- a/cmdeploy/src/cmdeploy/__init__.py +++ b/cmdeploy/src/cmdeploy/__init__.py @@ -416,6 +416,16 @@ def _configure_rspamd(dkim_selector: str, mail_domain: str) -> bool: ) need_restart |= hfilter.changed + ratelimit_conf = files.put( + name="enable rate limiting", + src=importlib.resources.files(__package__).joinpath("rspamd/ratelimit.conf"), + dest="/etc/rspamd/local.d/ratelimit.conf", + user="root", + group="root", + mode="644", + ) + need_restart |= ratelimit_conf.changed + dkim_directory = "/var/lib/rspamd/dkim/" dkim_key_path = f"{dkim_directory}{mail_domain}.{dkim_selector}.key" diff --git a/cmdeploy/src/cmdeploy/rspamd/ratelimit.conf b/cmdeploy/src/cmdeploy/rspamd/ratelimit.conf new file mode 100644 index 0000000..fe6bb18 --- /dev/null +++ b/cmdeploy/src/cmdeploy/rspamd/ratelimit.conf @@ -0,0 +1,9 @@ +rates { + user = { + bucket = { + burst = 110; + rate = "90 / 1min"; + } + } +} +whitelisted_user = "/etc/rspamd/local.d/whitelisted_users_ratelimit.map"