Skip to content

Fix Catchall Greylisting

Fürni requested to merge fuerni/ispconfig3:patch-3 into stable-3.1

Greylisting didn't work on catchall addresses. The old query never returned a row for catchall addresses.

The Problem

Let's assume the catchall domain '@catchall.domain.tld' that redirects to 'user@domain.tld' and somebody sending an e-mail to 'test@catchall.domain.tld'. Then postfix will run the query with the following values for %s: 'test@catchall.domain.tld', 'catchall.domain.tld', 'domain.tld', 'de', 'test@'. It does not run the query for the destination of the catchall address.

In the database table mail_forwarding would be an entry with source = '@catchall.domain.tld' and greylisting = 'n'. You cannot enable greylisting for catchall addresses in ISPConfig, so it is always 'n'. Additionally, the old query doesn't check for '@catchall.domain.tld', only for 'catchall.domain.tld'. Therefore, there wouldn't be a match anyway.

My Solution

I added an additional query (using UNION) that just checks for catchall addresses in the mail_forwarding table with a '@' prefixed to the value given by postfix. Then I cross join to the mail_user table to find the destination mail account and check if it has greylisting enabled or not.

Merge request reports