1

Topic: Blacklists are not working

==== Required information ====
- iRedMail version: 0.9.0
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): mysql
- Web server (Apache or Nginx): apache
- Linux/BSD distribution name and version: debian 7
- Related log if you're reporting an issue:
====
I'm unable to get the blacklisted addresses blocked correctly through iredadmin.  I have this note : This feature requires iRedAPD plugin 'amavisd_wblist', please make sure it's enabled in file /opt/iredapd/settings.py but if I do check it is listed in there.

cat /opt/iredapd/settings.py | grep amavisd_wblis
plugins = ["sql_alias_access_policy", "sql_user_restrictions", "amavisd_wblist"]

Is something not configured correctly and that's why I get that message?

----

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

2

Re: Blacklists are not working

drsbaitso wrote:

plugins = ["sql_alias_access_policy", "sql_user_restrictions", "amavisd_wblist"]

It's better to perform wblist check before other 'sql_*' plugins:

plugins = ["amavisd_wblist", "sql_alias_access_policy", "sql_user_restrictions"]

Could you please turn on debug mode in iRedAPD, then test again and paste log in /var/log/iredapd.log to help troubleshoot?
Reference: http://www.iredmail.org/docs/debug.iredapd.html

3

Re: Blacklists are not working

2015-04-09 11:02:08 DEBUG Connect from 127.0.0.1, port 37166.
2015-04-09 11:02:08 DEBUG smtp session: request=smtpd_access_policy
2015-04-09 11:02:08 DEBUG smtp session: protocol_state=RCPT
2015-04-09 11:02:08 DEBUG smtp session: protocol_name=ESMTP
2015-04-09 11:02:08 DEBUG smtp session: client_address=204.13.202.190
2015-04-09 11:02:08 DEBUG smtp session: client_name=seg-node-elk-03.trustwave.com
2015-04-09 11:02:08 DEBUG smtp session: reverse_client_name=seg-node-elk-03.trustwave.com
2015-04-09 11:02:08 DEBUG smtp session: helo_name=seg-node-elk-03.trustwave.com
2015-04-09 11:02:08 DEBUG smtp session: sender=sender@foo.bar
2015-04-09 11:02:08 DEBUG smtp session: recipient=rec@foo.bar
2015-04-09 11:02:08 DEBUG smtp session: recipient_count=0
2015-04-09 11:02:08 DEBUG smtp session: queue_id=
2015-04-09 11:02:08 DEBUG smtp session: instance=39c0.5526a280.aee90.0
2015-04-09 11:02:08 DEBUG smtp session: size=5451
2015-04-09 11:02:08 DEBUG smtp session: etrn_domain=
2015-04-09 11:02:08 DEBUG smtp session: stress=
2015-04-09 11:02:08 DEBUG smtp session: sasl_method=
2015-04-09 11:02:08 DEBUG smtp session: sasl_username=
2015-04-09 11:02:08 DEBUG smtp session: sasl_sender=
2015-04-09 11:02:08 DEBUG smtp session: ccert_subject=
2015-04-09 11:02:08 DEBUG smtp session: ccert_issuer=
2015-04-09 11:02:08 DEBUG smtp session: ccert_fingerprint=
2015-04-09 11:02:08 DEBUG smtp session: ccert_pubkey_fingerprint=
2015-04-09 11:02:08 DEBUG smtp session: encryption_protocol=TLSv1.2
2015-04-09 11:02:08 DEBUG smtp session: encryption_cipher=ECDHE-RSA-AES256-GCM-SHA384
2015-04-09 11:02:08 DEBUG smtp session: encryption_keysize=256
2015-04-09 11:02:08 DEBUG Creating Amavisd database connection.
2015-04-09 11:02:08 DEBUG Error while creating Amavisd database connection: 'module' object has no attribute 'amavisd_db_server'
2015-04-09 11:02:08 DEBUG Skip plugin, error while getting db cursor: AmavisdDBWrap instance has no attribute 'cursor'
2015-04-09 11:02:08 DEBUG --> Apply plugin: sql_alias_access_policy
2015-04-09 11:02:08 DEBUG SQL: query access policy: SELECT accesspolicy, goto, moderators
            FROM alias
            WHERE
                address='rec@foo.bar'
                AND address <> goto
                AND active=1
            LIMIT 1

