Installing Roundcube

The version of Roundcube found in many package respositories are much older than the current stable release. It is not too difficult to install the current stable version

Requirements

The main requirement that need to be check is the php version - which needs to be at least 5.3.7 currently. The other requirements should be met if there is an existing roundcube installed. The roundcube installer will check all the requirements and tell you what needs to be fixed before continuing. The full list of requirements can be found on the roundcube wiki

Installation

  1. Download the tar.gz file from the roundcube wiki 
  2. Unzip at an appropiate location (e.g. /usr/local/lib) - a roundcude directory is created - rename it to roundcube
    tar -zxvf roundcube-xxxx.tar.gz /usr/local/lib
    mv /usr/local/lib/roundcube-1.x /usr/local/lib/roundcube
  3. Makesure that temp and logs directories in the roundcude is own by www-data - so that it can be written to by apache
    chown www-data /usr/local/lib/roundcube/tmp /usr/local/lib/roundcube/logs
  4. Create roundcube database and user (there may already be a user for roundcube - goto /etc/roundcube/debian-db.ini for the username and password) - the new database must be different from the existing roundcube database. Create database and user (if needed) using mysql
       create database roundcube
       grant all privileges on roundcube1.* to roundcube@localhost;
       flush privileges;
  5. Add an entry to apache so we can access the roundcube installer. Edit the file in /etc/apache2/sites-enabled which has the current roundcube entry e.g. mail or default. Find the roundcude Alias in this file and add a new alias below it 
    ​    Alias /roundcube1 /usr/local/lib/roundcube
    reload apache - service apache2 reload
  6. Run the roundcube installer and see what we need to do - in the web browser (www.xxxx/roundube1/installer) -
    1. check and fix any requirement issues (most common is date.timezone)
    2. Check the General configuration and set it for what we want We need to decide on
      1. Name of the server
      2. Do we enable spell check (which uses an outside check program)
      3. Do we allow multiple identies (normally no - one identity with posibility to edit parameters but not email address)
      4. Log-drive should change to syslog
    3. Add the required database details - created above
    4. Plugins - We need to decide which plugins to enable - go through the list and select what is wanted
  7. A configuration file is made which you need to then put in the roundcube config directory. e.g. mv /tmp/config.php.ini /usr/local/lib/roundcube/config/.
  8. Next page on web installer - Initialise database on web interface
  9. Then on web installer - test sending message and login in
  10. Once everything is working - delete the installer - rm -r /usr/local/lib/roundcube/installer

Configuration of Password change

Roundcube can be setup to change a user password in courier. The password plugin is used for this but the plugin needs the following packages to be installed

  • courierpassd - which allows user to change password using poppassd interface
  • xinetd - which is the program that controls the running of courierpassd

Configure xinetd. Xinetd needs to be configured for use by courierpassd - add a courierpassd file to /etc/xinetd.d

service courierpassd                                                                                                                                                                                                                                  
{                                                                                                                                                                                                                                                     
        port            = 106                                                                                                                                                                                                                         
        socket_type     = stream                                                                                                                                                                                                                      
        protocol        = tcp                                                                                                                                                                                                                         
        user            = daemon                                                                                                                                                                                                                      
        server          = /usr/sbin/courierpassd                                                                                                                                                                                                      
        server_args     = -s imap                                                                                                                                                                                                                     
        wait            = no                                                                                                                                                                                                                          
        only_from       = 127.0.0.1                                                                                                                                                                                                                   
        instances       = 4                                                                                                                                                                                                                          
        disable         = no                                                                                                                                                                                                                          
}                                                                                                                                                                                                                                                     

Add port 106 to the service file - /etc/service

courierpasswd 106/tcp

Restart xinetd for this to take effect - service xinetd restart

Add to /usr/local/lib/rouncube/plugins/password/ a new file config.inc.php

<?php
// Password Plugin options
// -----------------------
// A driver to use for password change. Default: "sql".
// See README file for list of supported driver names.
$config['password_driver'] = 'poppassd';
// Determine whether current password is required to change password.
// Default: false.
$config['password_confirm_current'] = true;
// Require the new password to be a certain length.
// set to blank to allow passwords of any length
$config['password_minimum_length'] = 8;
// Require the new password to contain a letter and punctuation character
// Change to false to remove this check.
$config['password_require_nonalpha'] = true;
// Enables logging of password changes into logs/password
$config['password_log'] = false;
// Comma-separated list of login exceptions for which password change
// will be not available (no Password tab in Settings)
$config['password_login_exceptions'] = null;
// Array of hosts that support password changing. Default is NULL.
// Listed hosts will feature a Password option in Settings; others will not.
// Example:
//$config['password_hosts'] = array('mail.example.com', 'mail2.example.org');
$config['password_hosts'] = null;
// Enables saving the new password even if it matches the old password. Useful
// for upgrading the stored passwords after the encryption scheme has changed.
$config['password_force_save'] = false;

// Enables forcing new users to change their password at their first login.
$config['password_force_new_user'] = false;

// Poppassd Driver options
// -----------------------
// The host which changes the password
$config['password_pop_host'] = 'localhost';

// TCP port used for poppassd connections
$config['password_pop_port'] = 106;