There is a new version of this tutorial available for Debian 8 (Jessie).

Using RoundCube Webmail With ISPConfig 3 On Debian Wheezy (Apache2)

This guide explains how to install the RoundCube webmail application on a Debian Wheezy server running ISPConfig and Apache2, and how to enable the ISPConfig 3 plugins for RoundCube so that users can perform actions like changing their email passwords from within RoundCube. Roundcube webmail is a browser-based multilingual IMAP client with an application-like user interface; it comes with functions like MIME support, address book, folder manipulation, message searching and spell checking.

I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

This tutorial assumes you are using Apache2 as the web server on your ISPConfig 3 server; this tutorial will not work for nginx. I'm going to install RoundCube from the Debian Wheezy repositories - it is a reasonably recent version (0.7.2.9 vs 0.9.1 (current stable version)).

RoundCube will be configured in such a way that it can be accessed from each vhost over the alias /webmail (e.g. http://www.example.com/webmail).

If you are already using another webmail application like SquirrelMail, make sure you disable it completely or at least the alias /webmail. If you have installed SquirrelMail as a Debian package, you can find the alias in /etc/apache2/conf.d/squirrelmail.conf; either comment out the alias to just disable the /webmail alias or comment out the whole file to disable SquirrelMail completely. Don't forget to restart Apache afterwards.

 

2 Creating A Remote User In ISPConfig

The ISPConfig 3 plugins for RoundCube work through ISPConfig's remote API. To use this API, we need a remote user. To create such a user, go to System > User Management > Remote Users and click on the Add new user button:

Provide a username and password for the user...

... and enable the following functions:

  • Server functions
  • Client functions
  • Mail user functions
  • Mail alias functions
  • Mail spamfilter user functions
  • Mail spamfilter policy functions
  • Mail fetchmail functions
  • Mail spamfilter whitelist functions
  • Mail spamfilter blacklist functions
  • Mail user filter functions

Then click on Save.

 

3 Installing RoundCube

We can install RoundCube as follows:

apt-get install roundcube roundcube-plugins roundcube-plugins-extra

You will see the following questions:

Configure database for roundcube with dbconfig-common? <-- Yes
Database type to be used by roundcube: <-- mysql
Password of the database's administrative user: <-- yourrootsqlpassword (the password of the MySQL root user)
MySQL application password for roundcube: <-- roundcubesqlpassword
Password confirmation: <-- roundcubesqlpassword

This will create a MySQL database called roundcube with the MySQL user roundcube and the password roundcubesqlpassword.

Next open /etc/apache2/conf.d/roundcube...

vi /etc/apache2/conf.d/roundcube

... and add the line Alias /webmail /var/lib/roundcube. In addition to that, add the PHP configuration to the <Directory /var/lib/roundcube/> section (I've highlighted the changes):

# Those aliases do not work properly with several hosts on your apache server
# Uncomment them to use it or adapt them to your configuration
Alias /roundcube/program/js/tiny_mce/ /usr/share/tinymce/www/
Alias /roundcube /var/lib/roundcube
Alias /webmail /var/lib/roundcube

# Access to tinymce files
<Directory "/usr/share/tinymce/www/">
      Options Indexes MultiViews FollowSymLinks
      AllowOverride None
      Order allow,deny
      allow from all
</Directory>

<Directory /var/lib/roundcube/>
  Options +FollowSymLinks
  DirectoryIndex index.php

  <IfModule mod_php5.c>
    AddType application/x-httpd-php .php

    php_flag magic_quotes_gpc Off
    php_flag track_vars On
    php_flag register_globals Off
    php_value include_path .:/usr/share/php
  </IfModule>

  # This is needed to parse /var/lib/roundcube/.htaccess. See its
  # content before setting AllowOverride to None.
  AllowOverride All
  order allow,deny
  allow from all
</Directory>

# Protecting basic directories:
<Directory /var/lib/roundcube/config>
        Options -FollowSymLinks
        AllowOverride None
</Directory>

<Directory /var/lib/roundcube/temp>
        Options -FollowSymLinks
        AllowOverride None
        Order allow,deny
        Deny from all
</Directory>

<Directory /var/lib/roundcube/logs>
        Options -FollowSymLinks
        AllowOverride None
        Order allow,deny
        Deny from all
</Directory>

Restart Apache afterwards:

/etc/init.d/apache2 restart

 

4 Configuring RoundCube

Open /etc/roundcube/main.inc.php...

vi /etc/roundcube/main.inc.php

... and set $rcmail_config['default_host'] = 'localhost'; (or the hostname or IP address of your mail server if it is on a remote machine):

[...]
$rcmail_config['default_host'] = 'localhost';
[...]

Otherwise RoundCube will ask for a hostname before each login which might overstrain your users - we want to make usage as easy as possible.

Next install the ISPConfig 3 plugins for RoundCube:

cd /tmp
git clone https://github.com/w2c/ispconfig3_roundcube.git
cd /tmp/ispconfig3_roundcube/
mv ispconfig3_* /var/lib/roundcube/plugins
cd /var/lib/roundcube/plugins
mv ispconfig3_account/config/config.inc.php.dist ispconfig3_account/config/config.inc.php

Open ispconfig3_account/config/config.inc.php...

vi ispconfig3_account/config/config.inc.php

... and fill in the login details of your ISPConfig remote user and the URL of the remote API - my ISPConfig installation runs on https://192.168.0.100:8080, so the URL of the remote API is https://192.168.0.100:8080/remote/:

<?php
$rcmail_config['identity_limit'] = false;
$rcmail_config['remote_soap_user'] = 'roundcube';
$rcmail_config['remote_soap_pass'] = 'Sw0wlytlRt3MY';
$rcmail_config['soap_url'] = 'https://192.168.0.100:8080/remote/';
?>

Finally open /etc/roundcube/main.inc.php again...

vi /etc/roundcube/main.inc.php

... and enable the jquerui plugin plus the ISPConfig 3 plugins...

[...]
// ----------------------------------
// PLUGINS
// ----------------------------------

// List of active plugins (in plugins/ directory)
//$rcmail_config['plugins'] = array();
$rcmail_config['plugins'] = array("jqueryui", "ispconfig3_account", "ispconfig3_autoreply", "ispconfig3_pass", "ispconfig3_spam", "ispconfig3_fetchmail", "ispconfig3_filter");
[...]

... and change the skin from default to classic (otherwise the ISPConfig 3 plugins will not work):

[...]
// skin name: folder from skins/
$rcmail_config['skin'] = 'classic';
[...]

That's it; now you can access RoundCube under the alias /webmail (e.g. www.example.com/webmail). Log in with the email address and password of an email account created through ISPConfig:

This is how RoundCube looks:

Under Settings > Account you can use the ISPconfig 3 plugins for RoundCube to modify your settings, for example...

... you can set a new password for your email account without using ISPConfig:

 

Share this page:

49 Comment(s)