Hi,

I have been using the withlist command to delete a given administrator or moderator from all mailman 2.1 lists.

I also require to change the moderator or admin password for all lists that they have been removed from, but have it so that it is a different randomly generated password for each list they are removed from and then have this emailed to the other moderators or admins who are then left or a default address if none are left (I have managed so far that it is changed to the same password for each list they have been removed from). I am currently at the beginning of my Python learning so this is why I'm asking for help.

My script and usage so far can be found below:

Usage:

withlist --all --run script_name.change_administrator_password firstname.lastn...@domain.co.uk `pwgen -sB 15 1`

The script is saved at:

/usr/sbin/

Function defined in the script:

import sha

def change_administrator_password(mlist, owner, newpasswd):
    mlist.Lock()
    try:
        if mlist.owner[mlist.owner.index(owner)]:
    mlist.password = sha.new(newpasswd).hexdigest()
           print (newpasswd)

    except:
      print("password not changed for", (mlist.real_name, owner))
    mlist.Save()
    mlist.Unlock()

This will go through all lists and change the administrator password to a randomly generated one, but as advised above it will set the same password (not what I want) I've put a print in for debugging so I can see what it was.

Thanks

Daniel

------------------------------------------------------
Mailman-Users mailing list -- mailman-users@python.org
To unsubscribe send an email to mailman-users-le...@python.org
https://mail.python.org/mailman3/lists/mailman-users.python.org/
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: https://www.mail-archive.com/mailman-users@python.org/
   https://mail.python.org/archives/list/mailman-users@python.org/

Reply via email to