Author Topic: Password plugin hash issue  (Read 2779 times)

Offline ictcineca

  • Newbie
  • *
  • Posts: 4
Password plugin hash issue
« on: November 09, 2022, 10:13:46 AM »
Hello,
I installed the password plugin.

I also configured everything, but when I try to change my password, give me this error:

Code: [Select]
PHP Error: Password plugin: Hash method not supported. in /var/www/html/roundcube/plugins/password/password.php on line 787 (POST /?_task=settings&_action=plugin.password-save)
Do you have any idea?
I wold like to inform that the mail server and the webmail server are different, but in the same network. The driver used in plugin is sql.

Thanks

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: Password plugin hash issue
« Reply #1 on: November 09, 2022, 02:13:21 PM »
Can you post how you have the password plugin configured?

Offline alec

  • Hero Member
  • *****
  • Posts: 1,363
Re: Password plugin hash issue
« Reply #2 on: November 10, 2022, 01:53:48 AM »
You need php-hash extension installed. Or use different password hashing method in configuration.

Offline ictcineca

  • Newbie
  • *
  • Posts: 4
Re: Password plugin hash issue
« Reply #3 on: November 10, 2022, 04:52:24 AM »
Hello,

thanks about your support.

Followinf you can find my config plugin:
Code: [Select]
$config['password_driver'] = 'sql';

.
$config['password_strength_driver'] = null;


$config['password_confirm_current'] = true;


$config['password_minimum_length'] = 8;


$config['password_minimum_score'] = 0;


$config['password_log'] = false;


$config['password_login_exceptions'] = null;


$config['password_hosts'] = null;


$config['password_force_save'] = false;


$config['password_force_new_user'] = false;

$config['password_algorithm'] = 'clear';


$config['password_algorithm_options'] = [];


$config['password_algorithm_prefix'] = '';


$config['password_dovecotpw'] = '/usr/local/sbin/dovecotpw'; // for dovecot-1.x


$config['password_dovecotpw_with_method'] = false;



$config['password_disabled'] = false;


$config['password_username_format'] = '%u';


$config['password_http_client'] = [];



$config['password_db_dsn'] = 'mysql://user:password@XXX.XXX.XXX.XXX/dbname';



$config['password_query'] = 'UPDATE mailbox SET password = password_hash(md5(%p)) WHERE username = %u LIMIT 1';


$config['password_idn_ascii'] = false;

The PHP version installed is PHP Version 8.1.2-1ubuntu2.8

Attached is the value of hash module in my php

Thanks alec and SKaero :)

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: Password plugin hash issue
« Reply #4 on: November 10, 2022, 10:39:44 AM »
What file are those config options placed in? Also note that your password_query will not work since you are trying to use PHP functions in the SQL statement.

Offline ictcineca

  • Newbie
  • *
  • Posts: 4
Re: Password plugin hash issue
« Reply #5 on: November 10, 2022, 11:25:26 AM »
Hi SKaero,

those config are in the file /var/www/html/roundcube/plugins/password/config.inc.php.dist

You means that in the password_query, I can set only like this? It will work?

Code: [Select]
$config['password_query'] = 'UPDATE mailbox SET password = %p WHERE username = %u LIMIT 1';
Also this is not working with same error

Thanks

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: Password plugin hash issue
« Reply #6 on: November 10, 2022, 11:31:25 AM »
The <RC root>/plugins/password/config.inc.php.dist file should not be updated. As the first point in the README file in the password folder notes:
Quote
Copy config.inc.php.dist to config.inc.php and set the options as described within the file.

As for the query I don't see why that query wouldn't work.

Offline ictcineca

  • Newbie
  • *
  • Posts: 4
Re: Password plugin hash issue
« Reply #7 on: November 11, 2022, 03:49:26 AM »
Hi SKaero

thank you so much.

This is my big mistake. :(

Now is working!!!  ;D

Also the query script is correct like following
Code: [Select]
$config['password_query'] = 'UPDATE mailbox SET password=%P WHERE username=%u LIMIT 1';
I'm so sorry about that

been very helpful  :)