Re: Transfer ENCRYPT password field to another server

2013-07-20 Thread Rik Wasmus
> From: Johan De Meersman  To:J Gao  @ 
2013-07-19
> > From: "J Gao" 
> > Subject: Transfer ENCRYPT password field to another server
> > 
> > So, is there a way to make the MySQL encrypted password string
> > "2I6JOeg.JukJ." convert to MD5 hash "$1$."?
> 
> Nope. Encrypt() calls unix crypt(), which is really more a hash - you can't
> go back to the original.
> 
> The proper way to handle this, is to notify the users that passwords will
> expire upon moving to the new system, and sending each of them a personal,
> unique link to set their new password.

If in a hurry, yes indeed. To limit impact on your most active users, you can 
usually do something like on the application side for a while before 
migrating:

1) On login, try new hash method first
2) On fail, try old hash method
3) If old hash method succeeds, update hash to new hash method (or store it in 
a new location), as you now temporarily have the actual password.
4) After most active users have thus 'upgraded their password by just logging 
in', send out an e-mail to those who haven't with the (re)set password link 
Johan mentions, and retire the old hash method.

(Do keep in mind password resets etc. also need to know about the multiple 
hashing methods in use.)
-- 
Rik Wasmus

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: Transfer ENCRYPT password field to another server

2013-07-19 Thread Johan De Meersman


- Original Message -
> From: "J Gao" 
> Subject: Transfer ENCRYPT password field to another server
> 
> So, is there a way to make the MySQL encrypted password string
> "2I6JOeg.JukJ." convert to MD5 hash "$1$."?

Nope. Encrypt() calls unix crypt(), which is really more a hash - you can't go 
back to the original.

The proper way to handle this, is to notify the users that passwords will 
expire upon moving to the new system, and sending each of them a personal, 
unique link to set their new password.


-- 
Unhappiness is discouraged and will be corrected with kitten pictures.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Transfer ENCRYPT password field to another server

2013-07-18 Thread J Gao

Hi, All,

I am having trouble to transfer email user account which is saved in 
MySQL to another server. Here is the detail:


I have an old email server which using MySQL to store user account 
information. The password field uses MySQL ENCRYPT function to save the 
users password. So if I want change the user's password I can do:
 UPDATE  `mail`.`users` SET  `password` = ENCRYPT(  '12345' ) WHERE 
CONVERT(  `users`.`email` USING utf8 ) =  'g...@veecall.com' LIMIT 1 ;


Then the new password "12345" saved in the table as string of " 
2I6JOeg.JukJ."


Now I build a new server using iRedMail. When I try to transfer user 
account I have trouble to transfer the password field. Because the 
iRadMail/dovecot is using MD5-CRAM to encrypt the password then save it 
in the MySQL. All the password string is started with "$1$".


So, is there a way to make the MySQL encrypted password string 
"2I6JOeg.JukJ." convert to MD5 hash "$1$."?


Thanks for help.

Gao

--
 __
   _|==|_
('')__/

--(`^^')

  (`^'^'`)
  `=='