I found that authentication codes sent by email from places I rarely log in to were being repeatedly greylisted by MAIB which meant I had to wait several minutes before being able to log in. To remedy this, I searched for a way to bypass the list and found the post Disable greylisting/modify whitelist? on MAIB forum. The advice given by user DustyPants and the creator of MAIB, JoshData, solved the issue by letting me add the sender’s mail server hostnames to the allow list.

This post is a summary of that thread.

Adding Domains to PostGrey Whitelist

Create, or modify, the file /etc/postgrey/whitelist_clients.local with one hostname or regular expression per line. If using regular expressions, the pattern must be prefixed and suffixed with a forward slash ‘/’

[email protected]> nano /etc/postgrey/whitelist_clients.local

The below shows how to allow a single mail server without regular expressions and the second line uses regular expressions to allow a mail server whose hostname is any subdomain at the domain.

/Denotes that this is the start of a regular expression
^Match from the start of the string
.*Match any character zero or more times
\.Match one full stop character. (the backslash escapes the full stop so it is taken literally)
mcgraneThe domain part of the mail server’s hostname. NOT the domain of the sender’s email address
\.coMatch exactly .co by escaping the full stop
\.ukMatch exactly .uk by escaping the full stop
$Match to the end of the string
/Denotes the end of the regular expression

We use the whitelist_clients.local file because it should not be overwritten by future updates to MAIB.

Update 2022: Regex greylisting bypass only works when the string uses ^ and $ so match the whole hostname.