2015-04-09 11:02:08 DEBUG SQL: record: None
2015-04-09 11:02:08 DEBUG <-- Result: DUNNO (Not mail alias)
2015-04-09 11:02:08 DEBUG --> Apply plugin: sql_user_restrictions
2015-04-09 11:02:08 DEBUG SQL to get restriction rules of sender (sender@foo.bar):
        SELECT
            allowedrecipients, rejectedrecipients,
            allowedsenders, rejectedsenders
        FROM mailbox
        WHERE username='sender@foo.bar'
        LIMIT 1

2015-04-09 11:02:08 DEBUG <!> Error: (1054, "Unknown column 'allowedrecipients' in 'field list'")
2015-04-09 11:02:08 DEBUG Error while closing Amavisd database connection: AmavisdDBWrap instance has no attribute 'cursor'
2015-04-09 11:02:08 INFO [204.13.202.190] sender@foo.bar -> rec@foo.bar, DUNNO
2015-04-09 11:02:08 DEBUG Session ended
2015-04-09 11:02:08 DEBUG Closed SQL connection.
2015-04-09 11:02:09 DEBUG smtp session: request=smtpd_access_policy
2015-04-09 11:02:09 DEBUG smtp session: protocol_state=END-OF-MESSAGE
2015-04-09 11:02:09 DEBUG smtp session: protocol_name=ESMTP
2015-04-09 11:02:09 DEBUG smtp session: client_address=204.13.202.190
2015-04-09 11:02:09 DEBUG smtp session: client_name=seg-node-elk-03.trustwave.com
2015-04-09 11:02:09 DEBUG smtp session: reverse_client_name=seg-node-elk-03.trustwave.com
2015-04-09 11:02:09 DEBUG smtp session: helo_name=seg-node-elk-03.trustwave.com
2015-04-09 11:02:09 DEBUG smtp session: sender=sender@foo.bar
2015-04-09 11:02:09 DEBUG smtp session: recipient=rec@foo.bar
2015-04-09 11:02:09 DEBUG smtp session: recipient_count=1
2015-04-09 11:02:09 DEBUG smtp session: queue_id=167EE80382
2015-04-09 11:02:09 DEBUG smtp session: instance=39c0.5526a280.aee90.0
2015-04-09 11:02:09 DEBUG smtp session: size=5451
2015-04-09 11:02:09 DEBUG smtp session: etrn_domain=
2015-04-09 11:02:09 DEBUG smtp session: stress=
2015-04-09 11:02:09 DEBUG smtp session: sasl_method=
2015-04-09 11:02:09 DEBUG smtp session: sasl_username=
2015-04-09 11:02:09 DEBUG smtp session: sasl_sender=
2015-04-09 11:02:09 DEBUG smtp session: ccert_subject=
2015-04-09 11:02:09 DEBUG smtp session: ccert_issuer=
2015-04-09 11:02:09 DEBUG smtp session: ccert_fingerprint=
2015-04-09 11:02:09 DEBUG smtp session: ccert_pubkey_fingerprint=
2015-04-09 11:02:09 DEBUG smtp session: encryption_protocol=TLSv1.2
2015-04-09 11:02:09 DEBUG smtp session: encryption_cipher=ECDHE-RSA-AES256-GCM-SHA384
2015-04-09 11:02:09 DEBUG smtp session: encryption_keysize=256
2015-04-09 11:02:09 DEBUG Skip plugin: amavisd_wblist (protocol_state != END-OF-MESSAGE)
2015-04-09 11:02:09 DEBUG Skip plugin: sql_alias_access_policy (protocol_state != END-OF-MESSAGE)
2015-04-09 11:02:09 DEBUG Skip plugin: sql_user_restrictions (protocol_state != END-OF-MESSAGE)
2015-04-09 11:02:09 INFO [204.13.202.190] sender@foo.bar -> rec@foo.bar, DUNNO
2015-04-09 11:02:09 DEBUG Session ended
2015-04-09 11:02:09 DEBUG Closed SQL connection.

I assume this part is the key, but not sure what's missing.

 "Unknown column 'allowedrecipients' in 'field list'"

4

Re: Blacklists are not working

drsbaitso wrote:

2015-04-09 11:02:08 DEBUG Skip plugin, error while getting db cursor: AmavisdDBWrap instance has no attribute 'cursor'

This is the problem, you don't have settings in /opt/iredapd/settings.py used to connect to Amavisd database:

# For Amavisd policy lookup
amavisd_db_server = '127.0.0.1'
amavisd_db_port = '3306'
amavisd_db_name = 'amavisd'
amavisd_db_user = 'amavisd'
amavisd_db_password = 'password'

5

Re: Blacklists are not working

That did the trick.

Thanks.