Roundcube

 

Installation

#apt-get -y install roundcube-pgsql roundcube-plugins

If you already have a postgresql server running with some default values then let the install wizard do its thing, it will ask you a few questions, install the database and install roundcube in /var/lib/roundcube

 

If you want to do things manually for some reason then :

Preliminary

As with postfixadmin it is better to configure the database prior to installing the software. Doing so is a very similar routine.

#createuser roundcube -DRSP -U postgres

Enter a password when prompted, then

#createdb roundcube -O roundcube -U postgres

 

Remote postgresql server

If you are using a remote postgresql server then when it gets to the point where it wants you to install the database press [esc]. Now edit /etc/dbconfig-common/roundcube.conf

The file should contain:

dbc_dbtype='pgsql'
dbc_dbuser='roundcube'
dbc_dbpass='MYPASSWORD'
dbc_dbserver='fqdn.suffix
dbc_dbport='5432'
bc_dbname='roundcube'
dbc_dbadmin='postgres'

Change the directives according to your configuration and save the file before running

#dpkg-reconfigure roundcube

Now if you follow the instructions in the wizard it should now create the tables.

 

Local postgresql server

If your postgresql server is running locally then follow the instructions given by the wizard.

 

Apache

Unlike postfixadmin where it really doesn’t matter for the amount that it is used, I like to create a proper virtual host for webmail. We are going to create a virtual host called mail.fqdn.suffix.

First navigate to /etc/apache2/sites-available and create a file called mail.fqdn.suffix.conf (replace fqdn.suffix with your domain name)

#touch mail.fqdn.suffix.conf

Open the file with your editor and add the following

<VirtualHost> *:80>
    ServerName mail.fqdn.suffix
    Redirect "/" https://mail.fqdn.suffix
</VirtualHost>

<IfModule mod_ssl.c>
   <VirtualHost _default_:443>
       Servername mail.fqdn.suffix
       ServerAdmin user@domain.suffix
       SSLEngine on
       SSLCertificateFile /etc/ssl/certs/mailserver.pem
       SSLCertificateKeyFile /etc/ssl/private/mailserver.key
       Include /etc/roundcube/apache.conf
       Alias / /var/lib/roundcube/
       <FilesMatch "\.(cgi|shtml|phtml|php)$">
               SSLOptions +StdEnvVars
       </FilesMatch>
       <Directory /usr/lib/cgi-bin>
               SSLOptions +StdEnvVars
       </Directory>
               <Location "/">
                       Order Deny,Allow
                       Deny from all
                       Allow from all
                       Require all granted
               </Location>
       BrowserMatch "MSIE [2-6]" \
                       nokeepalive ssl-unclean-shutdown \
                       downgrade-1.0 force-response-1.0
       BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
   </VirtualHost>
</IfModule>

You will need to adjust the Servername; ServerAdmin; SSLCertificateFile and SSLCertificateKeyFile directives to your own configuration although if you followed this guide, the SSL certificates directives should not need to be altered.

You will note the “Include” directive that points to /etc/roundcube/apache.conf. apache.conf is where everything for roundcube is automatically configured during installation.

Now all you need to do is enable the site and reload apache and you should then be able to navigate to the site in a browser.

#a2ensite mail.fqdn.suffix
#service apache2 reload

 

Configuration config.inc.php

On debian this resides in /etc/roundcube. Unlike previous iterations you now must configure the outgoing server correctly or you will get an error 250 whenever you try and send an email and the mail logs are particularly unhelpful as they merely notify you of a connection being established and then disconnected.

The trick is the hidden within the smtp_server directive, which must have the prefix tls:// if the server is configured to use STARTTLS

$config['smtp_server'] = 'tls://mail.myserver.com

 

You will note that the screen asks for a server as well as a username and password. In most cases this is not desirable so simply edit the “default_host” directive to set a default.

$config['default_host'] = 'localhost';

 

Further down there is a list of plugins that Roundcube loads. The “archive” and “zipdownload” plugins are proably already enabled. Add the “managesieve” plugin so that the setting looks like this:

$config['plugins'] = array(                     
    'archive',                     
    'zipdownload',                     
    'managesieve',                   
);

If you need to switch on debugging then you can add the following to the file:

$config['debug'] = 1;
$config['smtp_debug'] = true;

The log files in /var/log/roundcube are then updated and may give you a little more information.

There is also a further setting that allows a user to change their password however at the time of producing this guide I have not configured it to work with our configuration. If we want a user to change their password then we point them to the postfixadmin user logon section and they can do it from there

https://fqdn.suffix/postfixadmin/users

Next an optional setting. The default session lifetime in Roundcube is 10 minutes. That means if a user is not using the webmail interface for more than 10 minutes they will be logged out. I found that annoying and increased that timeout to one hour. To do that at the end of the config file add:

$config['session_lifetime'] = 60;

 

Configuring the managesieve plugin

The “managesieve” plugin will allow your users to manage automatic rules to manage their email. These rules are stored on the server and will be run automatically. You need to configure this plugin though. A default configuration can be found at “/usr/share/roundcube/plugins

/managesieve/config.inc.php.dist” on your system. Copy it to the location where Roundcube will look for it:

#cp /usr/share/roundcube/plugins/managesieve/config.inc.php.dist /etc/roundcube/plugins/managesieve/config.inc.php

No further changes are required.

You should now be able to log into a mailbox from roundcube to send and retrieve your emails; Don’t forget to add an ‘A’ record to your DNS configuration if it does not already exist.