Having installed Yunohost, time has come to move my Mailman hosting from the main host to the Yunohost LXC. Why would I do that? Because, in no particular order:

  • Mailman 2 is now deprecated in Debian
  • Mailman 3 on Debian caused problems (first, with an indexing process that runs for 2 minutes every 5 minutes. Then, with another issue I forgot about. Then, with a migration path that looked too hard to care for).
  • Hopefully people at Yunohost will handle whatever security followup, migration plans, whatever, is required.

I only have one mailing list, for sslh. Unfortunately, I did not follow the best practice of hosting that on a specific virtual host, so the move won’t be transparent to users.

So the ‘before’ status is:

  • I have a Yunohost installed in a LXC, running Mailman
  • A DNS entry to lists.rutschle.net points to my single public IP address
  • /etc/hosts points lists.rutschle.net to the Yunohost local IP address (192.168.something). This makes host names point to the right address regardless of where we use them.
  • Exim is running on the host (just because it is Debian’s default, and I never felt the need to change)

First we tell Exim on the host to accept incoming e-mail for the Yunohost domain. This is done by dpkg-reconfigure exim4-config, and adding the Yunohost domain to the ‘local domains’ (and not the ‘domains to relay mail for’: these are handled specifically by Exim, and the following routing rule won’t work).

Then we configure Exim on the host to forward e-mail for the Yunohost domains towards the Yunohost LXC. This is done by adding a manual router to Exim’s configuration, e.g.:

# echo > /etc/exim4/conf.d/50_local-yunohost

yunohost:
        driver = manualroute
        domains = lists.rutschle.net
        transport = remote_smtp
        route_list = * 192.168.122.10

# update-exim4.conf

Sadly my usual hack of setting the LXC’s local IP in /etc/hosts does not work: I guess Exim resolves names using DNS directly instead of using resolv.conf: this makes it necessay to use the LXC’s IP address in route_list.

(I guessed that Exim configuration files are named something like order_package_name, but that’s just a guess).

Send an e-mail to mailman@lists.rutschle.net. Notice in the logs how Exim deftly forwards it to the LXC. Awe at Mailman’s response.

Following these 3 easy steps broke the connection between Mailman and Postfix inside Yunohost, so I did it differently:

  • In Yunohost’s Mailman, create the list (sslh)
  • The Web interface should be accessible through Yunohost.
  • Copy the data files and archives:
cd /home/yunohost/.local/share/lxc/yunohost/rootfs/var/lib/mailman/lists/sslh
cp -r /var/lib/mailman/lists/sslh/* .
chown -R 296665:296665 *
chmod g+w *

cd /home/yunohost/.local/share/lxc/yunohost/rootfs/var/lib/mailman/archives
cp -r /var/lib/mailman/archives/* .
chmod -R g+w *
chown -R 29665:29665 *

(Obviously adapt the various parts to the user name, LXC name, and Mailman UID / www-data UID inside the LXC. And generally, check that rights match what’s in the original’s /var/lib/mailman).

Fix the list’s URL, and, bizarrely, give the archives to www-data (from inside the LXC):

# withlist -l -a -r fix_url sslh lists.rutschle.net
# chown -R www-data:list /var/lib/mailman/archives

It’s a good idea to check the permissions of the entire installation with Mailman’s check_perms.

Fun fact: Mailman archives are static files where most paths are relative, except the “More information on this list”, which for some reason is absolute and now points to the wrong URL.

Dura sed, sed lex (which I think means: “sed is hard to use, but sed rules.”)

# cd /var/lib/maildir/archives/private
# find . -name "*.html" -exec sed -i "s/http:\/\/rutschle/http:\/\/lists.rutschle/" {} \;
# find . -name "*.html" -exec sed -i "s/cgi-bin\///" {} \;

This leaves a few references to URLs that contain pipermail: I don’t know if these work, but I can’t seem to see any in the archives, so… That’ll do, donkey.

And this concludes about six months of faffing about and wondering what to do with this all.