summary refs log tree commit diff
path: root/synapse/config
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2019-01-10 12:58:33 +0000
committerRichard van der Hoff <richard@matrix.org>2019-01-10 12:58:33 +0000
commitaa70d2412570d6d810fe8c0a625a41584c99b7d2 (patch)
treef3c8f54409fe6ecd3a6cb25a9f1a8aeeaf84596f /synapse/config
parentClarify that py2 packages will continue to exist (diff)
parentFix macaroon_secret_key fallback logic (diff)
downloadsynapse-aa70d2412570d6d810fe8c0a625a41584c99b7d2.tar.xz
Merge branch 'rav/macaroon_key_fix' into rav/macaroon_key_fix_0.34
Diffstat (limited to 'synapse/config')
-rw-r--r--synapse/config/key.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/synapse/config/key.py b/synapse/config/key.py
index 279c47bb48..c26b7529f2 100644
--- a/synapse/config/key.py
+++ b/synapse/config/key.py
@@ -57,8 +57,8 @@ class KeyConfig(Config):
             # Unfortunately, there are people out there that don't have this
             # set. Lets just be "nice" and derive one from their secret key.
             logger.warn("Config is missing missing macaroon_secret_key")
-            seed = self.signing_key[0].seed
-            self.macaroon_secret_key = hashlib.sha256(seed)
+            seed = bytes(self.signing_key[0])
+            self.macaroon_secret_key = hashlib.sha256(seed).digest()
 
         self.expire_access_token = config.get("expire_access_token", False)
 
@@ -71,14 +71,14 @@ class KeyConfig(Config):
         base_key_name = os.path.join(config_dir_path, server_name)
 
         if is_generating_file:
-            macaroon_secret_key = random_string_with_symbols(50)
+            macaroon_secret_key = '"%s"' % random_string_with_symbols(50)
             form_secret = '"%s"' % random_string_with_symbols(50)
         else:
-            macaroon_secret_key = None
+            macaroon_secret_key = 'null'
             form_secret = 'null'
 
         return """\
-        macaroon_secret_key: "%(macaroon_secret_key)s"
+        macaroon_secret_key: %(macaroon_secret_key)s
 
         # Used to enable access token expiration.
         expire_access_token: False