Disable greylisting/modify whitelist?

  1. Is there a way to disable greylisting?
  2. Is there a way to add domains to a whitelist?

Password reset emails from https://www.calltrunk.com/us/en/sign-in.html never come through. Having trouble with many other online services on signup where welcome/confirmation emails take forever to come through.

I would prefer to disable grey listing altogether as many users are getting very frustrated.

Hello. No there’s no way to disable it, sorry. To whitelist you can add the IP address or hostname of the sending mail server in /etc/postgrey/whitelist_clients. Note that it’s the sending mail server and not the domain in the From/envelope header.

1 Like

Actually you could probably whitelist all senders to effectively disable postgrey entirely.

How do I whitelist all? Add a * entry?

/.*/

Will probably do it. (That’s a regular expression.) Haven’t tried it though.

Thanks Josh for the RegEx, but unfortunately it doesn’t work. Every e-mail still gets grey listed.

I’m trying to minimize the impact of greylisting. On a server with 1 user, greylisting can be annoying. It has been more then once that I’m waiting on an e-mail that should have arrived sooner, for example: the security code of Facebook, an order on Steam during a LAN, waiting in a store waiting for a coupon code to arrive. This is more annoying then letting a e-mail hit the SpamAssassin and probably be filtered out.

Josh, any idea why greylisting is still active after the RegEx? I have restarted Postgrey. I don’t see any reason why it should, as the config file of postgrey gets loaded with the /etc/init.d/postgrey. I even set the whitelist-clients=/etc/defaults/postgrey/… manually.

About small volume e-mail server (like mine): It would be nice to set some postgrey parameters to minimize the annoyance in long term use of postgrey:
–auto-whitelist-clients=1 (whitelist host after first successful delivery. Default = 5)
–max-age=365 (number of days the whitelist senders are kept. Default = 35)

Sorry to ask you this. I know it’s not in your goal to make it configurable.

I had this same desire myself and I made a small edit to fix it to work as I want.

The change will likely be overwritten the next time the postgrey package is updated, but you can hack it by editing /usr/sbin/postgrey and making the following edits at approximately line 338. You need to add the code shown between the # greylist modifications begin/end lines:

sub smtpd_access_policy($$)
{
    my ($self, $now, $attr) = @_;
    my $db  = $self->{postgrey}{db};
    # This attribute occurs in connections from the policy-test script,
    # not in a regular postfix query connection
    if(defined $attr->{policy_test_time}) { $now = $attr->{policy_test_time} }

    # greylist modifications begin 2014-05-25
    if (lc $attr->{recipient} ne 'user1@mydomain.com' &&
        lc $attr->{recipient} ne 'user2@mydomain.com') {

        $self->mylog_action($attr, 'pass', 'non-targeted greylisting user');
        return 'DUNNO';
    }
    # greylist modifications end 2014-05-25

    # whitelists
    for my $w (@{$self->{postgrey}{whitelist_clients}}) {
        if($attr->{client_name} =~ $w) {
            $self->mylog_action($attr, 'pass', 'client whitelist');

    [...]

In specific, this disables greylisting for everyone except the named users. This means that user1@mydomain.com and user2@mydomain.com will still have their mail greylisted, but everyone else will have their mail delivered immediately without greylisting.

(I first tried to do this with regexes in the whitelist_recipients file, but I could never get the “not” syntax to work, so I gave up and just edited the postgrey script instead.)

I can confirm that the regular expression /.*/ works. I am now receiving spam again :frowning:

+1 here

Just don’t forget to restart postgrey and postfix after:

service postgrey restart
service postfix restart

Editing /etc/postgrey/whitelist_clients works fine until the system cron scripts download a new whitelist_clients and any local changes are whipped out. Is there a better place to add local white_list clients? I second adding an option to disable grey listing.

@phildar This is exactly what /etc/postgrey/whitelist_clients.local is for. Just create a new file and put your regex in, it will stay there forever.

Until MiaB is upgraded and overwrites the directory as the previous poster indicated.

@alento Not quite what the previous poster meant. Nonetheless, perhaps you will find some further reassurance here showing that .local file, or indeed the whole directory, is not overwritten on reinstall, update or during a cron check.