mail-in-a-box / mailinabox

Mail-in-a-Box helps individuals take back control of their email by defining a one-click, easy-to-deploy SMTP+everything else server: a mail server in a box.
https://mailinabox.email/
Creative Commons Zero v1.0 Universal
14.03k stars 1.44k forks source link

IndexError: list index out of range #1011

Closed chris13524 closed 3 years ago

chris13524 commented 7 years ago

When I go to the status page, I get the "something went wrong exception". When I run the script manually (management/status_checks.py), I get the following output:

root@box:~# /root/mailinabox/management/status_checks.py

System
======
✓  All system services are running.
✓  SSH disallows password-based login.
✓  System software is up to date.
✓  Mail-in-a-Box is up to date. You are running version v0.20.
✖  You must add a mail alias for administrator@box.neonorb.com which directs email to you or another administrator.
✓  The disk has 11.7 GB space remaining.
✓  System memory is 39% free.

Network
=======
✓  Outbound mail (SMTP port 25) is not blocked.
✓  IP address is not blacklisted by zen.spamhaus.org.
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/lib/python3.4/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "/usr/lib/python3.4/multiprocessing/pool.py", line 47, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
  File "/root/mailinabox/management/status_checks.py", line 315, in run_domain_checks_on_domain
    check_mail_domain(domain, env, output)
  File "/root/mailinabox/management/status_checks.py", line 577, in check_mail_domain
    mxhost = mx.split('; ')[0].split(' ')[1]
IndexError: list index out of range
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/mailinabox/management/status_checks.py", line 944, in <module>
    run_checks(False, env, ConsoleOutput(), pool)
  File "/root/mailinabox/management/status_checks.py", line 42, in run_checks
    run_domain_checks(rounded_values, env, output, pool)
  File "/root/mailinabox/management/status_checks.py", line 288, in run_domain_checks
    ret = pool.starmap(run_domain_checks_on_domain, args, chunksize=1)
  File "/usr/lib/python3.4/multiprocessing/pool.py", line 268, in starmap
    return self._map_async(func, iterable, starmapstar, chunksize).get()
  File "/usr/lib/python3.4/multiprocessing/pool.py", line 599, in get
    raise self._value
IndexError: list index out of range
solracsf commented 7 years ago

Can you try 0.21 (master branch): https://github.com/mail-in-a-box/mailinabox/tree/master

chris13524 commented 7 years ago

@acs-ferreira I'm unable to reproduce the issue now.

solracsf commented 7 years ago

On witch branch/tag? 0.20 or 0.21?

chris13524 commented 7 years ago

This issue was happening when I was using this code: #743

I reverted back to the regular, since then. After @acs-ferreira 's update, I tested the push request code again, but was unable to reproduce it.

chris13524 commented 7 years ago

@acs-ferreira 0.20, I haven't updated yet.

JoshData commented 7 years ago

Closing because it's been a while. Feel free to re-open.

misterfinster commented 5 years ago

I realise this is an old issue but I get the same error and I'm currently trying to figure out which of my domains pointed at my MIAB is causing this:

System
======
✓  All system services are running.
✓  SSH disallows password-based login.
✓  System software is up to date.
✓  Mail-in-a-Box is up to date. You are running version v0.41.
✓  System administrator address exists as a mail alias. [administrator@xxxx.xxxx.com ↦ xxxx@xxxx.com]
✓  The disk has 47.57 GB space remaining.
✓  System memory is 87% free.

Network
=======
✓  Firewall is active.
✓  Outbound mail (SMTP port 25) is not blocked.
✓  IP address is not blacklisted by zen.spamhaus.org.
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 47, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
  File "./status_checks.py", line 346, in run_domain_checks_on_domain
    check_dns_zone(domain, env, output, dns_zonefiles)
  File "./status_checks.py", line 450, in check_dns_zone
    check_dnssec(domain, env, output, dns_zonefiles)
  File "./status_checks.py", line 526, in check_dnssec
    ds_keytag, ds_alg, ds_digalg, ds_digest = rr_ds.split("\t")[4].split(" ")
IndexError: list index out of range
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "./status_checks.py", line 974, in <module>
    run_checks(False, env, ConsoleOutput(), pool)
  File "./status_checks.py", line 64, in run_checks
    run_domain_checks(rounded_values, env, output, pool)
  File "./status_checks.py", line 322, in run_domain_checks
    ret = pool.starmap(run_domain_checks_on_domain, args, chunksize=1)
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 274, in starmap
    return self._map_async(func, iterable, starmapstar, chunksize).get()
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 644, in get
    raise self._value
IndexError: list index out of range
chr-1x commented 4 years ago

I'd like to request this issue be reopened since I just experienced the same thing in MIAB 0.46. The actual root cause appears to be a failure in DNS resolution (in my case caused by a DNS misconfiguration) which causes query_dns to return "[timeout]" instead of an MX record. The correct behavior in this case should be to report the name resolution failure instead of unconditionally attempting to parse the result of query_dns as an MX record (mx.split('; ')[0].split(' ')[1]).

(As it happens, my misconfiguration was NS glue records pointing to the wrong IP, I think the status checks may already check this but if not, they definitely should.)

JoshData commented 4 years ago

Thanks. I haven't looked at the code, but it sounds like a fix should be easy then.

