summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-05-12 14:15:44 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-05-12 14:16:18 +0100
commitb87c83549ddefa22ca0b1d989abcf12a6465b560 (patch)
tree91a57f3bc12d9fc864ba9ea3b63089c3d03a6b80
parent77622e6c45bd64b2a159e1b0768f44f81e9881d8 (diff)
downloadpykolab-b87c83549ddefa22ca0b1d989abcf12a6465b560.tar.gz
During setup, scratch the des_key setting for Roundcube (#715)
-rw-r--r--pykolab/setup/setup_roundcube.py12
-rw-r--r--share/templates/roundcubemail/main.inc.php.tpl2
2 files changed, 13 insertions, 1 deletions
diff --git a/pykolab/setup/setup_roundcube.py b/pykolab/setup/setup_roundcube.py
index 0077a3d..30a2aa9 100644
--- a/pykolab/setup/setup_roundcube.py
+++ b/pykolab/setup/setup_roundcube.py
@@ -18,7 +18,10 @@
#
from Cheetah.Template import Template
+import hashlib
import os
+import random
+import re
import subprocess
import sys
@@ -58,6 +61,15 @@ def execute(*args, **kw):
conf.mysql_roundcube_password = mysql_roundcube_password
rc_settings = {
+ 'des_key': re.sub(
+ r'[^a-zA-Z0-9]',
+ "",
+ "%s%s" % (
+ hashlib.md5("%s" % random.random()).digest().encode("base64"),
+ hashlib.md5("%s" % random.random()).digest().encode("base64")
+ )
+ )[:25],
+
'imap_admin_login': conf.get('cyrus-imapd', 'admin_login'),
'imap_admin_password': conf.get('cyrus-imapd', 'admin_password'),
'ldap_base_dn': conf.get('ldap', 'base_dn'),
diff --git a/share/templates/roundcubemail/main.inc.php.tpl b/share/templates/roundcubemail/main.inc.php.tpl
index 2828c9b..f8ceace 100644
--- a/share/templates/roundcubemail/main.inc.php.tpl
+++ b/share/templates/roundcubemail/main.inc.php.tpl
@@ -199,7 +199,7 @@
\$rcmail_config['default_host'] = 'tls://localhost';
\$rcmail_config['smtp_server'] = 'tls://localhost';
\$rcmail_config['session_domain'] = '';
- \$rcmail_config['des_key'] = 'aTMVSq6lNHg1YbcV6t59uGeZ';
+ \$rcmail_config['des_key'] = "$des_key";
\$rcmail_config['username_domain'] = '';
\$rcmail_config['mail_domain'] = '';