diff options
author | Erik Johnston <erik@matrix.org> | 2016-02-08 16:35:44 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-02-08 16:35:44 +0000 |
commit | f078ecbc8fa47075a155765ea07a2211dbbad86d (patch) | |
tree | ade22f5192dddad3b79fef285bb6397f78035ac5 /synapse/config/registration.py | |
parent | Merge pull request #564 from matrix-org/erikj/logcontext (diff) | |
download | synapse-f078ecbc8fa47075a155765ea07a2211dbbad86d.tar.xz |
Derive macaroon_secret_key from signing key.
Unfortunately, there are people that are running synapse without a `macaroon_sercret_key` set. Mandating they set one is a good solution, except that breaking auto upgrades is annoying.
Diffstat (limited to 'synapse/config/registration.py')
-rw-r--r-- | synapse/config/registration.py | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/synapse/config/registration.py b/synapse/config/registration.py index 9b6dacc5b8..ab062d528c 100644 --- a/synapse/config/registration.py +++ b/synapse/config/registration.py @@ -32,26 +32,14 @@ class RegistrationConfig(Config): ) self.registration_shared_secret = config.get("registration_shared_secret") - self.macaroon_secret_key = config.get("macaroon_secret_key") - if self.macaroon_secret_key is None: - raise Exception( - "Config is missing missing macaroon_secret_key - please set it" - " in your config file." - ) + self.bcrypt_rounds = config.get("bcrypt_rounds", 12) self.trusted_third_party_id_servers = config["trusted_third_party_id_servers"] self.allow_guest_access = config.get("allow_guest_access", False) - def default_config(self, is_generating_file=False, **kwargs): + def default_config(self, **kwargs): registration_shared_secret = random_string_with_symbols(50) - macaroon_line = "" - if is_generating_file: - macaroon_line += '\n macaroon_secret_key: "%s"\n' % ( - random_string_with_symbols(50), - ) - - macaroon_secret_key = random_string_with_symbols(50) return """\ ## Registration ## @@ -61,7 +49,7 @@ class RegistrationConfig(Config): # If set, allows registration by anyone who also has the shared # secret, even if registration is otherwise disabled. registration_shared_secret: "%(registration_shared_secret)s" -%(macaroon_line)s + # Set the number of bcrypt rounds used to generate password hash. # Larger numbers increase the work factor needed to generate the hash. # The default number of rounds is 12. |