Deployment guide

Roundcube

Overview

Roundcube is the widely used open-source, browser-based IMAP mail client. It gives users folder management, threaded conversations, a rich-text composer, a searchable address book and a responsive interface that works from desktop to phone.

The SecureAnyCloud image installs Roundcube 1.7 from the official release, fronted by nginx with PHP 8.3 and backed by a local MariaDB for preferences and contacts. Everything comes from the Ubuntu 24.04 noble archive, with no third-party APT repositories.

Roundcube is a mail client, not a mail store, so a bare Roundcube install has nothing to sign in to. This image therefore also bundles a Dovecot IMAP server that holds a real mailbox and a loopback-only Postfix mail transfer agent, so you can sign in, read and compose the moment the instance boots. You can keep that bundled mailbox, or repoint Roundcube at your own corporate mail server by changing two settings. Both paths are covered below.

What you get:

  • Roundcube Webmail 1.7.2 from the official release, served from /var/www/roundcube
  • nginx with the Roundcube vhost at /etc/nginx/sites-available/sac-roundcube, docroot public_html
  • PHP 8.3 with the pdo_mysql, intl, mbstring, xml, gd, zip, curl, ldap, bcmath and opcache extensions
  • MariaDB with the roundcube database and roundcube app user, on loopback only
  • Dovecot IMAP and LMTP with a virtual mailbox user, on loopback only
  • Postfix bound to loopback-only, delivering into Dovecot over LMTP, and never an open relay
  • roundcube-firstboot.service, which rotates the mailbox password, the database password and the des_key encryption key per instance
  • roundcube-cleandb.timer, which runs Roundcube's own database housekeeping daily
  • The MariaDB database and the Dovecot maildir on a dedicated Azure data disk mounted at /data
  • nginx, php8.3-fpm, mariadb, dovecot and postfix enabled and starting automatically on boot
  • 24/7 SecureAnyCloud support

Prerequisites

You need an active Azure subscription, an SSH key, and a VNet with a subnet.

Standard_B2s (2 vCPU, 4 GB RAM) suits a small team. For heavier mailbox usage, move up to a larger burstable or a D-series size.

Open ports 80 and 443 on the network security group, plus 22 for SSH from your management address. Do not open 25, 143, 993 or 3306. The mail and database services are deliberately bound to loopback.

Step 1 to 3: Deploy and connect

Deploy the image from the Azure Marketplace, then connect to the VM over SSH:

ssh azureuser@<vm-ip>
4

Verify the services

Five services make up the appliance. All five should report active:

sudo systemctl is-active nginx php8.3-fpm mariadb dovecot postfix php -r 'echo "php ".PHP_VERSION."\n";'

The expected output is:

active active active active active php 8.3.6

Confirm what is actually listening. Only SSH (22) and HTTP (80) are exposed. IMAP (143), SMTP (25) and MariaDB (3306) are all bound to 127.0.0.1:

sudo ss -tlnH | awk '{print $4}' | sort -u
0.0.0.0:22 0.0.0.0:80 127.0.0.1:143 127.0.0.1:25 127.0.0.1:3306
5

Read the first-boot credentials

On the first boot of your instance, a one-shot service generates a fresh mailbox password, a fresh database password and a fresh des_key encryption key, all unique to that instance, and writes them to a root-only file. No SecureAnyCloud image ships a shared or default password.

Print the file:

sudo cat /root/roundcube-credentials.txt

Note the roundcube.mail.user (webmail) and the roundcube.mail.pass value. Together they are your webmail sign-in. The passwords are unique on every instance.

6

Sign in to webmail

Browse to http://<vm-ip>/ and sign in with the webmail user and the password from Step 5.

After you sign in, you land in the inbox. The folder list (Inbox, Drafts, Sent, Junk, Trash, Archive) is created automatically, and a getting-started message from SecureAnyCloud is waiting for you.

Open the message to read it in the reading pane. It summarises what is running on the VM and how to repoint Roundcube at your own mail server.

7

Compose a message

Choose Compose to open the composer. The From identity is already set to the bundled mailbox, and attachments up to 64 MB are allowed.

Because the bundled Postfix is loopback-only, mail addressed to the local mailbox is delivered straight back into Dovecot, which is useful for verifying the stack end to end. Sending to external recipients requires an outbound relay, which is covered in Step 9.

Set your display name and signature under Settings, then Identities.

8

Confirm the security posture

The image ships no known credential and exposes no mail service to the network. You can verify all three properties yourself.

First, the MTA accepts connections only from the VM itself:

sudo postconf -h inet_interfaces
loopback-only

Second, IMAP authentication is restricted to the virtual mailbox user. Dovecot's system and PAM authentication is disabled, so operating system accounts cannot sign in to webmail:

sudo doveconf -n | grep -E 'driver =' | sed 's/^ *//'
driver = passwd-file driver = static

Third, the per-instance mailbox credential authenticates end to end, through the real Roundcube login form into Dovecot IMAP, while blank and weak guesses are rejected:

sudo bash /usr/local/sbin/roundcube-cred-roundtrip.sh
OK per-VM mailbox credential authenticates end-to-end via the Roundcube web login form (-> Dovecot IMAP); blank + weak guesses rejected
9

Point Roundcube at your own mail server

Roundcube speaks standard IMAP and SMTP, so it can front any compliant mail server. Edit two settings in the Roundcube configuration:

