diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 07bb6736..25ffc042 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,7 +15,7 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha }} - name: download filtermail - run: curl -L https://github.com/chatmail/filtermail/releases/download/v0.1.2/filtermail-x86_64 -o /usr/local/bin/filtermail && chmod +x /usr/local/bin/filtermail + run: curl -L https://github.com/chatmail/filtermail/releases/download/v0.2.0/filtermail-x86_64-musl -o /usr/local/bin/filtermail && chmod +x /usr/local/bin/filtermail - name: run chatmaild tests working-directory: chatmaild run: pipx run tox diff --git a/chatmaild/src/chatmaild/config.py b/chatmaild/src/chatmaild/config.py index aa45625a..38c955c8 100644 --- a/chatmaild/src/chatmaild/config.py +++ b/chatmaild/src/chatmaild/config.py @@ -20,7 +20,8 @@ class Config: def __init__(self, inipath, params): self._inipath = inipath self.mail_domain = params["mail_domain"] - self.max_user_send_per_minute = int(params["max_user_send_per_minute"]) + self.max_user_send_per_minute = int(params.get("max_user_send_per_minute", 60)) + self.max_user_send_burst_size = int(params.get("max_user_send_burst_size", 10)) self.max_mailbox_size = params["max_mailbox_size"] self.max_message_size = int(params.get("max_message_size", "31457280")) self.delete_mails_after = params["delete_mails_after"] diff --git a/chatmaild/src/chatmaild/ini/chatmail.ini.f b/chatmaild/src/chatmaild/ini/chatmail.ini.f index e2cdc104..29d7baa9 100644 --- a/chatmaild/src/chatmaild/ini/chatmail.ini.f +++ b/chatmaild/src/chatmaild/ini/chatmail.ini.f @@ -11,9 +11,12 @@ mail_domain = {mail_domain} # Restrictions on user addresses # -# how many mails a user can send out per minute +# email sending rate per user and minute max_user_send_per_minute = 60 +# per-user max burst size for sending rate limiting (GCRA bucket capacity) +max_user_send_burst_size = 10 + # maximum mailbox size of a chatmail address max_mailbox_size = 500M diff --git a/cmdeploy/src/cmdeploy/filtermail/deployer.py b/cmdeploy/src/cmdeploy/filtermail/deployer.py index 4b13b3d6..599ea8f5 100644 --- a/cmdeploy/src/cmdeploy/filtermail/deployer.py +++ b/cmdeploy/src/cmdeploy/filtermail/deployer.py @@ -14,10 +14,10 @@ class FiltermailDeployer(Deployer): def install(self): arch = host.get_fact(facts.server.Arch) - url = f"https://github.com/chatmail/filtermail/releases/download/v0.1.2/filtermail-{arch}" + url = f"https://github.com/chatmail/filtermail/releases/download/v0.2.0/filtermail-{arch}-musl" sha256sum = { - "x86_64": "de7de6e011ffc06881d3a05fc9788e327ba2389219e77280ace38b429e11a5ce", - "aarch64": "a78fcdfb81eb3d9c8a8b6f84f6c0a75519b8be01aa25bd4617d72aae543992b4", + "x86_64": "1e5bbb646582cb16740c6dfbbca39edba492b78cc96ec9fa2528c612bb504edd", + "aarch64": "3564fba8605f8f9adfeefff3f4580533205da043f47c5968d0d10db17e50f44e", }[arch] self.need_restart |= files.download( name="Download filtermail", diff --git a/cmdeploy/src/cmdeploy/tests/online/test_1_basic.py b/cmdeploy/src/cmdeploy/tests/online/test_1_basic.py index 97f5c056..c8525125 100644 --- a/cmdeploy/src/cmdeploy/tests/online/test_1_basic.py +++ b/cmdeploy/src/cmdeploy/tests/online/test_1_basic.py @@ -196,7 +196,7 @@ def test_exceed_rate_limit(cmsetup, gencreds, maildata, chatmail_config): try: user1.smtp.sendmail(user1.addr, [user2.addr], mail) except smtplib.SMTPException as e: - if i < chatmail_config.max_user_send_per_minute: + if i < chatmail_config.max_user_send_burst_size: pytest.fail(f"rate limit was exceeded too early with msg {i}") outcome = e.recipients[user2.addr] assert outcome[0] == 450