[Mailman-Users] Shell that moves admins to moderators, change admin and moderator passwd
Cat
cat at burningman.com
Thu Feb 8 03:06:21 CET 2007
Hello,
not sure anyone will have use for this, but I'm submitting it just in case.
I had to do the following on 100+ lists:
for each list:
the administrator(s) becomes moderator(s)
a new administrator is added
change administrator's password
change moderator's password
the list of affected lists is in a file named reglists
/home/cat/wk is a directory where I store previous admins lists
/home/cat/cfg is a directory where I build the new config file to run on the
lists
for i in `cat /home/cat/reglists`
do
echo $i
# create list of administrators
/usr/sbin/list_admins $i | awk -F: '{print $3;}' | sed -e "s/,/\n/g" |sed
-e
"s/^ //" > /home/cat/wk/$i
# create new configfile
echo "# -*- python -*-" > cfg/$i
echo "# -*- coding: us-ascii -*-" >>cfg/$i
# new moderators
MOD="moderator = ["
for j in `cat wk/$i`; do MOD="$MOD'$j',"; done
echo $MOD |sed -se "s/,$/]/" >>cfg/$i
# new administrator
echo "owner = ['newadmin at yourmom.com']" >> cfg/$i
# new passwords
echo "import sha" >> cfg/$i
echo "mlist.password = sha.new('newadminpasswde').hexdigest()" >> cfg/$i
echo "mlist.mod_password = sha.new('newmoderatorpasswd').hexdigest()" >>
cfg/$i
# apply config file
/usr/lib/mailman/bin/config_list -i cfg/$i $i
done
thanks to Mark for helping me figuring out the change of passwords in the
config file
--
Cat
Burning Man Sysadmin Team
More information about the Mailman-Users
mailing list