1

Topic: Latest iredapd and greylisting

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.3
- Linux/BSD distribution name and version: Centos 6.7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Apache
- Manage mail accounts with iRedAdmin-Pro? Yes
- Related log if you're reporting an issue:
====

Hi Guys, i have a bt of an issue, on the old iRedadmin Pro if i enabled greylisting globally it you could turn it off for some domains, now after the upgrade and i have migrated to iRedAPD if i turn on greylisting under global, even if i turn it off on the domain setting its still greylisting that domain, likewise if i disable greylisting in the global section and turn it on per domain it still doesnt work ? i have a few domains that i would like it on, and some off

Thanks
Animatrix

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Latest iredapd and greylisting

Could you please show us the SQL records of greylisting settings:

sql> USE iredapd;
sql> SELECT * FROM greylisting WHERE account IN ('@.', '@[YOUR_DOMAIN]') AND sender='@.';

Please replace "[YOUR_DOMAIN]" by the real domain name which you already disabled greylisting. Note: there's a '@' before domain name.

3

Re: Latest iredapd and greylisting

ZhangHuangbin wrote:

Could you please show us the SQL records of greylisting settings:

sql> USE iredapd;
sql> SELECT * FROM greylisting WHERE account IN ('@.', '@[YOUR_DOMAIN') AND sender='@.';

Please replace "[YOUR_DOMAIN]" by the real domain name which you already disabled greylisting. Note: there's a '@' before domain name.


HI, so below is the result of the command you asked me to make,

i did SELECT * FROM greylisting WHERE account IN ('@.', '@pacomms.co.uk AND sender='@.';

the result was

id          account                 priority         sender  sender_priority      comment  active

31          @.                            0                  @.              0                                      0
29          @pacomms.co.uk      0                  @.              0                                      0

I have the global setting as off and off on the domain, if i enable on global it greylists every domain regardless of what is set under the actual domains setting, if i disable it on the globvbal setting it is deisabled full stop, again regardless of whats set on the domains setting, on the old system i could turn on and off per domain, thats what im after agin

Thanks
Animatrix

4

Re: Latest iredapd and greylisting

The SQL records are not correct. Per-domain greylisting setting (id=29) must have higher priority (column: priority), and it should be set to 60 by default.

It must be an iRedAdmin-Pro bug, i will try to reproduce this and come back with a fix.
Thanks for the feedback, and sorry about this trouble.

5

Re: Latest iredapd and greylisting

Confirmed, and here's patch to fix it. sorry about this trouble.

diff -r 99fba338ed8d libs/iredapd/greylist.py
--- a/libs/iredapd/greylist.py    Fri Dec 18 22:58:45 2015 +0800
+++ b/libs/iredapd/greylist.py    Fri Dec 18 23:18:12 2015 +0800
@@ -76,7 +76,8 @@
 
     def enable_disable_greylist_setting(self, account, enable=False):
         """Update (or create) greylisting setting of specified account."""
-        if not iredutils.is_valid_amavisd_address(account):
+        account_type = iredutils.is_valid_amavisd_address(account)
+        if not account_type:
             return (False, 'INVALID_ACCOUNT')
 
         active = 0
@@ -84,7 +85,7 @@
             active = 1
 
         gl_setting = {'account': account,
-                      'priority': iredutils.IREDAPD_ACCOUNT_PRIORITIES.get(account, 0),
+                      'priority': iredutils.IREDAPD_ACCOUNT_PRIORITIES.get(account_type, 0),
                       'sender': '@.',
                       'sender_priority': 0,
                       'active': active}

6

Re: Latest iredapd and greylisting

ZhangHuangbin wrote:

Confirmed, and here's patch to fix it. sorry about this trouble.

diff -r 99fba338ed8d libs/iredapd/greylist.py
--- a/libs/iredapd/greylist.py    Fri Dec 18 22:58:45 2015 +0800
+++ b/libs/iredapd/greylist.py    Fri Dec 18 23:18:12 2015 +0800
@@ -76,7 +76,8 @@
 
     def enable_disable_greylist_setting(self, account, enable=False):
         """Update (or create) greylisting setting of specified account."""
-        if not iredutils.is_valid_amavisd_address(account):
+        account_type = iredutils.is_valid_amavisd_address(account)
+        if not account_type:
             return (False, 'INVALID_ACCOUNT')
 
         active = 0
@@ -84,7 +85,7 @@
             active = 1
 
         gl_setting = {'account': account,
-                      'priority': iredutils.IREDAPD_ACCOUNT_PRIORITIES.get(account, 0),
+                      'priority': iredutils.IREDAPD_ACCOUNT_PRIORITIES.get(account_type, 0),
                       'sender': '@.',
                       'sender_priority': 0,
                       'active': active}

Hi mate sorry I am not a Linux guru how do i use that patch ? What d I need to do to apply the fix

Thanks
Animatrix

7

Re: Latest iredapd and greylisting

I tried applying this patch and I get internal server errors after restarting uwsgi and iredapd. I've reverted back in the mean time.

8

Re: Latest iredapd and greylisting

Hi Zhang, can you please tell me how to apply this patch ? ie what command and how its done line by line, im not a linux guru so please make the explain simple

Thanks
A

9

Re: Latest iredapd and greylisting

rafaelr wrote:

I tried applying this patch and I get internal server errors after restarting uwsgi and iredapd. I've reverted back in the mean time.

This is patch for iRedAdmin-Pro, not for iRedAPD. So just restart Apache or uwsgi (if you're running Nginx) service, no need to restart iRedAPD service.

Animatrix wrote:

Hi Zhang, can you please tell me how to apply this patch ? ie what command and how its done line by line, im not a linux guru so please make the explain simple

Sorry about this confusion.

*) Upload attached patch to your iRedMail server, assume it's /tmp/greylist.patch.
*) Go to iRedAdmin-Pro directory, we take '/var/www/iredadmin' for example. Verify the patch before applying it:

# cd /var/www/iredadmin/
# patch --dry-run -p1 < /tmp/greylist.patch
Patching file libs/iredapd/greylist.py

If no error on terminal, it's ok to apply it by removing '--dry-run' option:

# patch -p1 < /tmp/greylist.patch

Then restart Apache or uwsgi (if you're running Nginx) service to load modified files. That's it.