Postgrey can be used to enable greylisting for a Postfix mail server.
Install the package. To get it running quickly edit the Postfix configuration file and add these lines:
smtpd_recipient_restrictions = check_policy_service inet:127.0.0.1:10030
Then start/enable the
postgrey service. Afterwards, reload the
postfix service. Now greylisting should be enabled.
Configuration is done via editing the
greylist.service file. First copy it over to edit it.
# cp /usr/lib/systemd/system/postgrey.service /etc/systemd/system/
Now you can edit it. For example, to add automatic whitelisting (successful deliveries are whitelisted and don't have to wait any more), you could add the
--auto-whitelist-clients=N option and replace
N by a suitably small number (or leave it at its default of 5).
If you specify --unix=/path/to/socket and the socket file is not created ensure you have removed the default --inet=127.0.0.1:10030 from the service file.
For a full documentation of possible options see