1

Topic: Error running spf_to_greylist_whitelists.py

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

When I try to add teamviewer.com to whitelist via spf_to_greylist_whitelists.py directly via
python spf_to_greylist_whitelists.py teamviewer.com or thru record in MySQL database I encounter this error

root@mail:~# python /opt/iredapd/tools/spf_to_greylist_whitelists.py teamviewer.com
* Parsing domains, 1 in total.
        + [teamviewer.com]
Traceback (most recent call last):
  File "/opt/iredapd/tools/spf_to_greylist_whitelists.py", line 325, in <module>
    qr = parse_spf(domain, spf, queried_domains=queried_domains, returned_ips=returned_ips)
  File "/opt/iredapd/tools/spf_to_greylist_whitelists.py", line 243, in parse_spf
    returned_ips=returned_ips)
  File "/opt/iredapd/tools/spf_to_greylist_whitelists.py", line 176, in query_spf_of_included_domains
    qr = parse_spf(domain, spf, queried_domains=queried_domains, returned_ips=returned_ips)
  File "/opt/iredapd/tools/spf_to_greylist_whitelists.py", line 243, in parse_spf
    returned_ips=returned_ips)
  File "/opt/iredapd/tools/spf_to_greylist_whitelists.py", line 176, in query_spf_of_included_domains
    qr = parse_spf(domain, spf, queried_domains=queried_domains, returned_ips=returned_ips)
  File "/opt/iredapd/tools/spf_to_greylist_whitelists.py", line 243, in parse_spf
    returned_ips=returned_ips)
  File "/opt/iredapd/tools/spf_to_greylist_whitelists.py", line 178, in query_spf_of_included_domains
    ips_spf = qr['ips']
TypeError: 'set' object has no attribute '__getitem__'


Has anyone had this issue before?

----

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

2

Re: Error running spf_to_greylist_whitelists.py

Could you please show me output of command below:

ls -l /opt/

This error is caused by a bug of old iRedAPD release, but it has been fixed in the latest iRedAPD-1.8.0.

3

Re: Error running spf_to_greylist_whitelists.py

Here is my /opt

root@mail:~# ls -l /opt/
total 8
dr-xr-xr-x 6 iredapd iredapd 4096 May  7  2015 iRedAPD-1.4.4
dr-x------ 7 root    root    4096 Mar 30 16:06 iRedAPD-1.8.0
lrwxrwxrwx 1 root    root      13 Mar 30 12:48 iredapd -> iRedAPD-1.8.0

4

Re: Error running spf_to_greylist_whitelists.py

Please try patch below and restart iRedAPD service:

diff -r c1870a0e739e -r bb86e9228601 tools/spf_to_greylist_whitelists.py
--- a/tools/spf_to_greylist_whitelists.py    Fri Feb 05 23:24:31 2016 +0900
+++ b/tools/spf_to_greylist_whitelists.py    Wed Feb 10 12:05:13 2016 +0800
@@ -212,7 +182,9 @@
                 'returned_ips': returned_ips}
 
     if not spf:
-        return ips
+        return {'ips': ips,
+                'queried_domains': queried_domains,
+                'returned_ips': returned_ips}
 
     tags = spf.split()

This patch was commited on Feb 10:
https://bitbucket.org/zhb/iredapd/commi … pyF212T182

5

Re: Error running spf_to_greylist_whitelists.py

My mistake, this patch was not fixed in iRedAPD-1.8.0.

6

Re: Error running spf_to_greylist_whitelists.py

Thnx for your reply. Everything worked like a charm.