phreditor commented 4 years ago

I'm having similar on new install of MIAB 0.46 on Ubuntu 18.04.3 LTS. It's in a slightly different spot in the code, so I'm not sure if it should be entered as a different issue:

System
======
✓  All system services are running.
✓  SSH disallows password-based login.
✓  System software is up to date.
?  You are running version Mail-in-a-Box v0.46. Mail-in-a-Box version check disabled by privacy setting.
✓  System administrator address exists as a mail alias. [administrator@box.genericmail.net ↦ setup@genericmail.net]
✓  The disk has 20.30 GB space remaining.
✓  System memory is 38% free.

Network
=======
✓  Firewall is active.
✓  Outbound mail (SMTP port 25) is not blocked.
✖  The IP address of this machine 206.189.198.150 is listed in the Spamhaus Block List (code 127.0.0.4), which may prevent recipients from receiving
   your email. See http://www.spamhaus.org/query/ip/206.189.198.150.
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 47, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
  File "./status_checks.py", line 349, in run_domain_checks_on_domain
    check_mail_domain(domain, env, output)
  File "./status_checks.py", line 587, in check_mail_domain
    mxhost = mx.split('; ')[0].split(' ')[1]
IndexError: list index out of range
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "./status_checks.py", line 976, in <module>
    run_checks(False, env, ConsoleOutput(), pool)
  File "./status_checks.py", line 64, in run_checks
    run_domain_checks(rounded_values, env, output, pool)
  File "./status_checks.py", line 322, in run_domain_checks
    ret = pool.starmap(run_domain_checks_on_domain, args, chunksize=1)
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 274, in starmap
    return self._map_async(func, iterable, starmapstar, chunksize).get()
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 644, in get
    raise self._value
IndexError: list index out of range
Hoptrics commented 4 years ago

Can we please get a fix on this? All my servers are throwing this, causing status page to break.

multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/usr/lib/python3.6/multiprocessing/pool.py", line 119, in worker result = (True, func(*args, **kwds)) File "/usr/lib/python3.6/multiprocessing/pool.py", line 47, in starmapstar return list(itertools.starmap(args[0], args[1])) File "./status_checks.py", line 349, in run_domain_checks_on_domain check_mail_domain(domain, env, output) File "./status_checks.py", line 587, in check_mail_domain mxhost = mx.split('; ')[0].split(' ')[1] IndexError: list index out of range """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "./status_checks.py", line 976, in run_checks(False, env, ConsoleOutput(), pool) File "./status_checks.py", line 64, in run_checks run_domain_checks(rounded_values, env, output, pool) File "./status_checks.py", line 322, in run_domain_checks ret = pool.starmap(run_domain_checks_on_domain, args, chunksize=1) File "/usr/lib/python3.6/multiprocessing/pool.py", line 274, in starmap return self._map_async(func, iterable, starmapstar, chunksize).get() File "/usr/lib/python3.6/multiprocessing/pool.py", line 644, in get raise self._value IndexError: list index out of range

misterfinster commented 4 years ago

I still see this even in 0.48. I wonder if it is related to a script I run at home to update a DNS entry periodically (mini-dynDNS). In most cases, one or more of my zone files are corrupt or empty.

System
======
✓  All system services are running.
✓  SSH disallows password-based login.
✓  System software is up to date.
✓  Mail-in-a-Box is up to date. You are running version v0.48.
✓  System administrator address exists as a mail alias. [xxxxxxxxx@xxxxxxx]
✓  The disk has 1005.21 GB space remaining.
✓  System memory is 94% free.

Network
=======
✓  Firewall is active.
✓  Outbound mail (SMTP port 25) is not blocked.
✓  IP address is not blacklisted by zen.spamhaus.org.
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 47, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
  File "./status_checks.py", line 346, in run_domain_checks_on_domain
    check_dns_zone(domain, env, output, dns_zonefiles)
  File "./status_checks.py", line 450, in check_dns_zone
    check_dnssec(domain, env, output, dns_zonefiles)
  File "./status_checks.py", line 528, in check_dnssec
    ds_keytag, ds_alg, ds_digalg, ds_digest = rr_ds.split("\t")[4].split(" ")
IndexError: list index out of range
"""

    run_domain_checks(rounded_values, env, output, pool)
  File "./status_checks.py", line 322, in run_domain_checks
    ret = pool.starmap(run_domain_checks_on_domain, args, chunksize=1)
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 274, in starmap
    return self._map_async(func, iterable, starmapstar, chunksize).get()
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 644, in get
    raise self._value
IndexError: list index out of range
jmoudy commented 3 years ago

This error is occurring on my system when line 618 (V0.51) in status_check.py returns a [timeout]. mx = query_dns(domain, "MX", nxdomain=None)

before line 625 I print the returned value in mx and get mx = 0 box.gooddomain.com mx = 10 box.gooddomain.com mx = 10 box.gooddomain.com mx = [timeout]

I'm not comfortable with python or I would add error checking around line 618 for the timeout.

dragonfire1119 commented 3 years ago

This is how I found out what was wrong. I let go of a domain and it does not have mx records anymore.

status_check.py:620

print(mx, domain)

Now it will show you which domain is timing out.

Once you find the domain that is timing out just archive the account.