Skip to content

Commit 6e2c807

Browse files
authored
Merge pull request hestiacp#651 from cmstew/roundcube-security-fix
Fixed a security issue with roundcube.
2 parents 93eb420 + 32939e2 commit 6e2c807

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

install/deb/roundcube/main.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@
266266
// this key is used to encrypt the users imap password which is stored
267267
// in the session record (and the client cookie if remember password is enabled).
268268
// please provide a string of exactly 24 chars.
269-
$rcmail_config['des_key'] = 'vtIOjLZo9kffJoqzpSbm5r1r';
269+
$rcmail_config['des_key'] = '%des_key%';
270270

271271
// Automatically add this domain to user names for login
272272
// Only for IMAP servers that require full e-mail addresses for login

install/hst-install-debian.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,10 +1538,12 @@ if [ "$dovecot" = 'yes' ] && [ "$exim" = 'yes' ] && [ "$mysql" = 'yes' ]; then
15381538
chown www-data:adm /var/log/roundcube/errors
15391539

15401540
r="$(gen_pass)"
1541+
rcDesKey="$(openssl rand -base64 30 | tr -d "/" | cut -c1-24)"
15411542
mysql -e "CREATE DATABASE roundcube"
15421543
mysql -e "GRANT ALL ON roundcube.*
15431544
TO roundcube@localhost IDENTIFIED BY '$r'"
15441545
sed -i "s/%password%/$r/g" /etc/roundcube/debian-db-roundcube.php
1546+
sed -i "s/%des_key%/$rcDesKey/g" /etc/roundcube/config.inc.php
15451547
sed -i "s/localhost/$servername/g" /etc/roundcube/plugins/password/config.inc.php
15461548
mysql roundcube < /usr/share/dbconfig-common/data/roundcube/install/mysql
15471549

install/hst-install-ubuntu.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,10 +1487,12 @@ if [ "$dovecot" = 'yes' ] && [ "$exim" = 'yes' ] && [ "$mysql" = 'yes' ]; then
14871487
chown www-data:adm /var/log/roundcube/errors
14881488

14891489
r="$(gen_pass)"
1490+
rcDesKey="$(openssl rand -base64 30 | tr -d "/" | cut -c1-24)"
14901491
mysql -e "CREATE DATABASE roundcube"
14911492
mysql -e "GRANT ALL ON roundcube.*
14921493
TO roundcube@localhost IDENTIFIED BY '$r'"
14931494
sed -i "s/%password%/$r/g" /etc/roundcube/debian-db-roundcube.php
1495+
sed -i "s/%des_key%/$rcDesKey/g" /etc/roundcube/config.inc.php
14941496
sed -i "s/localhost/$servername/g" /etc/roundcube/plugins/password/config.inc.php
14951497
mysql roundcube < /usr/share/dbconfig-common/data/roundcube/install/mysql
14961498

install/upgrade/versions/latest.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,9 @@ if [ -z "$GZIP_LVL_CHECK" ]; then
113113
echo "(*) Updating backup compression level variable..."
114114
$BIN/v-change-sys-config-value "BACKUP_GZIP" '9'
115115
fi
116+
117+
# Randomize Rouncube des_key for better security
118+
if [ -f "/etc/roundcube/config.inc.php" ]; then
119+
rcDesKey="$(openssl rand -base64 30 | tr -d "/" | cut -c1-24)"
120+
sed -i "s/vtIOjLZo9kffJoqzpSbm5r1r/$rcDesKey/g" /etc/roundcube/config.inc.php
121+
fi

0 commit comments

Comments
 (0)