On 04/21/2011 10:36 AM, J4K wrote:
> On 04/17/2011 08:45 PM, JKL wrote:
>> Dear all,
>>
>>      I just discovered the password plugin that comes by default with
>> RC, and have enabled it.  As I expected it did not work out of the box,
>> (mysql driver) because I know that I have to adapt the plug-in to my
>> particular configuration.
>>
>> I have all passwords stored in a mysql backend that was configured using
>> postfixadmin.  Is it possible, and if so does any one have any pointers,
>> to get RoundCube's password plug-in to work with the mysql backup as
>> configured with the default postfixadmin mysql set-up?
>>
>> Best regards, J.
>>
> Hi,
>
> Follow up with more info:
>
> I have a roundcube database in mysql.  It contains a table of user
> acconts, but not the passwords (crededtials).
>
> The credentials are in the mysql dB set up by postfixadmin.  The
> postfixadmin dB has this table:
>
> mysql> describe mailbox;
> +------------+--------------+------+-----+---------------------+-------+
> | Field      | Type         | Null | Key | Default             | Extra |
> +------------+--------------+------+-----+---------------------+-------+
> | username   | varchar(255) | NO   | PRI | NULL                |       |
> | password   | varchar(255) | NO   |     | NULL                |       |
> | name       | varchar(255) | NO   |     | NULL                |       |
> | maildir    | varchar(255) | NO   |     | NULL                |       |
> | quota      | bigint(20)   | NO   |     | 0                   |       |
> | local_part | varchar(255) | NO   |     | NULL                |       |
> | domain     | varchar(255) | NO   | MUL | NULL                |       |
> | created    | datetime     | NO   |     | 0000-00-00 00:00:00 |       |
> | modified   | datetime     | NO   |     | 0000-00-00 00:00:00 |       |
> | active     | tinyint(1)   | NO   |     | 1                   |       |
> +------------+--------------+------+-----+---------------------+-------+
>
> The RoundCube installation has the roundcube dB configured in the
> config/db.inc.php.
>
> However, for the password plugin to work, I imagine that it has to
> update a row in the other database that contains the actual credentials:
>   (postfixadmin,mailbox.password).
>
> The password plugin file : plugins/password/config.inc.php does not
> contain any method to interact with postfixadmin dB.
>
> Could I add ths parameter into the plugins/password/config.inc.php to
> enable this?  Would it work, well?
>
>   $rcmail_config['db_dsnw'] = 
> 'mysql://roundcube:MyDbPassword@localhost/postfixadmin';
>
> Regards.
easily solved:  (easy is subjective)

In the plugins/password/config.inc.php:

Change this line
from
    $rcmail_config['password_db_dsn'] = '';
to
    $rcmail_config['password_db_dsn'] =
'mysql://username:password@localhost/postfixadmin';
(Here my username and password are my roundcube users ones)

Change this line
from
    $rcmail_config['password_query'] = 'SELECT update_passwd(%c, %u)';
to
    $rcmail_config['password_query'] = "UPDATE `mailbox` SET `password`
= %c, modified=now() WHERE `username` = %u LIMIT 1";


Grant permissions for your roundcube user to the postfixadmin database.
(One could also use the postfixadmin user instead, but I think its
easier to keep these separated.  It is better that roundcube creds are
compromised instead of the postfixadmin credentials)

    GRANT SELECT, UPDATE (password, modified)
    ON postfixadmin.mailbox
    TO 'roundcube'@'localhost'
    IDENTIFIED BY 'password'

Note: Replace with your datavase names and user names accordingly.

Note that password is not the encrypted password one sees in the
database, but the actual plain text password
Not:  *327384943$@$@#$@#%$@$@#$@#$
But this:  MySecretPassword
These are examples.


-- 
List info: http://lists.roundcube.net/users/
BT/8f4f07cd

Reply via email to