mirror of
https://github.com/chatmail/relay.git
synced 2026-05-12 17:14:36 +00:00
rspamd: add rate limiting
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
9
cmdeploy/src/cmdeploy/rspamd/ratelimit.conf
Normal file
9
cmdeploy/src/cmdeploy/rspamd/ratelimit.conf
Normal file
@@ -0,0 +1,9 @@
|
||||
rates {
|
||||
user = {
|
||||
bucket = {
|
||||
burst = 110;
|
||||
rate = "90 / 1min";
|
||||
}
|
||||
}
|
||||
}
|
||||
whitelisted_user = "/etc/rspamd/local.d/whitelisted_users_ratelimit.map"
|
||||
Reference in New Issue
Block a user