Rob's web

Roundcubemail

Roundcube webmail is a browser-based multilingual IMAP client with an application-like user interface. It provides full functionality you expect from an email client, including MIME support, address book, folder manipulation, message searching and spell checking.

Prerequisites

  1. Working webserver with vhosts
  2. Working SQL server
  3. Working IMAP server
  4. Working SMTP server

Downloading

Download the source-code.

Installation

Read the installation guide.

Setting up the vhost

# cd /srv/www/vhosts
# mkdir -p webmail.example.com/httpsdocs
# cd /srv/www/vhosts/webmail.example.com/httpsdocs/
# cp -R <path to roundcube unzipped dir>/* .
# chcon -R -t httpd_sys_rw_content_t *
# cd ..
# chown -R apache:apache
# cd /etc/httpd/conf/vhosts.d/
# cp vhosts.con webmail.example.com.conf
# vi webmail.example.com.conf	// Edit this file for your needs.

The vhosts.conf template is used and must be changed to your needs. Start with replacing example.com to your domain.

Also remove the first and second virtualhost.

<VirtualHost *:80>
        ServerName example.com
....
<VirtualHost *:443>
        ServerName example.com

We keep the third and fourth virualhost.

After you configure the server you need to restart the webserver.

# httpd -t
# systemctl restart httpd

Setting up the database

Create a database with any name you want and grant privileges to a separate database user. It's recommended not to use an existing user or root.

With MySQL you can set up the database by issuing the following commands:

Use:
username: roundcube
password: make one up.

# cd /srv/www/vhosts/mail.example.com/httpsdocs/
# mariadb -u root -p
MariaDB [(none)]>
MariaDB [(none)]> create database roundcube character set utf8 collate utf8_general_ci;
MariaDB [(none)]> grant all privileges on roundcube.* to username@localhost identified by 'password';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> mariadb roundcube < SQL/mysql.initial.sql
MariaDB [(none)]> use roundcube;

Database changed
MariaDB [roundcube]> show tables;
+---------------------+
| Tables_in_roundcube |
+---------------------+
| cache               |
| cache_index         |
| cache_messages      |
| cache_shared        |
| cache_thread        |
| collected_addresses |
| contactgroupmembers |
| contactgroups       |
| contacts            |
| dictionary          |
| filestore           |
| identities          |
| responses           |
| searches            |
| session             |
| system              |
| users               |
+---------------------+
17 rows in set (0.000 sec)

MariaDB [roundcube]> quit
# 

TLS

You need TLS for this.

Use your wildcard certificate or make one with lets-encrypt.

Configuring

Now can we start with the Roundcube configuratiom.

Open your browser and go to https://webmail.example.com/installer.

Step 1 Check environment

This wil check for dependencies. Everything must be OK. If not add the missing items. You must see your installed SQL server.

You need to restart php-fpm and httpd after adding missing php modules.

Step 2 Create config

Set the necessary values.

Step 3 Test config

Testing if every thing works. If not go back to step 2. SMTP might be tricky to get running.

When every thing works, you can open a new tab and login with your email address as user and password.

Step 4 Cleaning up

When every thing works you need to remove the installer.

# cd /srv/www/vhosts/webmail.example.com/httpsdocs/
# rm -fR installer/

Mail settings

The IMAP server allows authentication on port 143, so for localhost use no problem.

The SMTP server only allow mail send ove ports 465 and 587. These must use authentication. Port 25 is only used for receiving email. Also ehlo is mandatory.

// IMAP
$config['imap_host'] = 'localhost:143';

// SMTP
$config['smtp_host'] = 'ssl://smtp.example.com:465';
$config['smtp_helo_host'] = 'webmail.example.com';
$config['smtp_user'] = '%u';
$config['smtp_pass'] = '%p';

Adding enigma

The key directory must be outside the website tree.

Creating key directory

# cd /srv/www/vhosts/webmail.example.com/
# mkdir keys
# chown apache:apache keys
# tree -d -L 1
.
├── httpsdocs
└── keys

Adding enigma

# cd /srv/www/vhosts/webmail.example.com/httpsdocs/config
# vi config.inc.php
// REQUIRED! Keys directory for all users.
// Must be writeable by PHP process, and not in the web server document root
$config['enigma_pgp_homedir'] = '/srv/www/vhosts/webmail.example.com/keys';

// List of active plugins (in plugins/ directory)
$config['plugins'] = [
        'archive',
        'carddav',
        'enigma',
        'vcard_attachments',
        'zipdownload',
];

Adding carddav

Carddav is used to add contacts to the server. You need nextcloud or any competable service.

Prerequisites

Running Carddav server like cloud.example.com or externals.

Installation

Logout from Roundcube.

Download the sourcecode. Installation manual is doc/INSTALL.md.

You need composer. If not already installed:

# dnf install composer

Adding carddav

# cd /srv/www/vhosts/webmail.example.com/httpsdocs/config
# vi config.inc.php
// List of active plugins (in plugins/ directory)
$config['plugins'] = [
        'archive',
        'carddav',
        'enigma',
        'vcard_attachments',
        'zipdownload',
];
# cd
# unzip /path/to/rcmcarddav-master.zip
# cd /srv/www/vhosts/mail.example.com/httpsdocs/
# sudo -u apache composer require --update-no-dev -o "roundcube/carddav:*"
  1. Login at Roundcube.
  2. Goto: Setup -> Carddav
  3. Click on the right side on Add+
  4. Add new CardDAV account
  5. Save

You can find you contacts on Contacts.

Links