[Mailman-Users] updating aliases file.

Todd Pfaff pfaff at edge.cis.mcmaster.ca
Tue May 2 16:46:38 CEST 2000


this has been discussed before and can be found in the mailman-users
archives.  you could search the mailman-users archives for keywords
sendmail and aliases.  i posted a detailed solution for sendmail and
mailman aliases sometime last year.

briefly, here are the instruction again...

1) create the mailman aliases files in ~mailman, paying close attention
to the ownership and permissions:

-rw-r--r--   1 mailman  mailman      4780 Dec  2 23:02 aliases
-rw-r--r--   1 root     mailman      4096 Dec  2 23:03 aliases.dir
-rw-r--r--   1 root     mailman      4096 Dec  2 23:03 aliases.pag

2) in /etc/mail/sendmail.cf (or wherever your sendmail.cf is) add an alias
file include something like this:

# location of alias file
O AliasFile=dbm:/etc/mail/aliases
O AliasFile=dbm:/home/mailman/aliases

3) when running newlist, redirect the output to /home/mailman/aliases,
possibly through a filter to remove the comment lines.

4) run newaliases.

i've attached some small script programs which i use as front-ends to
newlist and rmlist.  they maintain the sendmail aliases file as well as an
owners list.  i use the owners list for distributing information about
mailman to list owners.


On Tue, 2 May 2000, Krist van Besien wrote:

> As quoted from Nigel Metheringham:
> > 
> > krist at West.NL said:
> > > So I am now faced with a problem. I want to deploy mailman at a
> > > clients site, and really need an automatic update. So I could go out
> > > and write some wrapper script that would do the trick, or try to hack
> > > mailman itself. 
> > 
> > All of these methods are wrong.  You need a means that actually 
> > integrates your MLM & MTA so that the MTA knows of the lists handled by 
> > the MLM.   This can certainly be done for exim, and I have heard of 
> > people doing similar things for postfix and sendmail.
> 
> When you run newlist the rpogram ends printing out the lines you manually
> need to add to /etc/aliases. I just need a wqay to add these automatically.
> 
> Exim is not an option for me, I need to use sendmail. If there are better
> ways to integrate mailman with sendmail other then having a way to add
> lines to /etc/aliases I'd be glad to learn about them.
> 
> I've started to hack on the alias-wrapper program found in
> <mailman-source>/src directory, but which had aparently been commmented out
> in the Makefile. See if I can make that work.
> 
> 
> Krist
> 
> --
> Ing. Krist van Besien    | At work:            | At home:
> Software Engineer        | krist at west.nl       | kvbesien at casema.net
> West Consulting B.V.     | http://www.west.nl  | 
> Delft, the Netherlands   | +31 (0)15 2191604   | +31 (0)6 50235002
> --
> "Imagine if every Thursday your shoes exploded if you tied them the
> usual way.  This happens to us all the time with computers, and nobody
> thinks of complaining."
> 		-- Jeff Raskin, interviewed in Doctor Dobb's Journal
> 
> ------------------------------------------------------
> Mailman-Users maillist  -  Mailman-Users at python.org
> http://www.python.org/mailman/listinfo/mailman-users
> 

--
Todd Pfaff                         \  Email: pfaff at mcmaster.ca
Computing and Information Services  \ Voice: (905) 525-9140 x22920
ABB 132                              \  FAX: (905) 528-3773
McMaster University                   \
Hamilton, Ontario, Canada  L8S 4M1     \
-------------- next part --------------
#!/bin/sh
#
# wrapper script to do all the nitty-gritty of creating a new list
# - prompt for newlist parameters
# - run mailman newlist program
# - update aliases file and run newaliases
# - update owners list
#
# Todd Pfaff
# March 3 2000

echo
echo running local newlist program
while [ "$x" != "y" ]; do
  echo
  echo Enter list name:
  read list
  echo Enter list owner email address:
  read email
  echo Enter list owner password:
  read pw
  echo
  echo list name: $list
  echo owner email: $email
  echo owner password: $pw
  echo
  echo "Is this correct? (y/n)"
  read x
done

aliases=/tmp/mailman-aliases-$$

echo
echo running mailman newlist program
$HOME/bin/newlist $list $email $pw 1 > $aliases

echo
echo adding new aliases to aliases file
cat $aliases
cat $aliases | sed -e '1,3d' >> $HOME/aliases
rm -f $aliases

echo
echo running newaliases
newaliases

echo
echo adding $email to owners-list
echo $email | add_members -w n -n - owners-list

echo
echo new list $list created
echo

-------------- next part --------------
#!/bin/sh
#
# wrapper script to do all the nitty-gritty of removing a list
# - prompt for rmlist parameters
# - run mailman rmlist program
# - update aliases file and run newaliases
# - update owners list
#
# Todd Pfaff
# March 3 2000

echo
echo running local rmlist program

while [ "$x" != "y" ]; do
  echo
  echo Enter list name:
  read list
  echo "Remove archives? (y/n)"
  read rmarchives
  echo
  echo list name: $list
  if [ "$rmarchives" = "y" ]; then
    echo remove archives
    rmopt="-a"
  else
    echo do not remove archives
  fi
  echo
  echo "Is this correct? (y/n)"
  read x
done

aliases=/tmp/mailman-aliases-$$

echo
echo running mailman rmlist program
$HOME/bin/rmlist $rmopt $list

echo
echo editing aliases file
cp -p $HOME/aliases $HOME/aliases.tmp
ed $HOME/aliases.tmp >/dev/null 2>&1 << EOF
/^## $list mailing list/;.+7d
w
q
EOF

echo
echo these lines will be removed from aliases
diff $HOME/aliases $HOME/aliases.tmp
echo
echo "Is this correct? (y/n)"
read x
if [ "$x" = "y" ]; then
  cp -p $HOME/aliases.tmp $HOME/aliases
fi
rm -f $HOME/aliases.tmp

echo
echo running newaliases
newaliases

echo
echo "updating owners-list (this may take a while)"
owners-update

echo
echo list $list removed
echo

-------------- next part --------------
#!/bin/sh
#
# for each list
#   use config_list to extract and print list owner addresses
# end
# pass the list of owners to sync_members to update owners-list
#
# Todd Pfaff
# Feb 17 2000
#
cd $HOME/lists
for list in *; do
  eval ` \
  config_list -o - $list \
  | grep '^owner' \
  | tr -d "\[\],'" \
  | sed \
    -e 's/ = /="/' \
    -e 's/$/"/' \
  `
  for o in $owner; do
    echo $o
  done
done \
| sort -u \
| sync_members -a=no -w=no -f - owners-list


More information about the Mailman-Users mailing list