Roundcube¶
What Is It?¶
Roundcube is an open-source webmail client that you can use to access your email account. It works by connecting to the Dovecot service with your credentials and then mediates the connection between the client and Dovecot, giving it a friendly UI.
Installation¶
First we need to install some dependencies:
dnf install epel-release dnf-plugins-core && dnf update
dnf config-manager --set-enabled crb
dnf install -y make ImageMagick ImageMagick-devel ImageMagick-perl pcre-devel zlib zlib-devel libzip libzip-devel libmcrypt-devel php php-fpm php-devel php-pear php-cli php-gd php-curl php-xml php-mysqlnd php-mbstring php-intl php-ldap mariadb mariadb-server httpd
pecl install imagick mcrypt zip
- For each of the extensions installed with
pecl, create a file named20-<extension_name>.iniinto/etc/php.d/and into the file writeextension=<extension_name>:
echo "extension=imagick.so" >> /etc/php.d/20-imagick.ini
echo "extension=mcrypt.so" >> /etc/php.d/20-mcrypt.ini
echo "extension=zip.so" >> /etc/php.d/20-zip.ini
Now we can download Roundcubemail and unpack it to /var/www/html/roundcubemail.
# Download roundcube archive
wget https://github.com/roundcube/roundcubemail/releases/download/1.6.14/roundcubemail-1.6.14-complete.tar.gz -O /var/www/html/roundcube.tar.gz
# Go to web root
cd /var/www/html
# Extract the archive
tar -xzf roundcube.tar.gz
# Remove the compressed file
rm -f roundcube.tar.gz
# Rename extracted directory (adjust name if needed)
mv roundcubemail-* roundcubemail
# Set ownership to apache (httpd user)
chown -R apache:apache /var/www/html/roundcubemail
# Set permissions
chmod -R 755 /var/www/html/roundcubemail
# Set SELinux context
chcon -t httpd_sys_rw_content_t /var/www/html/roundcubemail -R
- Create a virtualhost configuration file for
roundcubein/etc/httpd/conf.d/ - Populate the file with the following information:
<VirtualHost *:80>
ServerAdmin root@<vm_name>.sysadm.ee
ServerName mail.<vm_name>.sysadm.ee
DocumentRoot /var/www/html/roundcubemail
<Directory /var/www/html/roundcubemail>
Allowoverride all
</Directory>
ErrorLog /var/log/httpd/mail-error.log
CustomLog /var/log/httpd/mail-access.log combined
ForensicLog /var/log/httpd/mail-forensic.log
</VirtualHost>
- Restart the httpd service and ensure it restarted successfully
Now we need to make a database and a database user for roundcube:
# Generate a random password for the database
openssl rand -base64 16
# Connect to the database service
mysql -u root -p
# Now that you have entered the MariaDB command line, Set up the database with the following commands:
MariaDB [(none)]> CREATE DATABASE roundcubemail /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
MariaDB [(none)]> CREATE USER 'roundcube'@'localhost' IDENTIFIED BY '<the_random_password>';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON roundcubemail.* TO 'roundcube'@'localhost';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit;
We have reached the final step: open mail.<your_vm_name>.sysadm.ee/installer in web browser and fill in the required details:
Roundcube configuration
-
product_nameshould beWebmail - <vm_name>.sysadm.ee -
In Logging & Debugging:
- Set
log_dirto/var/log/roundcube - Also ensure the
/var/log/roundcubedirectory exists
- Set
-
In database setup:
- Set
Database typetoMySQL - Set
Database servertolocalhost - Set
Database nametoroundcubemail - Set
Database username toroundcube - Set
Database passwordto the random password you generated before
- Set
-
In IMAP settings:
- Set
imap_hosttolocalhost:143
- Set
-
In SMTP settings:
- Set
smtp_hosttolocalhost:587
- Set
-
Click on
Create config - This saves the configuration PHP file called
config.inc.phpinto/var/www/html/roundcubemail/config- Make sure the file permissions are correct
- The same output file could be used with Ansible to configure the Roundcube installation automatically
- Contiue and review the configuration on the
Test config page - If everything else besides the DB Schema is OK, you can initialize the database
- If the configuration tests are good, make sure to remove the
installerdirectory from/var/www/html/roundcubemail/
Key Files and Directories¶
| Path | Purpose |
|---|---|
| /var/www/html/roundcubemail | Website content |
| /var/www/html/roundcubemail/config | Roundcube config file |
| /etc/httpd/conf.d/ | Virtualhost configuration |
| /var/log/roundcube | Roundcube log |
Default Ports¶
| Port | Protocol | Purpose |
|---|---|---|
| 80 | TCP | HTTP access to Roundcube web interface |
| 143 | TCP | IMAP host |
| 587 | TCP | SMTP host |
Troubleshooting:
Cannot open the Roundcube webpage?
- Is HTTPD running?
systemctl status httpd(also: have you restarted the service after configuration changes?) - Is the Virtualhost configured properly?
- Does apache have access to the website files?
ls -la /var/www/html/roundcubemail
Scoring check doesn't go green?
- Make sure your webpage is named correctly: `Webmail -
.sysadm.ee
Security Considerations¶
- Using strong passwords: Consider that your Roundcubemail UI is accessible to everyone inside the University network (or VPN).
Further Reading¶
Related Documentation¶
- Concepts: Email
- SOPs: Mail Server Management