Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk10 min

How to Secure Roundcube Webmail on Ubuntu (2026 Hardening Guide)

Harden Roundcube on Ubuntu with a release-aware update plan, a locked-down public directory, HTTPS and HSTS guidance, protected PHP logs, strict IMAP/SMTP TLS validation, and tested Fail2ban rules.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Secure Roundcube by treating it as a public web application and an authentication gateway: patch Ubuntu and Roundcube, publish only the public_html directory over HTTPS, keep PHP errors and private directories out of the browser, preserve TLS certificate validation for mail connections, and use Fail2ban to slow repeated login attacks.

The exact package command depends on your Ubuntu release and whether Roundcube came from Ubuntu packages or an upstream archive. The following procedure keeps those differences explicit so you can verify versions before changing a production server.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

1. Define the security boundary before changing anything

Roundcube is not the mail server. It is a PHP web application that talks to IMAP, SMTP and, optionally, ManageSieve. A compromise can expose mailbox credentials, sessions, address books and message content, while a weak mail-server TLS setting can expose credentials even when the browser connection is encrypted. Harden all three paths: browser to web server, web server to Roundcube, and Roundcube to the mail services.

Record the current deployment

  • Identify the Ubuntu release with cat /etc/os-release and note whether it is an LTS release, an interim release or an end-of-support system.
  • Find the installed package and version with apt policy roundcube-core. An upstream installation may not appear in APT; record its filesystem location and release number separately.
  • Record the web server (Apache or Nginx), PHP version and PHP-FPM service, the actual Roundcube errors.log path, and the IMAP, SMTP and ManageSieve hostnames.
  • Back up Roundcube configuration, its database and mail-server settings. Test that the backup can be restored before editing access controls.

Do not copy a command for one Ubuntu release onto another. Corrected package versions, repository availability and Ubuntu Pro coverage differ by release.

#1 Best Overall
BookFactory Security Pass Down Log Book, Wire-O, 100 Pages
  • Made in USA - Proudly produced in Ohio by a Veteran-owned business
  • Comprehensive Coverage: This BookFactory log book includes essential fields such as post/shift, time of change, date, weather conditions, and a designated space for detailed notes. This ensures that all relevant information is captured and easily accessible.
  • Sturdy Cover: The trans-lux cover protects the log book from wear and tear, ensuring its longevity and maintaining the integrity of your recorded data.
  • Essential Security Tool: This log book is an indispensable tool for any organization that values security and accountability. It helps to prevent misunderstandings, improve communication, and ensure a smooth transition between shifts.
  • Wire-O with Trans-lux cover, 100 Pages, Dimensions 8.5" x 11" - (Security-Pass-Down) Reorder SKU: LOG-100-7CW-PP(Security-Pass-Down)

2. Patch Ubuntu and Roundcube continuously

Roundcube published security releases 1.6.19 and 1.7.4 on 6 September 2026. The Roundcube Project said both versions fixed recently reported security vulnerabilities. Treat that date as a release milestone, not as permission to stop updating: later fixes can supersede them.

Use Ubuntu packages where they fit your deployment

  1. Refresh package metadata: sudo apt update.
  2. Review pending security upgrades rather than blindly accepting every change: apt list --upgradable and apt policy roundcube-core.
  3. Apply the tested changes during a maintenance window: sudo apt upgrade. If the resolver requires dependency changes, review the transaction before using sudo apt full-upgrade.
  4. Confirm the resulting package: dpkg-query -W -f='${Package} ${Version}n' roundcube-core.
  5. Restart only the services that changed, then test login, reading mail, sending mail and logout. A PHP or web-server update may require a PHP-FPM or web-server restart.

Canonical describes Ubuntu as a fixed-release distribution whose supported releases receive security fixes as backported patches. Since Ubuntu 18.04 LTS, unattended-upgrades has been included in default Desktop and Server installations and applies security updates daily by default. Verify that it is enabled instead of assuming it is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo systemctl status unattended-upgrades
sudo unattended-upgrade --dry-run --debug

Automatic updates do not replace review. Subscribe to Ubuntu Security Notices, inspect held packages, and schedule a monthly verification that the installed Roundcube version is still supported.

Check release-specific advisories

USN-8097-1 lists corrected Roundcube packages by Ubuntu release. One listed example is Ubuntu 24.04’s roundcube-core 1.6.6+dfsg-2ubuntu0.1+esm2; several corrected builds are available through Ubuntu Pro. That value is advisory evidence, not a universal target. Check the live notice and your release’s package candidate before making a change:

Rank #2
BookFactory Security Incident Report Log Book, Wire-O, 100 Pages
  • Made in USA - Proudly produced in Ohio by a Veteran-owned business
  • This BookFactory log book is for security guards in any sector or business. You can report location, circumstances and report number.
  • There are spaces to log the individual's names address, description and other identifying information. There are also spaces to note others involved, notes, and vehicle information if one was involved
  • Wire-O, 100 Pages, Dimensions 3.5" x 5.25"
  • Reorder SKU: LOG-100-M3CW-PP(Security-Report)
apt-cache policy roundcube-core
apt changelog roundcube-core

Ubuntu LTS releases receive five years of standard security maintenance for the Main and Restricted components. Longer coverage requires Ubuntu Pro according to Canonical’s support table. An unsupported Ubuntu release should be upgraded; extending an exposed webmail host with an unmaintained operating system is not a hardening strategy.

3. Publish only Roundcube’s intended public directory

The upstream installation guide requires the HTTP server’s document root to point to Roundcube’s public_html directory. This prevents configuration files, SQL schema files, logs and temporary data from being downloaded if a web-server rule is missed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Verify the filesystem layout

  1. Locate the Roundcube tree and identify its public_html, config, logs and temp directories.
  2. Set the virtual host’s document root to public_html, not the parent directory.
  3. Remove or disable the installer after setup. If an installer endpoint is still present, restrict it to an administrative network or delete it according to the package’s upgrade procedure.
  4. Make application files owned by root or the package manager where practical. Grant the web-server user write access only to the required logs and temp directories.
  5. Check the effective web-server configuration and test that requests for configuration files, database dumps, logs and temporary files return a denial or a not-found response.

Do not solve a permissions problem by making the entire Roundcube tree writable by the web-server user. That turns a web vulnerability into an application-wide file-modification capability.

4. Force HTTPS safely

Serve the login page and every authenticated request over HTTPS. Configure the HTTP virtual host to redirect to the canonical HTTPS hostname, then test that no alternate hostname, port or subdomain still serves a login form without TLS.

Apache and Nginx choice

Decision factor Apache Nginx
Best fit Existing Apache stack and teams comfortable with virtual-host and module configuration Existing Nginx stack, especially where PHP-FPM is already standard
PHP integration Use the selected PHP handler; avoid exposing source files when changing handlers Pass only PHP requests to PHP-FPM and deny direct access to hidden or private paths
TLS automation Use the ACME-capable automation already approved for the host Use the ACME-capable automation already approved for the host
Logging Review access and error logs alongside Roundcube’s application log Review access and error logs alongside Roundcube’s application log

The important control is not the server brand. It is a valid certificate, a complete trust chain, a private key readable only by the TLS service, and a redirect that covers every HTTP entry point.

Add HSTS only after TLS is complete

HSTS tells browsers to refuse HTTP. Enable it only after every required hostname and subdomain works over TLS, certificates renew automatically, and no legitimate service depends on HTTP. A mistaken HSTS policy can lock administrators out until the browser policy expires or is cleared.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

5. Keep PHP diagnostics from becoming an information leak

Roundcube’s installation guide states that it forces display_errors=Off and log_errors=On. Preserve that behavior in the effective PHP configuration and confirm it after PHP upgrades. Browser-visible warnings can disclose filesystem paths, SQL details, usernames and mail-server names.

Protect logs and temporary data

  • Keep errors.log outside the public document root, or explicitly deny direct web access if the package stores it beneath the application tree.
  • Allow the web-server user to write the logs and temp directories, but do not grant write access to configuration or code directories.
  • Set restrictive permissions on logs because they can contain usernames, IP addresses and authentication-failure details.
  • Rotate logs and monitor disk usage. A full filesystem can break both login and security logging.
  • Check that PHP-FPM and the web server send errors to controlled logs rather than to the response body.

After changing PHP or the web server, deliberately request a harmless missing page and inspect the response and logs. The browser should receive a generic error; diagnostic detail should appear only in protected logs.

6. Preserve certificate validation for IMAP, SMTP and ManageSieve

Roundcube’s documentation says PHP validates SSL certificates by default. A self-signed certificate or a certificate whose name does not match the configured host produces a connection error. That error is a configuration problem, not a reason to disable verification.

Fix the cause of a TLS failure

  1. Use the mail service’s DNS name that appears in its certificate’s Subject Alternative Name.
  2. Install the issuing CA chain on Ubuntu when an organization uses a private but trusted CA.
  3. Renew expired certificates and correct incomplete intermediate-chain delivery on the IMAP or SMTP service.
  4. Check system time; a badly skewed clock can make a valid certificate appear expired or not-yet-valid.
  5. Confirm that the configured port and encryption mode match the service (implicit TLS versus STARTTLS).

Roundcube exposes correctly scoped connection settings through imap_conn_options, smtp_conn_options and managesieve_conn_options. Use those settings to express the required hostname, CA or transport options for the specific service. Do not set a global option that accepts any certificate, and do not use a blanket “no verification” workaround in production.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

7. Stop repeated login attacks with Fail2ban

Ubuntu publishes roundcube-plugin-fail2ban in the Universe repository. It depends on roundcube-core and recommends fail2ban; the package is intended to ban hosts that cause multiple authentication errors.

Install and connect the integration

  1. Enable the repository approved for your Ubuntu release, then install the packages: sudo apt update followed by sudo apt install roundcube-plugin-fail2ban fail2ban.
  2. Find the actual Roundcube error log. Common package layouts differ, so do not assume a path. Confirm that failed authentication events are written there.
  3. Enable the supplied roundcube-auth jail in a local Fail2ban configuration file rather than editing the vendor’s jail.conf.
  4. Set logpath to the real errors.log, list the HTTP and HTTPS ports used by the site, and choose conservative retry and ban intervals.
  5. Validate the configuration, restart Fail2ban and inspect its status.
sudo fail2ban-client -t
sudo systemctl restart fail2ban
sudo fail2ban-client status roundcube-auth

Fail2ban’s upstream configuration includes a [roundcube-auth] jail with HTTP/HTTPS ports, and its dedicated filter parses Roundcube authentication events. Names and paths can differ between package revisions, so inspect the installed filter and jail files before enabling them.

Choose thresholds deliberately

Setting Stronger protection Lower false-positive risk
maxretry Fewer failed attempts before a ban More failed attempts allowed
findtime Short window catches rapid guessing Longer window can reduce accidental bans when paired with a higher retry count
bantime Longer block frustrates persistent attacks Shorter block eases recovery from a mistaken ban
Operational visibility Review bans, unbans and matched log lines frequently At minimum, alert on repeated bans and authentication spikes

Start with a staging account, not a production administrator. Generate a controlled failed-login sequence, confirm the filter matches the event, verify that the expected address is banned, then unban it. Exclude trusted monitoring or administrative source addresses only when you can protect those networks by other means; broad exclusions create an attacker bypass.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

8. Package-managed versus upstream Roundcube

Consideration Ubuntu package Upstream installation
Update cadence Integrated with Ubuntu security maintenance and release-specific advisories Tracks Roundcube releases directly; administrators must monitor and deploy them
Filesystem layout Follows Debian/Ubuntu conventions and package ownership Layout is chosen during installation; document-root and writable-directory mistakes are easier to make
Rollback Use package history, snapshots and database backups Keep the previous application tree and database-compatible backup before replacing files
Ubuntu Pro Some corrected builds may be available through Pro, depending on release Pro does not patch an independently installed upstream tree

Neither method is automatically safer. Choose the one your team can patch, monitor and roll back reliably. Do not mix package-managed files with an independently copied application tree without documenting ownership and upgrade order.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

9. Test the finished hardening

  • Browser transport: HTTP redirects to HTTPS; the certificate name, validity period and chain are correct; authenticated pages never load over HTTP.
  • Exposure: Only public_html is reachable; installer, configuration, logs and temporary files are denied.
  • Diagnostics: PHP errors are not displayed; Roundcube errors are logged; log permissions prevent public reading.
  • Mail TLS: IMAP, SMTP and ManageSieve connections validate certificates and use the expected hostnames and ports.
  • Brute-force control: The Fail2ban filter matches a real failed login, applies a ban at the configured threshold and records the event.
  • Recovery: An authorized administrator can remove a mistaken ban, restore configuration and roll back a failed package update.

10. Troubleshooting common failures

Symptom Likely cause Safe corrective action
APT shows no Roundcube security update Wrong Ubuntu release, stale metadata, held package or upstream installation Check /etc/os-release, run apt update, inspect apt policy and identify the installation source before changing repositories
Roundcube displays a PHP warning Effective PHP configuration overrides the application’s setting Check PHP-FPM and web-server configuration, restore display_errors=Off, keep log_errors=On, then restart the affected service
Users cannot log in after TLS hardening Mail certificate hostname, CA chain, clock or encryption mode is wrong Fix the certificate or hostname and use the scoped connection options; do not disable verification
Fail2ban never bans Wrong log path, filter mismatch, unreadable log or inactive jail Use fail2ban-client status roundcube-auth, inspect matched lines and correct logpath or the installed filter
Legitimate users are banned Thresholds are too aggressive or a shared NAT address is generating failures Unban the address, raise the retry threshold or adjust the window, and monitor before tightening again
Renewed certificate still fails in browsers Incomplete chain, wrong virtual host or stale service configuration Verify the served certificate on the canonical hostname and reload the web server after renewal

11. A maintenance schedule that keeps the controls working

Every day

  • Let unattended security upgrades run and alert on failures.
  • Watch web-server, Roundcube and Fail2ban logs for authentication spikes, unusual status codes and repeated bans.

Every month

  • Review Ubuntu and Roundcube advisories, installed versions and held packages.
  • Test a backup restore and confirm that log rotation has not stopped security logging.
  • Check certificate expiry, renewal automation and all hostnames covered by HSTS.

After every upgrade

  • Verify the effective document root, PHP error settings, writable-directory permissions and Fail2ban jail status.
  • Perform a complete browser login, IMAP read, SMTP send and logout test.
  • Record the package version, configuration change and rollback point.

The Bottom Line

A secure Roundcube deployment is maintained, not merely configured once: keep Ubuntu and Roundcube patched, expose only public_html over correctly validated HTTPS, protect logs and temporary files, retain certificate verification for mail protocols, and continuously test the Fail2ban and recovery paths.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.