Page 1 of 3

Roundcube Password Plugin

Posted: Wed Dec 23, 2015 3:24 pm
by mike08
Has someone been able to successfully install this plugin for roundcube under vesta? If so do you have an updated guide?
Regards,

Re: Roundcube Password Plugin

Posted: Sun Dec 27, 2015 6:21 am
by hafeezksa
mike08 wrote:Has someone been able to successfully install this plugin for roundcube under vesta? If so do you have an updated guide?
Regards,
I think this plugin already installed with default vesta installation. You can verify it from roundcube "about".

Re: Roundcube Password Plugin

Posted: Mon Dec 28, 2015 9:18 pm
by mike08
Well, whenever I try to change the password it just shows a message:
Could not save password.

Re: Roundcube Password Plugin

Posted: Tue Dec 29, 2015 10:59 am
by hafeezksa
mike08 wrote:Well, whenever I try to change the password it just shows a message:
Could not save password.
What is your vesta port 8083 or other and what is your roundcube version ?

Re: Roundcube Password Plugin

Posted: Tue Dec 29, 2015 12:43 pm
by mike08
Hey,

Right now on presentation port 8083, I have Roundcube Webmail IMAP Client | | Version 0.7.2 with the latest password plugin and the two files that Vesta requires on drivers

Code: Select all

http://c.vestacp.com/0.9.8/debian/roundcube-pw.conf saved as pluging/password/config.inc.php
http://c.vestacp.com/0.9.8/debian/roundcube-driver.php saved as plugins/password/drivers/vesta.php
And I'm getting the following error:

Code: Select all

[28-Dec-2015 10:20:26 -0600]: PHP Error: Failed to load plugin file /var/lib/roundcube/plugins/password/password.php in /usr/share/roundcube/program/include/rcube_plugin_api.php on line 204 (GET /?_task=mail&_action=check-recent&_mbox=INBOX&_list=1&_remote=1&_unlock=0&_=1451319585926)
The suggested line on the php file that error shows, has the following

Code: Select all

'file' => __FILE__, 'line' => __LINE__,
'message' => "Failed to load plugin file $fn"), true, false);
On the other hand trying with the latest stable version which is Version 1.1.4 I get this error message:

Code: Select all

[28-Dec-2015 21:17:26 +0000]: <olo1olva> PHP Error: Password plugin: Broken driver vesta in /home/cer/web/rmail.localehost.com/public_html/plugins/password/password.php on line 292 (POST /?_task=settings&_action=plugin.password-save?_task=&_action=)
And that line on the file shows this message:

Code: Select all

'file' => __FILE__, 'line' => __LINE__,
'message' => "Password plugin: Broken driver $driver"
Basically the logs doesn't say anything relevant is just redundant info.

Re: Roundcube Password Plugin

Posted: Sun Jan 31, 2016 12:05 am
by dpeca
After a lot of debuging, I finaly figured out what is going on.

Someone who wrote a ''Rondcube password changer driver for VestaCP'' should convert a function to class in file /usr/share/roundcube/plugins/password/drivers/vesta.php
Plugin 'passwod' is expecting a class in that file, but there is only a function.

Anyway, here is a solution to fix this.

1. Open file /usr/share/roundcube/plugins/password/drivers/vesta.php

2. Find a line that contain: function password_save($curpass, $passwd)

3. Delete that line

4. On the same place, paste this:

Code: Select all

class rcube_vesta_password {
    function save($curpass, $passwd)
5. Find a line that contain: $fp = fsockopen('ssl://' . $vesta_host, $vesta_port);

6. Delete that line

7. On that place paste this:

Code: Select all

        $errno = "";
        $errstr = "";
        $context = stream_context_create();

        $result = stream_context_set_option($context, 'ssl', 'verify_peer', false);
        $result = stream_context_set_option($context, 'ssl', 'verify_host', false);
        $result = stream_context_set_option($context, 'ssl', 'allow_self_signed', true);

        $fp = stream_socket_client('ssl://' . $vesta_host . ':'.$vesta_port, $errno, $errstr, 60, STREAM_CLIENT_CONNECT, $context);
8. At the end of file write: }

9. Save the file.

-------------

Also, you need to change one configuration file, to make it works.

1. Open /etc/roundcube/plugins/password/config.inc.php
2. Find: $rcmail_config['password_vesta_host'] = 'localhost';
3. Change localhost to your server hostname (if you are not sure what is your hostname, open /etc/hostname file)
4. Also, if you changed Vesta port, change it here too, you will find in next line $rcmail_config['password_vesta_port']
5. Save the file.

----------

Also, you need this:
Run as root in SSH console:

Code: Select all

cp /var/lib/roundcube/plugins/jqueryui/config.inc.php.dist /var/lib/roundcube/plugins/jqueryui/config.inc.php

chown admin:admin /var/log/roundcube

Re: Roundcube Password Plugin

Posted: Mon Feb 15, 2016 11:30 am
by kallovsky
Hello dpeca,

thanks a lot for posting your results here. Sounds like a lot work.
Anyway, it drove me crazy to figure out that failure. But I ask myself how it was possible to occur. I guess it was an Roundcube update or something like that. In any case, VestaCP should definitely update their Roundcube password driver file to harmonize again with it.



Thank's again. I'm sure this is gonna help a lot of other people here.
Cheers,
Kalle

Re: Roundcube Password Plugin

Posted: Mon Feb 15, 2016 11:20 pm
by dpeca
Two things.
1. Roundcube updated password plugin, so it require modifications on driver side.
2. Vesta driver was not written very well... for example it does not support self-signed SSL... and Vesta is not updating config.inc.php of password plugin to adjust hostname...

So, my modifications fixes both things.

Re: Roundcube Password Plugin

Posted: Tue Feb 16, 2016 7:24 pm
by skurudo
Link to this bug:
https://bugs.vestacp.com/issues/143

dpeca, great work, man! Thanks.

Re: Roundcube Password Plugin

Posted: Wed Feb 17, 2016 1:31 am
by dpeca
BTW, pull request for password driver is here - https://github.com/serghey-rodin/vesta/pull/619
Unfortunately, I patched only it - other steps should be probably patched in Vesta instalation script for Debian, but it is out of my knowledge :)
(I don't have a time to analyze instalation script, and Vesta developers probably will not be happy to see that I'm trying to 'cook' in instalation script :D )