Mailman chronicles

ok, so you know mailman? But how to fetch a subscribers list without using the admin interface?

Mailman does not use a database nor does it store a list’s subscribers in some plain text format. So how to start? I searched the mailman mailinglist archive and didn’t find a clue. I looked a bit at the code, but it’s hard to get started if you’re not into python. 😉
By searching the mailman dir I found a .pck file.. It’s a pickled file. 🙂 This seems to be the Python term for serialization. So I found a mailinglist in its pickled state which seemed to contain the subscribers. Mmm, okay, let’s download the mailman source and find the usages of the pickle library.. Got it! 🙂 So hooray, fire up that python eclipse plugin that I’ve been eager to try out on a real piece of code, open up those nice python references and let’s unpickle!

Ehrm.. wait a second.. Apparently, downloading the source code can reveal other interesting parts of mailman. Like, for example, a script that lists all subscribers? =)

Another lesson learned with open source projects: FIRST download the source, before you try to hack it in yourself 😉 Okay, looking at the mailman installation dir would have been sufficient too, but who likes to search some custom installed linux distro over some crappy remote connection? 😉

There is still one step to do: how to get that script’s output on a webpage? One could try cgi or php for example. I looked at how mailman does it, but I guess it uses some precompiled ‘trusted’ executables for that hooked up to apache. After writing a php script, I realised it wouldn’t run on a normal user account, d’oh 🙂
The problem is not the mailman script itself, but the mailman databases it tries to open. The pickled mailing lists are only readable for users in the mailman group. I didn’t want to open a security hole (everyone has already enough spam), so I set up a cron job which executes the mailman script and puts the output readable to the normal user. It is not as cool as having the actual data, but having it on a daily basis is sufficient.

2 thoughts on “Mailman chronicles

  1. “Apparently, downloading the source code can reveal other interesting parts of mailman. Like, for example, a script that lists all subscribers? =)”

    OMG, any more interesting hidden scripts in there? 😉

  2. well, they aren’t exactly hidden, but at least not very documented imho 😉 I have the impression almost everything you can do through the admin interface, can be done through the CLI. Since in most cases the web interface is much more user-friendly, I didn’t find any other interesting applications for the CLI commands 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *