Roundcube over MySQL with SSL, plus the password plugin

guide · networking

Connecting Roundcube to a MySQL server configured for SSL.

Dependencies: Roundcube 0.9.5, PHP 5.3.7, a MySQL server configured for SSL, the PEAR module and php-mdb2-driver-mysql.

possibly outdated More than two years have passed since publication. The content may no longer hold.
01

The SSL key constant

In older versions the wrong PDO constant was used. In $ROUNDCUBE_DIR/roundcube/program/lib/Roundcube/rcube_db_mysql.php the SSL key has to map to PDO::MYSQL_ATTR_SSL_KEY:

if (!empty($dsn['key'])) {
    $result[PDO::MYSQL_ATTR_SSL_KEY] = $dsn['key'];
}

Other versions may need more changes. The relevant PDO SSL attributes are MYSQL_ATTR_SSL_CA, MYSQL_ATTR_SSL_CAPATH, MYSQL_ATTR_SSL_CERT, MYSQL_ATTR_SSL_CIPHER and MYSQL_ATTR_SSL_KEY (see the PDO MySQL reference).

02

Password plugin query

An example password_query for the Roundcube password plugin:

$rcmail_config['password_query'] = 'UPDATE virtual_users SET password=ENCRYPT(%p,concat("$6$", SUBSTRING(SHA(RAND()), -16))) WHERE email=%u LIMIT 1';

_Originally published in January 2014._

← back to explore