Spent half a day trying to figure out Mailman mailing list under Virtualmin (control panel) and Centos 6.4 Apache server.
Problem one was turns out the Godaddy VPS Centos 6.4 repository (the one Godaddy recommends) I’m using has not updated the mailman script for YEARS. The Godaddy VPS server this domain is running on was running Mailman v2.1.12 from I think 2009 when Mailman v2.1.18 from May 2014 was available.
Should I Upgrade Mailman?
I didn’t NEED to upgrade per se (Mailman 2.1.12 works), but since old software tends to have more security vulnerabilities and less features than new versions, I always upgrade when I can.
Life is very easy with a server when you can type “yum update” in something like Putty (or in a control panel like Virtualmin click Update) and everything on the server updates like magic. This relies on the repository your server uses having staff who regularly compile the latest versions of server scripts etc… and package them for the operating systems they support.
Apparently Godaddy VPS servers or Virtualmin or even Centos 6.4 (not sure which: think Virtualmin since it’s bundled with Virtualmin so should be updated by Virtualmin?) hasn’t bothered checking Mailman for updates, or at least not this decade!
Manual Mailman Upgrade
Time for the dreaded manual server software update (I loath doing this). I say dreaded because your average server expert (I’m NO server expert, far, far from it) assumes when they say something like:
For the most part, upgrading Mailman entails installing the latest version over the existing version. Usually, you can unpack the new release, run ‘configure’ with the same options you used in your previous install, and then do a ‘make install’. However, there are some changes that may need to be taken care of manually.
We mere mortals don’t stare at the screen blankly wondering which set of magical Google searches will translate this to a recipe of how to actually achieve this apparent easy task!!! Or hope, even pray the right Google search will find a well laid out Mailman tutorial written by a human being rather than a computer programmer :-)
I got the above text from the upgrading file within the unzipped mailman-2.1.18-1.tgz file. Sounds easy hey :-)
Let’s Update Mailman
Took a while to figure out the actual steps.
Using something like Putty gain SSH access to the server.
Requires 6 commands (copying and pasting each line one by one basically in an SHH program like Putty):
wget http://ftp.gnu.org/gnu/mailman/mailman-2.1.18-1.tgz
tar xzf mailman-2.1.18-1.tgz
cd mailman-2.1.18-1
./configure ––prefix=/usr/lib/mailman ––with-var-prefix=/var/lib/mailman ––with-cgi-gid=apache ––with-mail-gid=nobody
make
make install
Note: Nothing is changed to your current version of Mailman until you run the last command “make install”.
Why the above basic Mailman update tutorial steps aren’t easy to find is beyond me, this is what each line does.
I did this in the /root/ directory, this means I logged into the server using an SHH program, entered the command:
CD /
This was to make sure I was in the lowest folder on the server (like going to C: on your PC), CD = Change Directory and the / means lowest one possible, followed by the command:
CD root
That put me in the directory /root/ where step 1 will download the file I’m going to use to upgrade mailman with. If the folder /root/ doesn’t exist you could make it after typing CD /. To make a directory use the commend:
mkdir root
Followed by the command CD root. Could do this in any folder really.
Step 1 : wget (go get) the archived latest Mailmain script from http://ftp.gnu.org/gnu/mailman/mailman-2.1.18-1.tgz. You should check http://ftp.gnu.org/gnu/mailman/ to find what is the latest tgz file and change if not mailman-2.1.18-1.tgz.
Step 2: Unzip (untar) the file you just uploaded to your server.
Step 3: Change Directory (CD) to where the folder was unzipped to
Server experts seem to forget WE either don’t know where the latest file is and how to get it on the server using wget. They tend to jump into step 4 below assuming we know how to find the relevant update file, upload it to the server (step 1) and unzip it (step 2).
For the server experts out there, when writing software tutorials remember there’s a lot of people who would like to use your software that don’t know about these basic tools and techniques. If you add a few extra lines of steps to take you ca make our lives so much easier.
Step 4: Now we configure Mailmain, here’s where it got tricky as I didn’t know what settings Virtualmin/Webmin module used when Mailman was first installed. After a little research and getting it wrong a few times figured out what options to set.
––prefix=/usr/lib/mailman is where Virtualmin installed Mailman main files.
––with-var-prefix=/var/lib/mailman is where Virtualmin installed the Mailman data files (I think).
––with-cgi-gid=apache is the user Virtualmin set Mailman to use.
––with-mail-gid=nobody had to add this after getting an error when posting messages to the list.
Ran step 4 half a dozen times before it worked correctly, each time figuring out something I’d missed/got wrong like the last line above was added to my last attempt which seems to be working correctly!
The above and more options are within the mailman-install.txt file in the unzipped tgz file under /docs/. By default Windows doesn’t have built in support for unzipping tgz files, you don’t need to even download this file to your PC, but if you do and want to extract it to get access to the documentation within I use 7-ZIP (it’s free) as it covers loads of archive types.
Here’s all the options from the mailman-install.txt file, I don’t know what they all do, been using Mailman about a day.
The following options allow you to customize your Mailman installation.
––prefix=dir
Standard GNU configure option which changes the base directory
that Mailman is installed into. By default $prefix is
/usr/local/mailman. This directory must already exist, and be
set up as described in 2.2.––exec-prefix=dir
Standard GNU configure option which lets you specify a different
installation directory for architecture dependent binaries.––with-var-prefix=dir
Store mutable data under dir instead of under the $prefix or
$exec_prefix. Examples of such data include the list archives
and list settings database.––with-python=/path/to/python
Specify an alternative Python interpreter to use for the wrapper
programs. The default is to use the interpreter found first on
your shell’s $PATH.––with-username=username-or-uid
Specify a different username than mailman. The value of this
option can be an integer user id or a user name. Be sure your
$prefix directory is owned by this user.––with-groupname=groupname-or-gid
Specify a different groupname than mailman. The value of this
option can be an integer group id or a group name. Be sure your
$prefix directory is group-owned by this group.––with-mail-gid=group-or-groups
Specify an alternative group for running scripts via the mail
wrapper. group-or-groups can be a list of one or more integer
group ids or symbolic group names. The first value in the list
that resolves to an existing group is used. By default, the
value is the list mailman, other, mail, and daemon.Note: This is highly system dependent and you must get this
right, because the group id is compiled into the mail wrapper
program for added security. On systems using sendmail, the
sendmail.cf configuration file designates the group id of
sendmail processes using the DefaultUser option. (If commented
out, it still may be indicating the default…)Check your mail server’s documentation and configuration files
to find the right value for this switch.––with-cgi-gid=group-or-groups
Specify an alternative group for running scripts via the CGI
wrapper. group-or-groups can be a list of one or more integer
group ids or symbolic group names. The first value in the list
that resolves to an existing group is used. By default, the
value is the the list www, www-data, and nobody.Note: The proper value for this is dependent on your web server
configuration. You must get this right, because the group id is
compiled into the CGI wrapper program for added security, and no
Mailman CGI scripts will run if this is incorrect.If you’re using Apache, check the values for the Group option in
your httpd.conf file.––with-cgi-ext=extension
Specify an extension for cgi-bin programs. The CGI wrappers
placed in $prefix/cgi-bin will have this extension (some web
servers require an extension). extension must include the
leading dot.––with-mailhost=hostname
Specify the fully qualified host name part for outgoing email.
After the installation is complete, this value can be overriden
in $prefix/Mailman/mm_cfg.py.––with-urlhost=hostname
Specify the fully qualified host name part of urls. After the
installation is complete, this value can be overriden in
$prefix/Mailman/mm_cfg.py.––with-gcc=no
Don’t use gcc, even if it is found. In this case, cc must be
found on your $PATH.
If you don’t run Virtualmin/Webmin the locations and options you need for step 4 will probably be different. Not sure how you find which options were originally used to create Mailman?
Seems to be important to replicate those options when you upgrade otherwise your mailman mailing list might throw out errors (mine did before adding ––with-cgi-gid=apache and ––with-mail-gid=nobody).
For Virtualmin users if you find your way to the Virtualmin Mailman module under “Webmin >> Servers >> Virtualmin Mailman Mailing Lists : Module Config” the above directory structures are under.
Mailman base directory = /usr/lib/mailman
Mailman data directory = /var/lib/mailman
Wasn’t obvious to add these like I did into this line (step 4), I made an educated guess and was right:
./configure --prefix=/usr/lib/mailman --with-var-prefix=/var/lib/mailman --with-cgi-gid=apache --with-mail-gid=nobody
Tried without ––with-cgi-gid=apache at first which after step 6 threw out an error when loading a mailing list after the update.
Mailman CGI error!!!
The Mailman CGI wrapper encountered a fatal error. This entry is being stored in your syslog:Group mismatch error. Mailman expected the CGI
wrapper script to be executed as group “nobody”, but
the system’s web server executed the CGI script as
group “apache”. Try tweaking the web server to run the
script as group “nobody”, or re-run configure,
providing the command line option `––with-cgi-gid=apache’.
I followed the suggestion to go through the configure part again with this included ––with-cgi-gid=apache (which I did and it worked). Basically started from step 4 with different configure options.
Thought I got it working before adding ––with-mail-gid=nobody, but without it when posting emails to the server the emails bounced back with this error:
Command died with status 2: "/usr/lib/mailman/mail/mailman post stallion". Command output: Group mismatch error. Mailman expected the mail wrapper script to be executed as group "mailman", but the system's mail server executed the mail script as group "nobody". Try tweaking the mail server to run the script as group "mailman", or re-run configure, providing the command line option `--with-mail-gid=nobody'.
The error messages Mailman generates are useful, without them wouldn’t have got it working.
Step 5 makes the files etc… that will be used to upgrade Mailman.
Step 6 uses the files we made in step 5 to upgrade Mailman with the latest files.
Few issues as I upgraded Mailman due to Mailman 2.1.12 is about 5 years out of date, so the latest version of Mailman required different features active on the server..
Mailman DNS Python
I didn’t have DNS Python installed and it’s a Mailman 2.1.18-1 requirement, so had to install it as well.
Changed directory to root as before with “CD /” and “CD root” before running these 4 commands.
wget --no-check-certificate https://pypi.python.org/packages/source/d/dnspython/dnspython-1.11.1.zip unzip dnspython-1.11.1.zip cd dnspython-1.11.1 python setup.py install
Like before check https://pypi.python.org/packages/source/d/dnspython/ to make sure dnspython-1.11.1.zip is the latest version.
During the upgrade ran into an issue that Python -devel wasn’t installed, this was the error:
***** Distutils is not available or is incomplete for /usr/bin/python ***** If you installed Python from RPM (or other package manager) ***** be sure to install the -devel package, or install Python ***** from source. See sec. 15.1 of the Installation Manual for ***** details
First confirm python-devel is not installed with this command:
rpm -q python-devel
This seems to a be a development addon for whatever version of Python your server runs on.
If not already installed first find the version of Python you run with this command:
rpm -q python
This lists what version of Python you use:
For my server it’s
python-2.6.6-37.el6_4.x86_64
Yours might be different.
Next installed the devel version via yum (easy step, no need to find it and upload it using wget), just a simple command:
yum install python-devel-2.6.6-37.el6_4.x86_64
Note added -devel after python from the version of Python I’d found earlier.
So if your version of Python is “python-12345” the devel version is “python-devel-12345” in the yum command.
If the devel version wasn’t in my server repository would have to use the wget option after finding where “python-devel-2.6.6-37.el6_4.x86_64” is online.
Had lot of fun updating Mailman manually, hopefully others will find my laymans guide to upgrading Mailman saves them hours of research and guess work.
Mailman HTML Templates
Now I have to figure out how to reference a stylesheet (CSS file) from the HTML Template files, would appear because link rel=”” code like this:
<link rel='stylesheet' id='str_layout-css' href='https://stallion-theme.co.uk/wp-content/themes/stallion-responsive/colors/layout-1000.css' type='text/css' media='all' />
Could be used for cross-site scripting attacks the Mailman developer has disabled the ability to add this sort of code to the HTML templates severally limiting customization. Get this error message:
The page you saved contains suspicious HTML that could potentially expose your users to cross-site scripting attacks. This change has therefore been rejected. If you still want to make these changes, you must have shell access to your Mailman server.
Guess it’s uploading files direct to the server to fix this!
Also couldn’t find any usable Mailman HTML Templates online, the default output is OLD 1990s sort of HTML output and needs a serious update. I plan to make my mailing list look similar to the page you are on now minus the sidebars, pretty easy to do if I could add anything to the Mailman HTML template system.
David
Thank you!
Your post saved me pain and suffering.