rspamd: add rate limiting

This commit is contained in:
missytake 2023-10-15 23:25:36 +02:00 committed by link2xt
parent 67062677b0
commit 28fc91f5f3
2 changed files with 19 additions and 0 deletions

View File

@ -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"

View File

@ -0,0 +1,9 @@
rates {
user = {
bucket = {
burst = 110;
rate = "90 / 1min";
}
}
}
whitelisted_user = "/etc/rspamd/local.d/whitelisted_users_ratelimit.map"