Yahoo Groups archive

Milter-greylist

Index last updated: 2026-04-28 23:32 UTC

Message

Rate Limit Rules

2016-11-09 by Can Şirin

Hi,

My purpose is to limit every user except that I defined ones.

#####################################################################
ratelimit "high_limit" rcpt 9 / 1h key "%M{auth_authen}"
sm_macro "null" "{auth_authen}" unset
racl blacklist \
  not sm_macro "null" \
  ratelimit "high_limit" \
  msg "High limit exceeded."

ratelimit "standart_limit" rcpt 3 / 1h key "%M{auth_authen}"
sm_macro "user1" "{auth_authen}" "user1"
sm_macro "user2" "{auth_authen}" "user2"
racl blacklist \
  not sm_macro "null" \
  not sm_macro "user1" \
  not sm_macro "user2" \
  ratelimit "standart_limit" \
  msg "Standart limit exceeded."
#####################################################################

In this case that you can see above, these two rules is matched for  
every authenticated user's message until standart limit users exceeds  
the standart limit. But there is a problem here. For every message  
passed from ratelimit conditions, counter is increased one by one in  
every matched rule. So for example when user3 sends a message; in the  
first message, its ratelimit counter will be 2, after the rule process  
finished . In second message of it will be 4.

My aim is just to add the high limit users to exception list of  
"standart limit" rule (by adding "not sm_macro blabla").Becuase of  
every ratelimit rule has a common counter; I cannot achieve this case.

I can achive this it by taking the standart limit rule above the high  
limit rule and then add the high limit rules for every user  
seperately. You can see below.

#####################################################################
ratelimit "standart_limit" rcpt 3 / 1h key "%M{auth_authen}"
sm_macro "user1" "{auth_authen}" "user1"
sm_macro "user2" "{auth_authen}" "user2"
racl blacklist \
  not sm_macro "null" \
  not sm_macro "user1" \
  not sm_macro "user2" \
  ratelimit "standart_limit" \
  msg "Standart limit exceeded."

ratelimit "high_limit" rcpt 9 / 1h key "%M{auth_authen}"
racl blacklist \
  not sm_macro "null" \
  sm_macro "user1" \
  ratelimit "high_limit" \
  msg "High limit exceeded."

ratelimit "high_limit" rcpt 9 / 1h key "%M{auth_authen}"
racl blacklist \
  not sm_macro "null" \
  sm_macro "user2" \
  ratelimit "high_limit" \
  msg "High limit exceeded."
#####################################################################

What is the disadvantage of taking counter seperated for every ratelimit rule?

You can take this as a feedback.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.