sudo nano /var/www/roundcube/config/config.inc.php

Change imap_host and smtp_host to your own servers, for example:

$config['imap_host'] = 'ssl://imap.example.com:993'; $config['smtp_host'] = 'tls://smtp.example.com:587';

Roundcube signs users in against that server with the credentials they type, so also clear the loopback SMTP overrides. This makes Roundcube authenticate as the signed-in user:

$config['smtp_user'] = '%u'; $config['smtp_pass'] = '%p';

Then reload PHP:

sudo systemctl reload php8.3-fpm

Your users now sign in with their corporate mailbox credentials. You can leave the bundled Dovecot and Postfix running, because they are loopback-only and harmless, or disable them:

sudo systemctl disable --now dovecot postfix

To keep the bundled mailbox but relay outbound mail through an authenticated smarthost instead, configure Postfix's relayhost and SASL credentials rather than changing smtp_host. Contact SecureAnyCloud support and we will walk you through it.

10

Verify the data disk

Both the MariaDB datadir and the Dovecot maildir live on a dedicated 20 GiB data disk. Your mail and preferences are therefore kept off the operating system disk and can be snapshotted and resized independently. Verify the mounts:

findmnt -no SOURCE,TARGET,FSTYPE,SIZE /data
findmnt -no SOURCE,TARGET /var/lib/mysql
sudo doveadm mailbox status -u webmail messages INBOX

The expected output is:

/dev/sdc /data ext4 19.5G /dev/sdc[/mysql] /var/lib/mysql INBOX messages=1

The MariaDB datadir is a bind mount from /data/mysql onto the canonical /var/lib/mysql path. This keeps AppArmor's default profile valid while still placing the data on the dedicated disk. Mailboxes live under /data/vmail.

11

Enable HTTPS

The image serves HTTP on port 80, so it works immediately on a bare IP. To serve webmail over HTTPS, point a DNS record at the instance and issue a certificate:

sudo apt-get update && sudo apt-get install -y certbot python3-certbot-nginx
sudo certbot --nginx -d mail.your-domain.com

Certbot rewrites the nginx vhost and installs a renewal timer. After you enable HTTPS, tell Roundcube to issue secure cookies by adding this to /var/www/roundcube/config/config.inc.php:

$config['use_https'] = true;

Health endpoint

nginx serves an unauthenticated static health endpoint for Azure Load Balancer probes. Check it:

curl -sI http://127.0.0.1/healthz | head -1
HTTP/1.1 200 OK

Maintenance

Roundcube's own database housekeeping runs daily through a systemd timer. Check that the timer is active:

systemctl is-active roundcube-cleandb.timer

To add another mailbox to the bundled Dovecot server, append a user to the passwd file and create its maildir:

sudo sh -c 'printf "%s:%s\n" alice "$(doveadm pw -s SHA512-CRYPT)" >> /etc/dovecot/sac-users'
sudo install -d -o vmail -g vmail -m 0700 /data/vmail/alice
sudo systemctl reload dovecot

doveadm pw prompts for the new password and stores only its SHA512-CRYPT hash.

Troubleshooting

The sign-in page returns a database error. The first-boot service rotates the database password and the Roundcube configuration together. Check that it completed:

systemctl status roundcube-firstboot.service --no-pager sudo tail -20 /var/log/roundcube-firstboot.log

Sign-in is rejected. Confirm that the password you are using matches the current mailbox credential:

sudo cat /root/roundcube-credentials.txt

Roundcube reports an IMAP connection error. Check that Dovecot is running and that the mailbox authenticates:

sudo systemctl status dovecot --no-pager | head -5

Application errors. Roundcube logs to its own tree, which nginx never serves:

sudo tail -30 /var/www/roundcube/logs/errors.log

Security notes

  • No shared or default password. The mailbox password, the database password and the des_key used to encrypt stored IMAP session passwords are all generated uniquely on each instance's first boot and written to /root/roundcube-credentials.txt with mode 0600.
  • Virtual mailbox users only. Dovecot's system and PAM authentication is disabled, so only the virtual mailbox user can sign in. Operating system accounts cannot access webmail.
  • No open relay. Postfix is bound to loopback-only and can never act as an open relay.
  • Loopback-only services. MariaDB, Dovecot IMAP and Postfix all listen on 127.0.0.1 only. Never open 25, 143, 993 or 3306 on the network security group.
  • No web installer. Roundcube's web installer is removed from the image, and enable_installer is false.
  • Configuration outside the docroot. The web root is the public_html directory, so the configuration file that holds the database password and des_key sits outside the docroot entirely, and nginx additionally denies it.
  • Patching. Keep the instance patched with sudo apt-get update && sudo apt-get upgrade. Unattended security upgrades are enabled by default.

Support

SecureAnyCloud provides 24/7 technical support for this Roundcube image, including deployment guidance, connecting to external IMAP and SMTP servers, authenticated smarthost and relay setup, TLS certificate installation, plugin and skin configuration, address book and LDAP integration, upgrades and MariaDB administration. Critical issues receive a one-hour average response time.

Email sales@secureanycloud.com.

Deploy on Azure

Launch Roundcube 1.7 Webmail on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.

View this image

Need Help?

Our support team is available 24/7.

sales@secureanycloud.com

Deploy on Azure