From 5285b70977476624e5a535cbc6dda5a78ef22c88 Mon Sep 17 00:00:00 2001 From: Matthew Saunders Brown Date: Fri, 31 Dec 2021 12:36:24 -0800 Subject: [PATCH] fixed rate limit mysql lookup --- etc/exim4/exim4.conf | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/etc/exim4/exim4.conf b/etc/exim4/exim4.conf index 9e642ca..7b3a3a9 100644 --- a/etc/exim4/exim4.conf +++ b/etc/exim4/exim4.conf @@ -377,24 +377,24 @@ acl_rcpt_to: # compromised account, not to restrict legitimate users. Set your defaults & limits accordignly. warn authenticated = * - set acl_m_ratelimit_hourly = ${lookup mysql{SELECT vm_mboxes.ratelimit FROM vm_domains, vm_mboxes WHERE vm_domains.domain='${domain}' AND vm_mboxes.mbox='${local_part}' AND vm_domains.id = vm_mboxes.domain_id AND vm_mboxes.ratelimit IS NOT NULL}{$value}{"100000"}} - set acl_m_ratelimit_daily = ${eval: $acl_m_ratelimit_hourly * 10} + set acl_m_ratelimit_hourly = ${lookup mysql{SELECT IFNULL(vm_mboxes.ratelimit, 100000) FROM vm_domains, vm_mboxes WHERE vm_domains.domain="$sender_address_domain" AND vm_mboxes.mbox="$sender_address_local_part" AND vm_domains.id = vm_mboxes.domain_id}} + set acl_m_ratelimit_daily = ${eval: (10 * $acl_m_ratelimit_hourly) } ratelimit = 0 / 1h / per_mail / strict / $authenticated_id - log_message = Sender rate $sender_rate/$sender_rate_period for $authenticated_id + log_message = Sender rate is $sender_rate/$sender_rate_period for $authenticated_id # enforce hourly rate limit deny authenticated = * ratelimit = $acl_m_ratelimit_hourly / 1h / per_mail / strict / $authenticated_id - message = Rate Limit of $sender_rate/$sender_rate_period exceeded. Try again later. - log_message = $authenticated_id exceeded rate limit of $sender_rate/$sender_rate_period + message = Rate Limit of $acl_m_ratelimit_hourly per hour exceeded. Try again later. + log_message = $authenticated_id exceeded rate limit of $acl_m_ratelimit_hourly per hour # enforce daily rate limit deny authenticated = * ratelimit = $acl_m_ratelimit_daily / 1d / per_mail / strict / $authenticated_id - message = Rate Limit of $sender_rate/$sender_rate_period exceeded. Try again later. - log_message = $authenticated_id exceeded rate limit of $sender_rate/$sender_rate_period + message = Rate Limit of $acl_m_ratelimit_daily per day exceeded. Try again later. + log_message = $authenticated_id exceeded rate limit of $acl_m_ratelimit_daily per day # authenticated user did not exceed rate limits, accept message now accept