Running mailman on qmail+vpopmail
Usually qmail MTAs include the tightly-coupled ezmlm
. If you want to run Mailman you will need to use the following glue to pipe valiases to the mailman
program.
1. Give vpopmail access to run mailman as user mailman.
Modify the /etc/sudoers
file (via sudo visudo
) and add this line:
vpopmail ALL = (mailman) NOPASSWD: /usr/lib/mailman/mail/mailman
2. Create the mailman-inject script
This is the glue between a valias
and the mailman
program. Copy the following into a file in the bin directory for your mailman installation (on a Redora-based system that'd be /usr/lib/mailman/bin/mailman-inject
) and make it executable:
#!/bin/sh
# Pipe message to mailman as mailman user.
echo "[$(date '+%F %T')] Mailman request: $@" >> /var/log/mailman-inject.log;
sudo -u mailman /usr/lib/mailman/mail/mailman $@ >> /var/log/mailman-inject.log 2>&1;
This glue script writes to a log file which should be accessible by user mailman
:
sudo touch /var/log/mailman-inject.log
sudo chown mailman /var/log/mailman-inject.log
sudo chmod 644 /var/log/mailman-inject.log
3. Create a valias helper script
This is responsible for adding the valiases. Copy the following into a file at /usr/local/bin/vaddmailman
and make it executable:
#!/bin/sh
if ! echo $1 | grep -q '@'; then
echo "Usage: $(basename $0) LISTNAME@DOMAIN";
exit 1;
fi
LISTNAME=$(echo $1 | cut -d @ -f 1);
DOMAIN=$(echo $1 | cut -d @ -f 2);
echo "Adding mailman valiases for list $LISTNAME@$DOMAIN...";
valias -i "|preline ~mailman/bin/mailman-inject.sh post $LISTNAME" $LISTNAME@$DOMAIN
valias -i "|preline ~mailman/bin/mailman-inject.sh admin $LISTNAME" $LISTNAME-admin@$DOMAIN
valias -i "|preline ~mailman/bin/mailman-inject.sh bounces $LISTNAME" $LISTNAME-bounces@$DOMAIN
valias -i "|preline ~mailman/bin/mailman-inject.sh confirm $LISTNAME" $LISTNAME-confirm@$DOMAIN
valias -i "|preline ~mailman/bin/mailman-inject.sh join $LISTNAME" $LISTNAME-join@$DOMAIN
valias -i "|preline ~mailman/bin/mailman-inject.sh leave $LISTNAME" $LISTNAME-leave@$DOMAIN
valias -i "|preline ~mailman/bin/mailman-inject.sh owner $LISTNAME" $LISTNAME-owner@$DOMAIN
valias -i "|preline ~mailman/bin/mailman-inject.sh request $LISTNAME" $LISTNAME-request@$DOMAIN
valias -i "|preline ~mailman/bin/mailman-inject.sh subscribe $LISTNAME" $LISTNAME-subscribe@$DOMAIN
valias -i "|preline ~mailman/bin/mailman-inject.sh unsubscribe $LISTNAME" $LISTNAME-unsubscribe@$DOMAIN
# The following line is for VERP; uncomment if you use it.
# echo "|preline /usr/local/mailman/mail/mailman bounces $LISTNAME" $LISTNAME-bounces-default@$DOMAIN
4. Now create a mailman list:
sudo /usr/lib/mailman/bin/newlist LISTNAME@DOMAIN
5. And finally, create the valiases.
sudo /usr/local/bin/vaddmailman add LISTNAME@DOMAIN
You can test by emailing to the list and watching the /var/log/mailman-inject.log
log.