Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Developers

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-17-2006, 05:39 PM
Senior Member
 
Posts: 51
Default Passwords

Are there any charecter retriction, or length restrictions inherient in any area of zimbra... I'm asking because I'm reimplementing the getRandomPass sub in zmsetup as it hangs randomly in gentoo. Right now I'm using [A-Za-z0-9] and _-% # | for charecters with a defaultly 20 charecter long password. Will this break anything?

Thanks,
Ben

BTW I'm working on porting the current CVS to a typical compiled rpm release for i686 Gentoo.

Edit: Apparently % and | are no, no's

Last edited by unilogic; 04-17-2006 at 09:31 PM..
Reply With Quote
  #2 (permalink)  
Old 04-18-2006, 08:14 AM
Zimbra Employee
 
Posts: 4,792
Default

Might be best to keep the same list of chars we use today. I don't have that sub in front of me or do we call something else?
__________________
Bugzilla - Wiki - Downloads - Offline Client
Reply With Quote
  #3 (permalink)  
Old 04-18-2006, 02:02 PM
Senior Member
 
Posts: 51
Default

You call the com.zimbra.cs.util.RandomPassword java class. Any idea were I can actually find the code for that class and see what its doing and why it hangs.
Thanks,
Ben
Reply With Quote
  #4 (permalink)  
Old 04-18-2006, 07:17 PM
Zimbra Employee
 
Posts: 515
Default

RandomPassword source
__________________
Search the Forums - Bugzilla - Wiki - Downloads
Reply With Quote
  #5 (permalink)  
Old 04-19-2006, 04:02 PM
Senior Member
 
Posts: 51
Default

For those interested I wrote this simple little password generator in perl to take place of the RandomPassword java class which seems to take its sweet time on random occassions. The code in part is originally from http://www.cgi-interactive-uk.com/ra...generator.html. I placed it in /opt/zimbra/bin and called it from zmsetup when needed. Works like a champ. There shouldn't be any problems with security. Although the password isn't truly random. Its pretty close though as the salt is never used twice, at least it shouldn't be since time is always increasing. On a side note, I have all services except tomcat running in gentoo. On a side, side note, if you ever do a cvs build use the default versions for third party apps... It’s a pain in the butt upgrading all the scripts for the new versions.

Ben


Code:
#!/usr/bin/perl -w
sub genRandomPass {

        my $password;
        my $_rand;

        my $password_min = $_[0];
        my $password_max = $_[1];
        
        if (!$password_min) {
          $password_min = 8;
        }
        if (!$password_max) {
            $password_max = 10;
        }
        
        if ( $password_max <= $password_min ) {
          print "Error: The password max length must be greater then the password min length\nUsage: zmpassgen <Max Length> <Min Length>";
          exit 1;
        }
        $range = $password_max - $password_min;
        srand(time() ^($$ + ($$ <<25)));
        my $password_length = int(rand($range)) + $password_min;

        my @chars = split(" ", "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z _ . 0 1 2 3 4 5 6 7 8 9");
        
        srand(time() ^($$ + ($$ <<25)));
        for (my $i=0; $i <= $password_length ;$i++) {
                $_rand = int(rand 64);
                $password .= $chars[$_rand];
        }
        return $password;
} 
print genRandomPass($ARGV[0],$ARGV[1]);

Last edited by unilogic; 04-19-2006 at 04:05 PM..
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.