[Rspamd-Users] rate limit with regex extraction

Gerald Galster list+rspamd at gcore.biz
Thu Nov 21 12:07:37 UTC 2019


I would like to extract some parts of a header and use those for rate limiting instead of the whole header string:

rates {
	mailx_limit = {

		# does not limit anything (nor if it contains customer \d\d\d nor something else)
		# selector = "header('subject').lower.regexp('customer \\d\\d\\d')";	

		# works as expected but returns 'customer' for all customer ids
		# selector = "header('subject').lower.regexp('customer \\d\\d\\d').id('customer')";

		# I would like to extract 'customer \d\d\d' so every customer id gets its own rate limit
		# this applies rate limit to subjects that do not even contain the regex
		selector = "header('subject').lower:regexp('customer \\d\\d\\d')";
		bucket = [
				burst = 2;
				rate = "1 / 1min";

Can anybody give me a hint what the selector should look like?

Is there a function like id() that just returns what regexp() returns or nil?


More information about the Users mailing list