[Bug 1287604] [NEW] Enhancement: Sanity Check Subscribers MX Record

John Howe johnhowe at arashi.com
Tue Mar 4 09:43:11 CET 2014

Public bug reported:

Attempted to path mailman 2.1.17 with a simple MX record check on web-
based subscribers.

Running Debian 7.4
python                 2.7.3-4+deb7u1   
python-dns          2.3.6-1+deb7u1 

Python-dns installed to /usr/lib/python2.7/dist-packages/DNS

Attempted patches follow

dragon at quantum:/usr/local/mailman/Mailman/Cgi
$ diff subscribe.py subscribe.py.dns 
>     except Errors.MMBadEmailHostNotFoundError:
>         results = _("""\
> The email address you supplied is not valid. Host not found.""")
>     except Errors.MMBadEmailMXRecordNotFoundError:
>         results = _("""\
> The email address you supplied does not have a MX record.""")
>     except Errors.MMBadEmailUnknownDNSError:
>         results = _("""\
> The email address you supplied had some unknown DNS error.""")

dragon at quantum:/usr/local/mailman/Mailman
$ diff Utils.py Utils.py.dns 
> import DNS
>     # MX Record sanity checks
>     try:
>         mx_host - DNS.mxlookup(domain_parts)
>         if len(mx_host) < 1:
>             raise Errors.MMBadEmailMXRecordNotFoundError, s
>     except DNS.Base.ServerError:
>         raise Errors.MMBadEmailHostNotFoundError, s
>     except:
>         raise Errors.MMBadEmailUnknownDNSError, s

dragon at quantum:/usr/local/mailman/Mailman
$ diff Errors.py Errors.py.dns 
> class MMBadEmailHostNotFoundError(EmailAddressError):
>     """Email address domain name does not resolve to a known host."""
>     pass
> class MMBadEmailMXRecordNotFoundError(EmailAddressError):
>     """Email address domain name does not have a MX record."""
>     pass
> class MMBadEmailUnknownDNSError(EmailAddressError):
>     """Email address domain name had unknown DNS error."""
>     pass

When running said patches, mailman complained with:

admin(13907): [----- Mailman Version: 2.1.17 -----]
admin(13907): [----- Traceback ------]
admin(13907): Traceback (most recent call last):
admin(13907):   File "/usr/local/mailman-2.1.17/scripts/driver", line 102, in run_main
admin(13907):     pkg = __import__('Mailman.Cgi', globals(), locals(), [scriptname])
admin(13907):   File "/usr/local/mailman-2.1.17/Mailman/Cgi/confirm.py", line 27, in <module>
admin(13907):     from Mailman import MailList
admin(13907):   File "/usr/local/mailman-2.1.17/Mailman/MailList.py", line 45, in <module>
admin(13907):     from Mailman import Utils
admin(13907):   File "/usr/local/mailman-2.1.17/Mailman/Utils.py", line 41, in <module>
admin(13907):     import DNS
admin(13907): ImportError: No module named DNS
admin(13907): [----- Python Information -----]
admin(13907): sys.version     =   2.7.3 (default, Jan  2 2013, 13:56:14)
[GCC 4.7.2]
admin(13907): sys.executable  =   /usr/bin/python
admin(13907): sys.prefix      =   /usr
admin(13907): sys.exec_prefix =   /usr
admin(13907): sys.path        =   ['/usr/local/mailman-2.1.17/pythonlib', '/usr/local/mailman-2.1.17', '/usr/local/mailman-2.1.17/scripts', '/usr/local/mailman-2.1.17', '/usr/lib/python2.7/', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/lib/python2.7/site-packages']
admin(13907): sys.platform    =   linux2

AFAICS, it seems like Utils.py isn't locating the system wide python-dns

How do I modify the sys.path to include python-dns under


** Affects: mailman
     Importance: Undecided
         Status: New

You received this bug notification because you are a member of Mailman
Coders, which is subscribed to GNU Mailman.

  Enhancement: Sanity Check Subscribers MX Record

To manage notifications about this bug go to:

More information about the Mailman-coders mailing list