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, docrootpublic_html - PHP 8.3 with the pdo_mysql, intl, mbstring, xml, gd, zip, curl, ldap, bcmath and opcache extensions
- MariaDB with the
roundcubedatabase androundcubeapp 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 thedes_keyencryption key per instanceroundcube-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>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.6Confirm 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 -u0.0.0.0:22 0.0.0.0:80 127.0.0.1:143 127.0.0.1:25 127.0.0.1:3306Read 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.txtNote 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.
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.
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.
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_interfacesloopback-onlySecond, 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 = staticThird, 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.shOK per-VM mailbox credential authenticates end-to-end via the Roundcube web login form (-> Dovecot IMAP); blank + weak guesses rejectedPoint 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.phpChange 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-fpmYour 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 postfixTo 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.
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 INBOXThe expected output is:
/dev/sdc /data ext4 19.5G /dev/sdc[/mysql] /var/lib/mysql INBOX messages=1The 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.
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.comCertbot 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 -1HTTP/1.1 200 OKMaintenance
Roundcube's own database housekeeping runs daily through a systemd timer. Check that the timer is active:
systemctl is-active roundcube-cleandb.timerTo 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 dovecotdoveadm 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.logSign-in is rejected. Confirm that the password you are using matches the current mailbox credential:
sudo cat /root/roundcube-credentials.txtRoundcube reports an IMAP connection error. Check that Dovecot is running and that the mailbox authenticates:
sudo systemctl status dovecot --no-pager | head -5Application errors. Roundcube logs to its own tree, which nginx never serves:
sudo tail -30 /var/www/roundcube/logs/errors.logSecurity notes
- No shared or default password. The mailbox password, the database password and the
des_keyused to encrypt stored IMAP session passwords are all generated uniquely on each instance's first boot and written to/root/roundcube-credentials.txtwith mode0600. - 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-onlyand can never act as an open relay. - Loopback-only services. MariaDB, Dovecot IMAP and Postfix all listen on
127.0.0.1only. 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_installerisfalse. - Configuration outside the docroot. The web root is the
public_htmldirectory, so the configuration file that holds the database password anddes_keysits 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
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.2 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 or at Amazon SES by changing two settings. Both paths are covered below.
Read this before you plan on sending mail to the internet. This image is a complete webmail front end with a working local mailbox. It is not a ready-to-use public mail server, and no image can be.
Amazon EC2 throttles outbound TCP port 25 until you request removal. A new instance also has no reverse DNS record and no sending reputation, so mail sent directly to the internet will not be delivered reliably. Step 9 covers configuring an authenticated relay, which is the supported way to send externally.
What you get:
- Roundcube Webmail 1.7.2 from the official release, SHA-256 verified at build time, served from
/var/www/roundcube - nginx with the Roundcube vhost at
/etc/nginx/sites-available/sac-roundcube, docrootpublic_html - PHP 8.3 with the pdo_mysql, intl, mbstring, xml, gd, zip, curl, ldap, bcmath and opcache extensions
- MariaDB with the
roundcubedatabase androundcubeapp user, on the loopback only - Dovecot IMAP and LMTP with a virtual mailbox user, on the 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, the database maintenance password and thedes_keyencryption key per instanceroundcube-cleandb.timer, which runs Roundcube's own database housekeeping daily- Two dedicated EBS volumes: the MariaDB datadir at
/var/lib/mysqland the mail store at/var/vmail
Prerequisites
You need an AWS account, an EC2 key pair, and a VPC subnet with a route to the internet.
m5.large (2 vCPU, 8 GB RAM) is the recommended instance type and suits a small team. For heavier mailbox usage, move up to a larger size.
Open ports 80 and 443 in the 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 the loopback interface and will not answer on those ports anyway.
Deploy and connect
Launch the image from AWS Marketplace, then connect to the instance over SSH. The login user depends on the AMI variant you launched:
- OS variant: Ubuntu 24.04
- SSH login user: ubuntu
- Connect with: ssh -i your-key.pem ubuntu@<public-ip>
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.6Confirm 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 -u0.0.0.0:22 0.0.0.0:80 127.0.0.1:143 127.0.0.1:25 127.0.0.1:3306 127.0.0.53%lo:53 127.0.0.54:53 [::]:22 [::]:80Read the first-boot credentials
On the first boot of your instance, a one-shot service generates a fresh mailbox password, a fresh database password, a fresh database maintenance 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.
The credentials file holds real secrets, so read only the value you need rather than printing the whole file. List the keys it contains:
sudo grep -oE '^[a-z.]+=' /root/roundcube-credentials.txtroundcube.url= roundcube.mail.user= roundcube.mail.pass= roundcube.mail.address= roundcube.db.name= roundcube.db.user= roundcube.db.pass=When you are ready to sign in, read the mailbox username and then the mailbox password:
sudo grep '^roundcube.mail.user=' /root/roundcube-credentials.txt | cut -d= -f2-webmailsudo grep '^roundcube.mail.pass=' /root/roundcube-credentials.txt | cut -d= -f2-<ROUNDCUBE_MAIL_PASSWORD>Sign in to webmail
Browse to http://<public-ip>/ and sign in with the webmail user and the password from Step 3.
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 instance, the outbound mail position, and how to repoint Roundcube at your own mail server.
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.
The bundled Postfix is loopback-only and has no relay configured. Mail addressed to the local mailbox is delivered straight back into Dovecot, which is a quick way to verify the stack end to end. Mail addressed to an external recipient will not be delivered until you configure a relay, which is Step 9.
Set your display name and signature under Settings, then Identities.
Confirm the security posture
The image ships no known credential and exposes no mail service to the network. You can verify each property yourself.
First, the MTA accepts connections only from the instance itself, trusts only the loopback network, and ends its relay rules with reject_unauth_destination:
sudo postconf -h inet_interfaces
sudo postconf -h mynetworks
sudo postconf -h smtpd_relay_restrictionsloopback-only 127.0.0.0/8 permit_mynetworks, reject_unauth_destinationThis is what makes it impossible to use this instance as an open relay. An open relay is an MTA that accepts mail from arbitrary remote clients, and nothing remote can reach this one.
Prove it by trying to open the SMTP port on the instance's own private address. The connection is refused, while the loopback answers:
PRIV=$(hostname -I | awk '{print $1}') timeout 5 bash -c "exec 3<>/dev/tcp/${PRIV}/25" && echo "REACHABLE - unexpected" || echo "refused on ${PRIV}:25 as expected" timeout 5 bash -c 'exec 3<>/dev/tcp/127.0.0.1/25; head -1 <&3'refused on 172.31.83.124:25 as expected 220 localhost.localdomain ESMTPSecond, 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 = staticThird, 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.shOK per-instance mailbox credential authenticates end-to-end via the Roundcube web login form (-> Dovecot IMAP); blank + weak guesses rejectedVerify the data volumes
The MariaDB datadir and the Dovecot mail store are on separate EBS volumes, both mounted by filesystem UUID. Your mail and your preferences are therefore kept off the operating system disk and can be snapshotted and resized independently. Mail grows without bound, which is why it gets its own volume.
Verify the mounts:
findmnt -no SOURCE,TARGET,FSTYPE,SIZE /var/lib/mysql
findmnt -no SOURCE,TARGET,FSTYPE,SIZE /var/vmail
sudo doveadm mailbox status -u webmail messages INBOXThe expected output is:
/dev/nvme1n1 /var/lib/mysql ext4 19.5G /dev/nvme2n1 /var/vmail ext4 29.4G INBOX messages=1To grow either tier, modify the EBS volume in the AWS console, then extend the filesystem in place with sudo resize2fs <device>. Neither operation needs downtime.
The health endpoint
nginx serves an unauthenticated static health endpoint suitable for an Application Load Balancer or Network Load Balancer target group health check. Check it:
curl -sI http://127.0.0.1/healthz | head -1HTTP/1.1 200 OKSending mail to the internet
This is the step most deployments need, so read it carefully.
Why the default does not send externally. Three separate things stand in the way, and none of them is something an AMI can fix for you:
- Port 25 is throttled. AWS rate-limits outbound TCP port 25 from EC2 by default. You remove that limit by submitting the Request to remove email sending limitations form from the AWS Support Center, which also lets you associate a reverse DNS record with the instance's Elastic IP.
- No reverse DNS and no reputation. A brand-new EC2 address has no PTR record and no sending history. Most large receivers reject or junk mail from such addresses regardless of port 25 access.
- No SPF or DKIM. Without published SPF and DKIM records that authorise your sender, receivers cannot verify that the mail is really from your domain.
The supported approach is an authenticated relay. Amazon SES is the usual choice on AWS. It handles reputation, DKIM signing and deliverability reporting, and it accepts submissions on port 587, which is not throttled.
To set it up, create SES SMTP credentials in the SES console, verify your sending domain, and publish the SPF and DKIM records that SES gives you. Then point Postfix at SES as a smarthost, using your SES SMTP credentials and the SES endpoint for your region. SecureAnyCloud support will walk you through the Postfix relayhost and SASL configuration for your account and region.
Alternatively, do not send from this instance at all. If your users already have mailboxes on a corporate mail server, Step 10 repoints Roundcube at it, and outbound mail leaves through that server instead. For many deployments, that is the simplest answer.
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 file, /var/www/roundcube/config/config.inc.php:
- IMAP server: $config['imap_host']
- SMTP server: $config['smtp_host']
Open the file with your editor of choice and set them 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 set the SMTP overrides. These make Roundcube authenticate as the signed-in user rather than as the loopback:
$config['smtp_user'] = '%u'; $config['smtp_pass'] = '%p';Then reload PHP:
sudo systemctl reload php8.3-fpmYour 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.
If you would rather turn them off once you no longer need the bundled mailbox, run sudo systemctl disable --now dovecot postfix. This stops local delivery, so the bundled webmail mailbox and the credential round-trip check in Step 6 no longer work afterwards.
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.comCertbot 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;Maintenance
Roundcube's own database housekeeping runs daily through a systemd timer. Check that the timer is active:
systemctl is-active roundcube-cleandb.timeractiveTo add another mailbox to the bundled Dovecot server, append a user to the passwd file and create its maildir. doveadm pw prompts interactively for the new password and stores only its SHA512-CRYPT hash, so no password is ever typed on the command line. Run these three commands in an interactive shell:
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 /var/vmail/alice
sudo systemctl reload dovecotOn-box database maintenance runs as the MariaDB root user over the Unix socket, with no password:
sudo mariadb -e 'SELECT COUNT(*) AS roundcube_tables FROM information_schema.tables WHERE table_schema="roundcube";'roundcube_tables 18Troubleshooting
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 is-active roundcube-firstboot.serviceactivesudo tail -20 /var/log/roundcube-firstboot.logSign-in is rejected. Confirm that the password you are using matches the current mailbox credential, and that Dovecot agrees:
sudo bash /usr/local/sbin/roundcube-cred-roundtrip.shRoundcube reports an IMAP connection error. Check that Dovecot is running:
systemctl is-active dovecotactiveA composed message never arrives at an external address. That is expected until you complete Step 9. Inspect the mail queue to confirm what happened:
sudo postqueue -pApplication errors. Roundcube logs to its own tree, which nginx never serves:
sudo tail -30 /var/www/roundcube/logs/errors.logSecurity notes
- No shared or default password. The mailbox password, the Roundcube database password, the MariaDB maintenance password in
/etc/mysql/debian.cnfand thedes_keyused to encrypt stored IMAP session passwords are all generated uniquely on each instance's first boot. The mailbox and database values are written to/root/roundcube-credentials.txtwith mode0600. - 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-onlywithmynetworksrestricted to127.0.0.0/8, so it can never act as an open relay. - Loopback-only services. MariaDB, Dovecot IMAP and Postfix all listen on
127.0.0.1only. Never open 25, 143, 993 or 3306 in the security group. - No web installer. Roundcube's web installer is removed from the image, and
enable_installerisfalse. - Configuration outside the docroot. The web root is the
public_htmldirectory, so the configuration file that holds the database password anddes_keysits 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 relay and Amazon SES setup, SPF and DKIM and deliverability troubleshooting, TLS certificate installation, plugin and skin configuration, address book and LDAP integration, upgrades and MariaDB administration.
Email sales@secureanycloud.com.
Deploy on AWS
Launch Roundcube Webmail with 24/7 support from SecureAnyCloud.
View on Marketplace
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com