OS X Mountain Lion Mailman Mailing List

July 30th, 2012 | Posted by admin in Blog - (Comments Off on OS X Mountain Lion Mailman Mailing List)

As part of the OS X Mountain Lion Server upgrade, Apple has removed the Mailman mailing list manager entirely. In order to get this running again you can use the following instructions. Hopefully this will help others.

You will notice that as part of the upgrade from Lion Server you you will have Migrated folder on your server under /Library/Server/Migrated. This will contain any of your old lists from Mailman which we will use later.

Step 1 – Install Command Line Tools

Before you can get started you need to have the right infrastructure in place on Mountain Lion. Make sure you install the latest Xcode (4.4 as of this writing). Once installed you will need to open Xcode and open choose Preferences. Now install the Xcode command line tools. This is needed in order to build Mailman from the source.

Xcode command line tools

Step 2 – Install Mailman

Now we have the infrastructure necessary download the Mailman source from:

Mailman Source 2.1.15 (June 2012)

Now open the terminal and login as root. Run the following commands:

mkdir /usr/local/mailman
cd /usr/local/mailman
chgrp mailman .
chmod a+rx,g+ws .

[colored_box variation=”slategrey”]
A note about these commands. By default Mountain Lion will have a _mailman user in the system already and so it will map the mailman user we used above to the _mailman user which is fine.
[/colored_box]

Now we can build the source. Make sure the source is available on the server and change into that directory from the terminal. By default this will install into the /usr/local/mailman directory we created above.

cd mailman-<version>
./configure
make install

Next validate the the installation by changing into the mailman directory and checking permissions:

cd /usr/local/mailman
bin/check_perms -f

Step 3 – Modify Web Server Settings

Since Mountain Lion has removed the support for Mailman we need to create our own mailman settings and make sure the Server App is restarted to pick them up. At the end of this step you will have Mailman accessible again from the Web Server. So the first step is to ensure your web server is turned on using the Server App.

Now we need to create a new file of specific Mailman settings for the built-in Apache server. Cut and paste the following settings into a new file and save it as httpd-mailman.conf.

# Config file for linking the mailman mailing list manager to MacOSX Server Web Server.
#

ScriptAlias /mailman/ "/usr/local/mailman/cgi-bin/"
Alias /pipermail/ "/usr/local/mailman/archives/public/"
Alias /icons/ "/usr/local/mailman/icons/"
<Directory "/usr/local/mailman/archives/public/">
	Options FollowSymLinks MultiViews Indexes
	AllowOverride None
	Order allow,deny
	Allow from all
</Directory>

Now copy this file to your server and place it in the desired location. I used the apache2/extra folder, but you can equally use the apache2/other location as well, as long as your Include refers to the correct file.

/private/etc/apache2/extra/httpd-mailman.conf

Next we need to make sure the Web Server loads this file. This is controlled by the Apache settings at /Library/Server/Web/Config/apache2/httpd_server_app.conf. Edit this file and add the following line near the end of the file just above the comment for SSL/TLS connections.

Include /private/etc/apache2/extra/httpd-mailman.conf

Now restart your Web Server using the Server App. After it has restarted you should be able to access the following URL:

http://myserver.com/mailman/listinfo

You can now proceeed to Step 4.

Step 4 – Configure Mailman

Next we need to comfigure Mailman correctly to connect to our Mountain Lion Mail Server. Edit /usr/local/mailman/Mailman/mm_cfg.py

Add the following to the end of the file:

MTA = 'Postfix'

Other settings on Mountain Lion Server should be correct already. So next we need to initialize the aliases file for mailman as follows:

cd /usr/local/mailman
bin/genaliases
chown mailman:mailman data/aliases*
chmod g+w data/aliases*

Now we need to change out Postfix settings on the Mountain Lion Server to hook into Mailman correctly. Edit /Library/Server/Mail/Config/postfix/main.cf as follows to add the correct alias_maps path to Mailman. If you are upgrading from Lion or earlier you will see an old entry which will point to the now non existant mailman server.

alias_maps = hash:/etc/aliases,hash:/usr/local/mailman/data/aliases

Now you can restart your mail server using the Server App and Mailman should be connected to your server.

Step 5 – Setup Mailing Lists

Set the Mailman site password:

/usr/local/mailman/bin/mmsitepass xxxx

Create a new mailing list:

bin/newlist mailman
# apply the default template
bin/config_list -i data/sitelist.cfg mailman

Mailman depends on a process called the “qrunner” to delivery all email messages it sees. You must start the qrunner by executing the following command from the /usr/local/mailman directory:

bin/mailmanctl start

Now we need to make sure this starts and stops everytime the server does. We can do this by creating a Launch Daemon. We can save this as org.list.mailmanctl.plist and place it in /System/Library/LaunchDaemons/

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Debug</key>
  	<true/>
	<key>Disabled</key>
	<false/>
	<key>Label</key>
	<string>org.list.mailmanctl</string>
	<key>Program</key>
	<string>/usr/local/mailman/bin/mailmanctl</string>
	<key>ProgramArguments</key>
	<array>
		<string>mailmanctl</string>
		<string>-s</string>
		<string>start</string>
	</array>
	<key>KeepAlive</key>
	<false/>
	<key>RunAtLoad</key>
	<true/>
	<key>AbandonProcessGroup</key>
	<true/>
</dict>
</plist>

Now this will run everytime the server starts up.

Step 6 – Migrating from Lion Server

If you have Lists created under Lion Server you will need to migrate these to your new installation of Mailman. You will notice that Mountain Lion created a new folder on on your server called /Library/Server/Migrated. Within that you should have a folder called private/var/mailman/lists.

Now we can extract the users from each of these old lists. We can just cut and paste the following on the command line in each of your mailing list directories where there is a config.pck file. This will printout each member on a new line and you can just cut and paste this as needed after creating your new list name.

ln -s /usr/local/mailman/bin/paths.py
python
import paths
import Mailman, pickle
configFile = open('config.pck')
config = pickle.load(configFile)
config['created_at']
members = config['members'].keys()
members.sort()
print '\n'.join(members)

Once you have the users you can just create the new list of the same name using:

bin/newlist example

Now you can test your lists are working by posting a test message to the list. That should be all you need to do. You now have a fully working Mailman List server running on your new Mountain Lion Server.