diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2018-12-21 16:04:57 +0100 |
---|---|---|
committer | Amber Brown <hawkowl@atleastfornow.net> | 2018-12-22 02:04:57 +1100 |
commit | 9c2af7b2c51e31a1baf5ef523a251b946774468c (patch) | |
tree | 6c5fe1adda3c4728c36313de4fcfd53699ab2779 /synapse/config/key.py | |
parent | Fix indentation in default config (#4313) (diff) | |
download | synapse-9c2af7b2c51e31a1baf5ef523a251b946774468c.tar.xz |
Add a script to generate a clean config file (#4315)
Diffstat (limited to 'synapse/config/key.py')
-rw-r--r-- | synapse/config/key.py | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/synapse/config/key.py b/synapse/config/key.py index 279c47bb48..53f48fe2dd 100644 --- a/synapse/config/key.py +++ b/synapse/config/key.py @@ -66,26 +66,35 @@ class KeyConfig(Config): # falsification of values self.form_secret = config.get("form_secret", None) - def default_config(self, config_dir_path, server_name, is_generating_file=False, + def default_config(self, config_dir_path, server_name, generate_secrets=False, **kwargs): base_key_name = os.path.join(config_dir_path, server_name) - if is_generating_file: - macaroon_secret_key = random_string_with_symbols(50) - form_secret = '"%s"' % random_string_with_symbols(50) + if generate_secrets: + macaroon_secret_key = 'macaroon_secret_key: "%s"' % ( + random_string_with_symbols(50), + ) + form_secret = 'form_secret: "%s"' % random_string_with_symbols(50) else: - macaroon_secret_key = None - form_secret = 'null' + macaroon_secret_key = "# macaroon_secret_key: <PRIVATE STRING>" + form_secret = "# form_secret: <PRIVATE STRING>" return """\ - macaroon_secret_key: "%(macaroon_secret_key)s" + # a secret which is used to sign access tokens. If none is specified, + # the registration_shared_secret is used, if one is given; otherwise, + # a secret key is derived from the signing key. + # + # Note that changing this will invalidate any active access tokens, so + # all clients will have to log back in. + %(macaroon_secret_key)s # Used to enable access token expiration. expire_access_token: False # a secret which is used to calculate HMACs for form values, to stop - # falsification of values - form_secret: %(form_secret)s + # falsification of values. Must be specified for the User Consent + # forms to work. + %(form_secret)s ## Signing Keys ## |