[Mailman-Developers] Re: Welcome to the "Mailman-Developers" mailing list

Jesper Louis Andersen jlouis at diku.dk
Fri Aug 15 16:11:39 EDT 2003


Ok, you have just installed mailman on a FreeBSD 5.1 box and got
things to run properly. You then begin to port scripts from the older
setup. These in turn calls ./bin/newlist for setting up lists when they
do not exist and force things to be like we want them. Only slight
problem is the password generation. Originally the scripts called
''mkpasswd'', which is a program for generating random passwords on the
commandline. Then it fed the stuff into ./bin/newlist, easy and simple. 

Though it now seems that change_pw can force a password change on a
given list with a proper random password, I did not like the possible
race-condition there is a possible ./bin/newlist followed by ./bin/change_pw.

So what to do? Hell, this is Python for gods sake, it is easy to hack:

--- /usr/local/opt/mailman/bin/newlist.orig	Fri Aug 15 14:34:28 2003
+++ newlist	Fri Aug 15 14:54:44 2003
@@ -32,6 +32,9 @@
         their list has been created.  This option suppresses the prompt and
         notification.
 
+    -p/--randompass
+    	Generate a random password for this list
+
     -h/--help
         Print this help text and exit.
 
@@ -98,8 +101,9 @@
 
 def main():
     try:
-        opts, args = getopt.getopt(sys.argv[1:], 'hql:',
-                                   ['help', 'quiet', 'language='])
+        opts, args = getopt.getopt(sys.argv[1:], 'hqpl:',
+                                   ['help', 'quiet', 
+				    'language=', 'randompass'])
     except getopt.error, msg:
         usage(1, msg)
 
@@ -112,6 +116,8 @@
             quiet = 1
         if opt in ('-l', '--language'):
             lang = arg
+	if opt in ('-p', '--randompass'):
+	    randompass = 1
 
     # Is the language known?
     if lang not in mm_cfg.LC_DESCRIPTIONS.keys():
@@ -142,7 +148,10 @@
     if len(args) > 2:
 	listpasswd = args[2]
     else:
-        listpasswd = getpass.getpass(_('Initial %(listname)s password: '))
+	if randompass:
+	    listpasswd = Utils.MakeRandomPassword(8)
+	else:
+            listpasswd = getpass.getpass(_('Initial %(listname)s password: '))
     # List passwords cannot be empty
     listpasswd = listpasswd.strip()
     if not listpasswd:

Problem solved. Views on this? Should it be committed to the main trunk?
Is there a better way than this? Is my call to ./bin/newlist insane? Is
there a better way to get a hook into the system?

-- 
Jesper



More information about the Mailman-Developers mailing list