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 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 = "# macaroon_secret_key: <PRIVATE STRING>" form_secret = "# form_secret: <PRIVATE STRING>" return """\ # 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. Must be specified for the User Consent # forms to work. %(form_secret)s ## Signing Keys ## # Path to the signing key to sign messages with signing_key_path: "%(base_key_name)s.signing.key" # The keys that the server used to sign messages with but won't use # to sign new messages. E.g. it has lost its private key old_signing_keys: {} # "ed25519:auto": # # Base64 encoded public key # key: "The public part of your old signing key." # # Millisecond POSIX timestamp when the key expired. # expired_ts: 123456789123 # How long key response published by this server is valid for. # Used to set the valid_until_ts in /key/v2 APIs. # Determines how quickly servers will query to check which keys # are still valid. key_refresh_interval: "1d" # 1 Day. # The trusted servers to download signing keys from. perspectives: servers: "matrix.org": verify_keys: "ed25519:auto": key: "Noi6WqcDj0QmPxCNQqgezwTlBKrfqehY1u2FyWP9uYw" """ % locals()
def default_config(self, **kwargs): registration_shared_secret = random_string_with_symbols(50) macaroon_secret_key = random_string_with_symbols(50) return """\ ## Registration ## # Enable registration for new users. enable_registration: False # 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_secret_key: "%(macaroon_secret_key)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. bcrypt_rounds: 12 # Allows users to register as guests without a password/email/etc, and # participate in rooms hosted on this server which have been made # accessible to anonymous users. allow_guest_access: False """ % locals()
def default_config(self, config_dir_path, server_name, is_generating_file=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) else: macaroon_secret_key = None form_secret = 'null' return """\ macaroon_secret_key: "%(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 ## Signing Keys ## # Path to the signing key to sign messages with signing_key_path: "%(base_key_name)s.signing.key" # The keys that the server used to sign messages with but won't use # to sign new messages. E.g. it has lost its private key old_signing_keys: {} # "ed25519:auto": # # Base64 encoded public key # key: "The public part of your old signing key." # # Millisecond POSIX timestamp when the key expired. # expired_ts: 123456789123 # How long key response published by this server is valid for. # Used to set the valid_until_ts in /key/v2 APIs. # Determines how quickly servers will query to check which keys # are still valid. key_refresh_interval: "1d" # 1 Day. # The trusted servers to download signing keys from. perspectives: servers: "matrix.org": verify_keys: "ed25519:auto": key: "Noi6WqcDj0QmPxCNQqgezwTlBKrfqehY1u2FyWP9uYw" """ % locals()
def default_config(self, **kwargs): registration_shared_secret = random_string_with_symbols(50) return """\ ## Registration ## # Enable registration for new users. enable_registration: False # 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" # 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. bcrypt_rounds: 12 # Allows users to register as guests without a password/email/etc, and # participate in rooms hosted on this server which have been made # accessible to anonymous users. allow_guest_access: False # The list of identity servers trusted to verify third party # identifiers by this server. trusted_third_party_id_servers: - matrix.org - vector.im - riot.im # Users who register on this homeserver will automatically be joined # to these rooms #auto_join_rooms: # - "#example:example.com" """ % locals()
def default_config(self, **kwargs): registration_shared_secret = random_string_with_symbols(50) return """\ ## Registration ## # Enable registration for new users. enable_registration: False # 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" # Sets the expiry for the short term user creation in # milliseconds. For instance the bellow duration is two weeks # in milliseconds. user_creation_max_duration: 1209600000 # 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. bcrypt_rounds: 12 # Allows users to register as guests without a password/email/etc, and # participate in rooms hosted on this server which have been made # accessible to anonymous users. allow_guest_access: False # The list of identity servers trusted to verify third party # identifiers by this server. trusted_third_party_id_servers: - matrix.org - vector.im """ % locals()
def generate_refresh_token(self, user_id): m = self._generate_base_macaroon(user_id) m.add_first_party_caveat("type = refresh") # Important to add a nonce, because otherwise every refresh token for a # user will be the same. m.add_first_party_caveat( "nonce = %s" % (stringutils.random_string_with_symbols(16), )) return m.serialize()
def generate_refresh_token(self, user_id): m = self._generate_base_macaroon(user_id) m.add_first_party_caveat("type = refresh") # Important to add a nonce, because otherwise every refresh token for a # user will be the same. m.add_first_party_caveat("nonce = %s" % ( stringutils.random_string_with_symbols(16), )) return m.serialize()
def generate_config_section(self, generate_secrets: bool = False, **kwargs: Any) -> str: if generate_secrets: registration_shared_secret = 'registration_shared_secret: "%s"' % ( random_string_with_symbols(50), ) return registration_shared_secret else: return ""
def default_config(self, **kwargs): registration_shared_secret = random_string_with_symbols(50) return """\ ## Registration ## # Enable registration for new users. enable_registration: False # The user must provide all of the below types of 3PID when registering. # # registrations_require_3pid: # - email # - msisdn # Mandate that users are only allowed to associate certain formats of # 3PIDs with accounts on this server. # # allowed_local_3pids: # - medium: email # pattern: ".*@matrix\\.org" # - medium: email # pattern: ".*@vector\\.im" # - medium: msisdn # pattern: "\\+44" # 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" # 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 is 12 (which equates to 2^12 rounds). # N.B. that increasing this will exponentially increase the time required # to register or login - e.g. 24 => 2^24 rounds which will take >20 mins. bcrypt_rounds: 12 # Allows users to register as guests without a password/email/etc, and # participate in rooms hosted on this server which have been made # accessible to anonymous users. allow_guest_access: False # The list of identity servers trusted to verify third party # identifiers by this server. trusted_third_party_id_servers: - matrix.org - vector.im - riot.im # Users who register on this homeserver will automatically be joined # to these rooms #auto_join_rooms: # - "#example:example.com" """ % locals()
def generate_access_token(self, user_id, extra_caveats=None): extra_caveats = extra_caveats or [] macaroon = self._generate_base_macaroon(user_id) macaroon.add_first_party_caveat("type = access") # Include a nonce, to make sure that each login gets a different # access token. macaroon.add_first_party_caveat( "nonce = %s" % (stringutils.random_string_with_symbols(16), )) for caveat in extra_caveats: macaroon.add_first_party_caveat(caveat) return macaroon.serialize()
def default_config(self, config_dir, server_name): registration_shared_secret = random_string_with_symbols(50) return """\ ## Registration ## # Enable registration for new users. enable_registration: False # 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" """ % locals()
def default_config(self, config_dir, server_name): registration_shared_secret = random_string_with_symbols(50) return """\ ## Registration ## # Enable registration for new users. enable_registration: True # 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" """ % locals()
def generate_access_token(self, user_id, extra_caveats=None): extra_caveats = extra_caveats or [] macaroon = self._generate_base_macaroon(user_id) macaroon.add_first_party_caveat("type = access") # Include a nonce, to make sure that each login gets a different # access token. macaroon.add_first_party_caveat("nonce = %s" % ( stringutils.random_string_with_symbols(16), )) for caveat in extra_caveats: macaroon.add_first_party_caveat(caveat) return macaroon.serialize()
def generate_config_section( self, config_dir_path: str, server_name: str, generate_secrets: bool = False, **kwargs: Any, ) -> str: base_key_name = os.path.join(config_dir_path, server_name) macaroon_secret_key = "" form_secret = "" 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) return ("""\ %(macaroon_secret_key)s %(form_secret)s signing_key_path: "%(base_key_name)s.signing.key" trusted_key_servers: - server_name: "matrix.org" """ % locals())
def generate_guest_access_token(self, user_id: str) -> str: """Generate a guest access token for the given user ID Args: user_id: The user ID for which the guest token should be generated. Returns: A signed access token for that guest user. """ nonce = stringutils.random_string_with_symbols(16) macaroon = self._generate_base_macaroon("access") macaroon.add_first_party_caveat(f"user_id = {user_id}") macaroon.add_first_party_caveat(f"nonce = {nonce}") macaroon.add_first_party_caveat("guest = true") return macaroon.serialize()
def check_device_registered(self, user_id, device_id, initial_device_display_name=None): """ If the given device has not been registered, register it with the supplied display name. If no device_id is supplied, we make one up. Args: user_id (str): @user:id device_id (str | None): device id supplied by client initial_device_display_name (str | None): device display name from client Returns: str: device id (generated if none was supplied) """ if device_id is not None: yield self.store.store_device( user_id=user_id, device_id=device_id, initial_device_display_name=initial_device_display_name, ignore_if_known=True, ) defer.returnValue(device_id) # if the device id is not specified, we'll autogen one, but loop a few # times in case of a clash. attempts = 0 while attempts < 5: try: device_id = stringutils.random_string_with_symbols(16) yield self.store.store_device( user_id=user_id, device_id=device_id, initial_device_display_name=initial_device_display_name, ignore_if_known=False, ) defer.returnValue(device_id) except errors.StoreError: attempts += 1 raise errors.StoreError(500, "Couldn't generate a device ID.")
def generate_config_section(self, generate_secrets=False, **kwargs): if generate_secrets: registration_shared_secret = 'registration_shared_secret: "%s"' % ( random_string_with_symbols(50), ) else: registration_shared_secret = "#registration_shared_secret: <PRIVATE STRING>" return ("""\ ## Registration ## # # Registration can be rate-limited using the parameters in the "Ratelimiting" # section of this file. # Enable registration for new users. # #enable_registration: false # Optional account validity configuration. This allows for accounts to be denied # any request after a given period. # # Once this feature is enabled, Synapse will look for registered users without an # expiration date at startup and will add one to every account it found using the # current settings at that time. # This means that, if a validity period is set, and Synapse is restarted (it will # then derive an expiration date from the current validity period), and some time # after that the validity period changes and Synapse is restarted, the users' # expiration dates won't be updated unless their account is manually renewed. This # date will be randomly selected within a range [now + period - d ; now + period], # where d is equal to 10%% of the validity period. # account_validity: # The account validity feature is disabled by default. Uncomment the # following line to enable it. # #enabled: true # The period after which an account is valid after its registration. When # renewing the account, its validity period will be extended by this amount # of time. This parameter is required when using the account validity # feature. # #period: 6w # The amount of time before an account's expiry date at which Synapse will # send an email to the account's email address with a renewal link. By # default, no such emails are sent. # # If you enable this setting, you will also need to fill out the 'email' and # 'public_baseurl' configuration sections. # #renew_at: 1w # The subject of the email sent out with the renewal link. '%%(app)s' can be # used as a placeholder for the 'app_name' parameter from the 'email' # section. # # Note that the placeholder must be written '%%(app)s', including the # trailing 's'. # # If this is not set, a default value is used. # #renew_email_subject: "Renew your %%(app)s account" # Directory in which Synapse will try to find templates for the HTML files to # serve to the user when trying to renew an account. If not set, default # templates from within the Synapse package will be used. # #template_dir: "res/templates" # File within 'template_dir' giving the HTML to be displayed to the user after # they successfully renewed their account. If not set, default text is used. # #account_renewed_html_path: "account_renewed.html" # File within 'template_dir' giving the HTML to be displayed when the user # tries to renew an account with an invalid renewal token. If not set, # default text is used. # #invalid_token_html_path: "invalid_token.html" # Time that a user's session remains valid for, after they log in. # # Note that this is not currently compatible with guest logins. # # Note also that this is calculated at login time: changes are not applied # retrospectively to users who have already logged in. # # By default, this is infinite. # #session_lifetime: 24h # The user must provide all of the below types of 3PID when registering. # #registrations_require_3pid: # - email # - msisdn # Explicitly disable asking for MSISDNs from the registration # flow (overrides registrations_require_3pid if MSISDNs are set as required) # #disable_msisdn_registration: true # Mandate that users are only allowed to associate certain formats of # 3PIDs with accounts on this server. # #allowed_local_3pids: # - medium: email # pattern: '.*@matrix\\.org' # - medium: email # pattern: '.*@vector\\.im' # - medium: msisdn # pattern: '\\+44' # Enable 3PIDs lookup requests to identity servers from this server. # #enable_3pid_lookup: true # If set, allows registration of standard or admin accounts by anyone who # has the shared secret, even if registration is otherwise disabled. # %(registration_shared_secret)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 is 12 (which equates to 2^12 rounds). # N.B. that increasing this will exponentially increase the time required # to register or login - e.g. 24 => 2^24 rounds which will take >20 mins. # #bcrypt_rounds: 12 # Allows users to register as guests without a password/email/etc, and # participate in rooms hosted on this server which have been made # accessible to anonymous users. # #allow_guest_access: false # The identity server which we suggest that clients should use when users log # in on this server. # # (By default, no suggestion is made, so it is left up to the client. # This setting is ignored unless public_baseurl is also set.) # #default_identity_server: https://matrix.org # Handle threepid (email/phone etc) registration and password resets through a set of # *trusted* identity servers. Note that this allows the configured identity server to # reset passwords for accounts! # # Be aware that if `email` is not set, and SMTP options have not been # configured in the email config block, registration and user password resets via # email will be globally disabled. # # Additionally, if `msisdn` is not set, registration and password resets via msisdn # will be disabled regardless, and users will not be able to associate an msisdn # identifier to their account. This is due to Synapse currently not supporting # any method of sending SMS messages on its own. # # To enable using an identity server for operations regarding a particular third-party # identifier type, set the value to the URL of that identity server as shown in the # examples below. # # Servers handling the these requests must answer the `/requestToken` endpoints defined # by the Matrix Identity Service API specification: # https://matrix.org/docs/spec/identity_service/latest # # If a delegate is specified, the config option public_baseurl must also be filled out. # account_threepid_delegates: #email: https://example.com # Delegate email sending to example.com #msisdn: http://localhost:8090 # Delegate SMS sending to this local process # Whether users are allowed to change their displayname after it has # been initially set. Useful when provisioning users based on the # contents of a third-party directory. # # Does not apply to server administrators. Defaults to 'true' # #enable_set_displayname: false # Whether users are allowed to change their avatar after it has been # initially set. Useful when provisioning users based on the contents # of a third-party directory. # # Does not apply to server administrators. Defaults to 'true' # #enable_set_avatar_url: false # Whether users can change the 3PIDs associated with their accounts # (email address and msisdn). # # Defaults to 'true' # #enable_3pid_changes: false # Users who register on this homeserver will automatically be joined # to these rooms. # # By default, any room aliases included in this list will be created # as a publicly joinable room when the first user registers for the # homeserver. This behaviour can be customised with the settings below. # If the room already exists, make certain it is a publicly joinable # room. The join rule of the room must be set to 'public'. # #auto_join_rooms: # - "#example:example.com" # Where auto_join_rooms are specified, setting this flag ensures that the # the rooms exist by creating them when the first user on the # homeserver registers. # # By default the auto-created rooms are publicly joinable from any federated # server. Use the autocreate_auto_join_rooms_federated and # autocreate_auto_join_room_preset settings below to customise this behaviour. # # Setting to false means that if the rooms are not manually created, # users cannot be auto-joined since they do not exist. # # Defaults to true. Uncomment the following line to disable automatically # creating auto-join rooms. # #autocreate_auto_join_rooms: false # Whether the auto_join_rooms that are auto-created are available via # federation. Only has an effect if autocreate_auto_join_rooms is true. # # Note that whether a room is federated cannot be modified after # creation. # # Defaults to true: the room will be joinable from other servers. # Uncomment the following to prevent users from other homeservers from # joining these rooms. # #autocreate_auto_join_rooms_federated: false # The room preset to use when auto-creating one of auto_join_rooms. Only has an # effect if autocreate_auto_join_rooms is true. # # This can be one of "public_chat", "private_chat", or "trusted_private_chat". # If a value of "private_chat" or "trusted_private_chat" is used then # auto_join_mxid_localpart must also be configured. # # Defaults to "public_chat", meaning that the room is joinable by anyone, including # federated servers if autocreate_auto_join_rooms_federated is true (the default). # Uncomment the following to require an invitation to join these rooms. # #autocreate_auto_join_room_preset: private_chat # The local part of the user id which is used to create auto_join_rooms if # autocreate_auto_join_rooms is true. If this is not provided then the # initial user account that registers will be used to create the rooms. # # The user id is also used to invite new users to any auto-join rooms which # are set to invite-only. # # It *must* be configured if autocreate_auto_join_room_preset is set to # "private_chat" or "trusted_private_chat". # # Note that this must be specified in order for new users to be correctly # invited to any auto-join rooms which have been set to invite-only (either # at the time of creation or subsequently). # # Note that, if the room already exists, this user must be joined and # have the appropriate permissions to invite new members. # #auto_join_mxid_localpart: system # When auto_join_rooms is specified, setting this flag to false prevents # guest accounts from being automatically joined to the rooms. # # Defaults to true. # #auto_join_rooms_for_guests: false """ % locals())
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 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 = "# macaroon_secret_key: <PRIVATE STRING>" form_secret = "# form_secret: <PRIVATE STRING>" return ("""\ # 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. # %(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. Must be specified for the User Consent # forms to work. # %(form_secret)s ## Signing Keys ## # Path to the signing key to sign messages with # signing_key_path: "%(base_key_name)s.signing.key" # The keys that the server used to sign messages with but won't use # to sign new messages. E.g. it has lost its private key # #old_signing_keys: # "ed25519:auto": # # Base64 encoded public key # key: "The public part of your old signing key." # # Millisecond POSIX timestamp when the key expired. # expired_ts: 123456789123 # How long key response published by this server is valid for. # Used to set the valid_until_ts in /key/v2 APIs. # Determines how quickly servers will query to check which keys # are still valid. # #key_refresh_interval: 1d # The trusted servers to download signing keys from. # # When we need to fetch a signing key, each server is tried in parallel. # # Normally, the connection to the key server is validated via TLS certificates. # Additional security can be provided by configuring a `verify key`, which # will make synapse check that the response is signed by that key. # # This setting supercedes an older setting named `perspectives`. The old format # is still supported for backwards-compatibility, but it is deprecated. # # Options for each entry in the list include: # # server_name: the name of the server. required. # # verify_keys: an optional map from key id to base64-encoded public key. # If specified, we will check that the response is signed by at least # one of the given keys. # # accept_keys_insecurely: a boolean. Normally, if `verify_keys` is unset, # and federation_verify_certificates is not `true`, synapse will refuse # to start, because this would allow anyone who can spoof DNS responses # to masquerade as the trusted key server. If you know what you are doing # and are sure that your network environment provides a secure connection # to the key server, you can set this to `true` to override this # behaviour. # # An example configuration might look like: # #trusted_key_servers: # - server_name: "my_trusted_server.example.com" # verify_keys: # "ed25519:auto": "abcdefghijklmnopqrstuvwxyzabcdefghijklmopqr" # - server_name: "my_other_trusted_server.example.com" # # The default configuration is: # #trusted_key_servers: # - server_name: "matrix.org" """ % locals())
def default_config(self, generate_secrets=False, **kwargs): if generate_secrets: registration_shared_secret = 'registration_shared_secret: "%s"' % ( random_string_with_symbols(50), ) else: registration_shared_secret = '# registration_shared_secret: <PRIVATE STRING>' return """\ ## Registration ## # Enable registration for new users. enable_registration: False # The user must provide all of the below types of 3PID when registering. # # registrations_require_3pid: # - email # - msisdn # Mandate that users are only allowed to associate certain formats of # 3PIDs with accounts on this server. # # allowed_local_3pids: # - medium: email # pattern: ".*@matrix\\.org" # - medium: email # pattern: ".*@vector\\.im" # - medium: msisdn # pattern: "\\+44" # If set, allows registration by anyone who also has the shared # secret, even if registration is otherwise disabled. %(registration_shared_secret)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 is 12 (which equates to 2^12 rounds). # N.B. that increasing this will exponentially increase the time required # to register or login - e.g. 24 => 2^24 rounds which will take >20 mins. bcrypt_rounds: 12 # Allows users to register as guests without a password/email/etc, and # participate in rooms hosted on this server which have been made # accessible to anonymous users. allow_guest_access: False # The identity server which we suggest that clients should use when users log # in on this server. # # (By default, no suggestion is made, so it is left up to the client. # This setting is ignored unless public_baseurl is also set.) # # default_identity_server: https://matrix.org # The list of identity servers trusted to verify third party # identifiers by this server. # # Also defines the ID server which will be called when an account is # deactivated (one will be picked arbitrarily). trusted_third_party_id_servers: - matrix.org - vector.im # Users who register on this homeserver will automatically be joined # to these rooms #auto_join_rooms: # - "#example:example.com" # Where auto_join_rooms are specified, setting this flag ensures that the # the rooms exist by creating them when the first user on the # homeserver registers. # Setting to false means that if the rooms are not manually created, # users cannot be auto-joined since they do not exist. autocreate_auto_join_rooms: true """ % locals()
def generate_config_section(self, config_dir_path, server_name, generate_secrets=False, **kwargs): base_key_name = os.path.join(config_dir_path, server_name) 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 = "#macaroon_secret_key: <PRIVATE STRING>" form_secret = "#form_secret: <PRIVATE STRING>" return ("""\ # 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. # %(macaroon_secret_key)s # a secret which is used to calculate HMACs for form values, to stop # falsification of values. Must be specified for the User Consent # forms to work. # %(form_secret)s ## Signing Keys ## # Path to the signing key to sign messages with # signing_key_path: "%(base_key_name)s.signing.key" # The keys that the server used to sign messages with but won't use # to sign new messages. # old_signing_keys: # For each key, `key` should be the base64-encoded public key, and # `expired_ts`should be the time (in milliseconds since the unix epoch) that # it was last used. # # It is possible to build an entry from an old signing.key file using the # `export_signing_key` script which is provided with synapse. # # For example: # #"ed25519:id": { key: "base64string", expired_ts: 123456789123 } # How long key response published by this server is valid for. # Used to set the valid_until_ts in /key/v2 APIs. # Determines how quickly servers will query to check which keys # are still valid. # #key_refresh_interval: 1d # The trusted servers to download signing keys from. # # When we need to fetch a signing key, each server is tried in parallel. # # Normally, the connection to the key server is validated via TLS certificates. # Additional security can be provided by configuring a `verify key`, which # will make synapse check that the response is signed by that key. # # This setting supercedes an older setting named `perspectives`. The old format # is still supported for backwards-compatibility, but it is deprecated. # # 'trusted_key_servers' defaults to matrix.org, but using it will generate a # warning on start-up. To suppress this warning, set # 'suppress_key_server_warning' to true. # # Options for each entry in the list include: # # server_name: the name of the server. required. # # verify_keys: an optional map from key id to base64-encoded public key. # If specified, we will check that the response is signed by at least # one of the given keys. # # accept_keys_insecurely: a boolean. Normally, if `verify_keys` is unset, # and federation_verify_certificates is not `true`, synapse will refuse # to start, because this would allow anyone who can spoof DNS responses # to masquerade as the trusted key server. If you know what you are doing # and are sure that your network environment provides a secure connection # to the key server, you can set this to `true` to override this # behaviour. # # An example configuration might look like: # #trusted_key_servers: # - server_name: "my_trusted_server.example.com" # verify_keys: # "ed25519:auto": "abcdefghijklmnopqrstuvwxyzabcdefghijklmopqr" # - server_name: "my_other_trusted_server.example.com" # trusted_key_servers: - server_name: "matrix.org" # Uncomment the following to disable the warning that is emitted when the # trusted_key_servers include 'matrix.org'. See above. # #suppress_key_server_warning: true # The signing keys to use when acting as a trusted key server. If not specified # defaults to the server signing key. # # Can contain multiple keys, one per line. # #key_server_signing_keys_path: "key_server_signing_keys.key" """ % locals())
def default_config(self, generate_secrets=False, **kwargs): if generate_secrets: registration_shared_secret = 'registration_shared_secret: "%s"' % ( random_string_with_symbols(50), ) else: registration_shared_secret = '# registration_shared_secret: <PRIVATE STRING>' return """\ ## Registration ## # # Registration can be rate-limited using the parameters in the "Ratelimiting" # section of this file. # Enable registration for new users. # #enable_registration: false # Optional account validity configuration. This allows for accounts to be denied # any request after a given period. # # ``enabled`` defines whether the account validity feature is enabled. Defaults # to False. # # ``period`` allows setting the period after which an account is valid # after its registration. When renewing the account, its validity period # will be extended by this amount of time. This parameter is required when using # the account validity feature. # # ``renew_at`` is the amount of time before an account's expiry date at which # Synapse will send an email to the account's email address with a renewal link. # This needs the ``email`` and ``public_baseurl`` configuration sections to be # filled. # # ``renew_email_subject`` is the subject of the email sent out with the renewal # link. ``%%(app)s`` can be used as a placeholder for the ``app_name`` parameter # from the ``email`` section. # # Once this feature is enabled, Synapse will look for registered users without an # expiration date at startup and will add one to every account it found using the # current settings at that time. # This means that, if a validity period is set, and Synapse is restarted (it will # then derive an expiration date from the current validity period), and some time # after that the validity period changes and Synapse is restarted, the users' # expiration dates won't be updated unless their account is manually renewed. # #account_validity: # enabled: True # period: 6w # renew_at: 1w # renew_email_subject: "Renew your %%(app)s account" # The user must provide all of the below types of 3PID when registering. # #registrations_require_3pid: # - email # - msisdn # Explicitly disable asking for MSISDNs from the registration # flow (overrides registrations_require_3pid if MSISDNs are set as required) # #disable_msisdn_registration: true # Mandate that users are only allowed to associate certain formats of # 3PIDs with accounts on this server. # #allowed_local_3pids: # - medium: email # pattern: '.*@matrix\\.org' # - medium: email # pattern: '.*@vector\\.im' # - medium: msisdn # pattern: '\\+44' # Enable 3PIDs lookup requests to identity servers from this server. # #enable_3pid_lookup: true # If set, allows registration of standard or admin accounts by anyone who # has the shared secret, even if registration is otherwise disabled. # %(registration_shared_secret)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 is 12 (which equates to 2^12 rounds). # N.B. that increasing this will exponentially increase the time required # to register or login - e.g. 24 => 2^24 rounds which will take >20 mins. # #bcrypt_rounds: 12 # Allows users to register as guests without a password/email/etc, and # participate in rooms hosted on this server which have been made # accessible to anonymous users. # #allow_guest_access: false # The identity server which we suggest that clients should use when users log # in on this server. # # (By default, no suggestion is made, so it is left up to the client. # This setting is ignored unless public_baseurl is also set.) # #default_identity_server: https://matrix.org # The list of identity servers trusted to verify third party # identifiers by this server. # # Also defines the ID server which will be called when an account is # deactivated (one will be picked arbitrarily). # #trusted_third_party_id_servers: # - matrix.org # - vector.im # Users who register on this homeserver will automatically be joined # to these rooms # #auto_join_rooms: # - "#example:example.com" # Where auto_join_rooms are specified, setting this flag ensures that the # the rooms exist by creating them when the first user on the # homeserver registers. # Setting to false means that if the rooms are not manually created, # users cannot be auto-joined since they do not exist. # #autocreate_auto_join_rooms: true """ % locals()
def generate_config(cls, args, config_dir_path): if args.disable_registration is None: args.disable_registration = True if args.registration_shared_secret is None: args.registration_shared_secret = random_string_with_symbols(50)
def generate_config_section(self, generate_secrets=False, **kwargs): if generate_secrets: registration_shared_secret = 'registration_shared_secret: "%s"' % ( random_string_with_symbols(50), ) else: registration_shared_secret = ( "# registration_shared_secret: <PRIVATE STRING>" ) return ( """\ ## Registration ## # # Registration can be rate-limited using the parameters in the "Ratelimiting" # section of this file. # Enable registration for new users. # #enable_registration: false # Optional account validity configuration. This allows for accounts to be denied # any request after a given period. # # ``enabled`` defines whether the account validity feature is enabled. Defaults # to False. # # ``period`` allows setting the period after which an account is valid # after its registration. When renewing the account, its validity period # will be extended by this amount of time. This parameter is required when using # the account validity feature. # # ``renew_at`` is the amount of time before an account's expiry date at which # Synapse will send an email to the account's email address with a renewal link. # This needs the ``email`` and ``public_baseurl`` configuration sections to be # filled. # # ``renew_email_subject`` is the subject of the email sent out with the renewal # link. ``%%(app)s`` can be used as a placeholder for the ``app_name`` parameter # from the ``email`` section. # # Once this feature is enabled, Synapse will look for registered users without an # expiration date at startup and will add one to every account it found using the # current settings at that time. # This means that, if a validity period is set, and Synapse is restarted (it will # then derive an expiration date from the current validity period), and some time # after that the validity period changes and Synapse is restarted, the users' # expiration dates won't be updated unless their account is manually renewed. This # date will be randomly selected within a range [now + period - d ; now + period], # where d is equal to 10%% of the validity period. # #account_validity: # enabled: true # period: 6w # renew_at: 1w # renew_email_subject: "Renew your %%(app)s account" # # Directory in which Synapse will try to find the HTML files to serve to the # # user when trying to renew an account. Optional, defaults to # # synapse/res/templates. # template_dir: "res/templates" # # HTML to be displayed to the user after they successfully renewed their # # account. Optional. # account_renewed_html_path: "account_renewed.html" # # HTML to be displayed when the user tries to renew an account with an invalid # # renewal token. Optional. # invalid_token_html_path: "invalid_token.html" # Time that a user's session remains valid for, after they log in. # # Note that this is not currently compatible with guest logins. # # Note also that this is calculated at login time: changes are not applied # retrospectively to users who have already logged in. # # By default, this is infinite. # #session_lifetime: 24h # The user must provide all of the below types of 3PID when registering. # #registrations_require_3pid: # - email # - msisdn # Explicitly disable asking for MSISDNs from the registration # flow (overrides registrations_require_3pid if MSISDNs are set as required) # #disable_msisdn_registration: true # Mandate that users are only allowed to associate certain formats of # 3PIDs with accounts on this server. # #allowed_local_3pids: # - medium: email # pattern: '.*@matrix\\.org' # - medium: email # pattern: '.*@vector\\.im' # - medium: msisdn # pattern: '\\+44' # Enable 3PIDs lookup requests to identity servers from this server. # #enable_3pid_lookup: true # If set, allows registration of standard or admin accounts by anyone who # has the shared secret, even if registration is otherwise disabled. # %(registration_shared_secret)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 is 12 (which equates to 2^12 rounds). # N.B. that increasing this will exponentially increase the time required # to register or login - e.g. 24 => 2^24 rounds which will take >20 mins. # #bcrypt_rounds: 12 # Allows users to register as guests without a password/email/etc, and # participate in rooms hosted on this server which have been made # accessible to anonymous users. # #allow_guest_access: false # The identity server which we suggest that clients should use when users log # in on this server. # # (By default, no suggestion is made, so it is left up to the client. # This setting is ignored unless public_baseurl is also set.) # #default_identity_server: https://matrix.org # The list of identity servers trusted to verify third party # identifiers by this server. # # Also defines the ID server which will be called when an account is # deactivated (one will be picked arbitrarily). # # Note: This option is deprecated. Since v0.99.4, Synapse has tracked which identity # server a 3PID has been bound to. For 3PIDs bound before then, Synapse runs a # background migration script, informing itself that the identity server all of its # 3PIDs have been bound to is likely one of the below. # # As of Synapse v1.4.0, all other functionality of this option has been deprecated, and # it is now solely used for the purposes of the background migration script, and can be # removed once it has run. #trusted_third_party_id_servers: # - matrix.org # - vector.im # Handle threepid (email/phone etc) registration and password resets through a set of # *trusted* identity servers. Note that this allows the configured identity server to # reset passwords for accounts! # # Be aware that if `email` is not set, and SMTP options have not been # configured in the email config block, registration and user password resets via # email will be globally disabled. # # Additionally, if `msisdn` is not set, registration and password resets via msisdn # will be disabled regardless. This is due to Synapse currently not supporting any # method of sending SMS messages on its own. # # To enable using an identity server for operations regarding a particular third-party # identifier type, set the value to the URL of that identity server as shown in the # examples below. # # Servers handling the these requests must answer the `/requestToken` endpoints defined # by the Matrix Identity Service API specification: # https://matrix.org/docs/spec/identity_service/latest # # If a delegate is specified, the config option public_baseurl must also be filled out. # account_threepid_delegates: #email: https://example.com # Delegate email sending to example.com #msisdn: http://localhost:8090 # Delegate SMS sending to this local process # Users who register on this homeserver will automatically be joined # to these rooms # #auto_join_rooms: # - "#example:example.com" # Where auto_join_rooms are specified, setting this flag ensures that the # the rooms exist by creating them when the first user on the # homeserver registers. # Setting to false means that if the rooms are not manually created, # users cannot be auto-joined since they do not exist. # #autocreate_auto_join_rooms: true """ % locals() )
def default_config(self, generate_secrets=False, **kwargs): if generate_secrets: registration_shared_secret = 'registration_shared_secret: "%s"' % ( random_string_with_symbols(50), ) else: registration_shared_secret = '# registration_shared_secret: <PRIVATE STRING>' return """\ ## Registration ## # # Registration can be rate-limited using the parameters in the "Ratelimiting" # section of this file. # Enable registration for new users. # #enable_registration: false # Optional account validity configuration. This allows for accounts to be denied # any request after a given period. # # ``enabled`` defines whether the account validity feature is enabled. Defaults # to False. # # ``period`` allows setting the period after which an account is valid # after its registration. When renewing the account, its validity period # will be extended by this amount of time. This parameter is required when using # the account validity feature. # # ``renew_at`` is the amount of time before an account's expiry date at which # Synapse will send an email to the account's email address with a renewal link. # This needs the ``email`` and ``public_baseurl`` configuration sections to be # filled. # # ``renew_email_subject`` is the subject of the email sent out with the renewal # link. ``%%(app)s`` can be used as a placeholder for the ``app_name`` parameter # from the ``email`` section. # # Once this feature is enabled, Synapse will look for registered users without an # expiration date at startup and will add one to every account it found using the # current settings at that time. # This means that, if a validity period is set, and Synapse is restarted (it will # then derive an expiration date from the current validity period), and some time # after that the validity period changes and Synapse is restarted, the users' # expiration dates won't be updated unless their account is manually renewed. This # date will be randomly selected within a range [now + period - d ; now + period], # where d is equal to 10%% of the validity period. # #account_validity: # enabled: True # period: 6w # renew_at: 1w # renew_email_subject: "Renew your %%(app)s account" # The user must provide all of the below types of 3PID when registering. # #registrations_require_3pid: # - email # - msisdn # Explicitly disable asking for MSISDNs from the registration # flow (overrides registrations_require_3pid if MSISDNs are set as required) # #disable_msisdn_registration: true # Mandate that users are only allowed to associate certain formats of # 3PIDs with accounts on this server. # #allowed_local_3pids: # - medium: email # pattern: '.*@matrix\\.org' # - medium: email # pattern: '.*@vector\\.im' # - medium: msisdn # pattern: '\\+44' # Enable 3PIDs lookup requests to identity servers from this server. # #enable_3pid_lookup: true # If set, allows registration of standard or admin accounts by anyone who # has the shared secret, even if registration is otherwise disabled. # %(registration_shared_secret)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 is 12 (which equates to 2^12 rounds). # N.B. that increasing this will exponentially increase the time required # to register or login - e.g. 24 => 2^24 rounds which will take >20 mins. # #bcrypt_rounds: 12 # Allows users to register as guests without a password/email/etc, and # participate in rooms hosted on this server which have been made # accessible to anonymous users. # #allow_guest_access: false # The identity server which we suggest that clients should use when users log # in on this server. # # (By default, no suggestion is made, so it is left up to the client. # This setting is ignored unless public_baseurl is also set.) # #default_identity_server: https://matrix.org # The list of identity servers trusted to verify third party # identifiers by this server. # # Also defines the ID server which will be called when an account is # deactivated (one will be picked arbitrarily). # #trusted_third_party_id_servers: # - matrix.org # - vector.im # Users who register on this homeserver will automatically be joined # to these rooms # #auto_join_rooms: # - "#example:example.com" # Where auto_join_rooms are specified, setting this flag ensures that the # the rooms exist by creating them when the first user on the # homeserver registers. # Setting to false means that if the rooms are not manually created, # users cannot be auto-joined since they do not exist. # #autocreate_auto_join_rooms: true """ % locals()
def generate_config_section(self, generate_secrets=False, **kwargs): if generate_secrets: registration_shared_secret = 'registration_shared_secret: "%s"' % ( random_string_with_symbols(50), ) else: registration_shared_secret = "#registration_shared_secret: <PRIVATE STRING>" return ("""\ ## Registration ## # # Registration can be rate-limited using the parameters in the "Ratelimiting" # section of this file. # Enable registration for new users. # #enable_registration: false # Time that a user's session remains valid for, after they log in. # # Note that this is not currently compatible with guest logins. # # Note also that this is calculated at login time: changes are not applied # retrospectively to users who have already logged in. # # By default, this is infinite. # #session_lifetime: 24h # The user must provide all of the below types of 3PID when registering. # #registrations_require_3pid: # - email # - msisdn # Explicitly disable asking for MSISDNs from the registration # flow (overrides registrations_require_3pid if MSISDNs are set as required) # #disable_msisdn_registration: true # Mandate that users are only allowed to associate certain formats of # 3PIDs with accounts on this server. # #allowed_local_3pids: # - medium: email # pattern: '^[^@]+@matrix\\.org$' # - medium: email # pattern: '^[^@]+@vector\\.im$' # - medium: msisdn # pattern: '\\+44' # Enable 3PIDs lookup requests to identity servers from this server. # #enable_3pid_lookup: true # Require users to submit a token during registration. # Tokens can be managed using the admin API: # https://matrix-org.github.io/synapse/latest/usage/administration/admin_api/registration_tokens.html # Note that `enable_registration` must be set to `true`. # Disabling this option will not delete any tokens previously generated. # Defaults to false. Uncomment the following to require tokens: # #registration_requires_token: true # If set, allows registration of standard or admin accounts by anyone who # has the shared secret, even if registration is otherwise disabled. # %(registration_shared_secret)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 is 12 (which equates to 2^12 rounds). # N.B. that increasing this will exponentially increase the time required # to register or login - e.g. 24 => 2^24 rounds which will take >20 mins. # #bcrypt_rounds: 12 # Allows users to register as guests without a password/email/etc, and # participate in rooms hosted on this server which have been made # accessible to anonymous users. # #allow_guest_access: false # The identity server which we suggest that clients should use when users log # in on this server. # # (By default, no suggestion is made, so it is left up to the client. # This setting is ignored unless public_baseurl is also explicitly set.) # #default_identity_server: https://matrix.org # Handle threepid (email/phone etc) registration and password resets through a set of # *trusted* identity servers. Note that this allows the configured identity server to # reset passwords for accounts! # # Be aware that if `email` is not set, and SMTP options have not been # configured in the email config block, registration and user password resets via # email will be globally disabled. # # Additionally, if `msisdn` is not set, registration and password resets via msisdn # will be disabled regardless, and users will not be able to associate an msisdn # identifier to their account. This is due to Synapse currently not supporting # any method of sending SMS messages on its own. # # To enable using an identity server for operations regarding a particular third-party # identifier type, set the value to the URL of that identity server as shown in the # examples below. # # Servers handling the these requests must answer the `/requestToken` endpoints defined # by the Matrix Identity Service API specification: # https://matrix.org/docs/spec/identity_service/latest # account_threepid_delegates: #email: https://example.com # Delegate email sending to example.com #msisdn: http://localhost:8090 # Delegate SMS sending to this local process # Whether users are allowed to change their displayname after it has # been initially set. Useful when provisioning users based on the # contents of a third-party directory. # # Does not apply to server administrators. Defaults to 'true' # #enable_set_displayname: false # Whether users are allowed to change their avatar after it has been # initially set. Useful when provisioning users based on the contents # of a third-party directory. # # Does not apply to server administrators. Defaults to 'true' # #enable_set_avatar_url: false # Whether users can change the 3PIDs associated with their accounts # (email address and msisdn). # # Defaults to 'true' # #enable_3pid_changes: false # Users who register on this homeserver will automatically be joined # to these rooms. # # By default, any room aliases included in this list will be created # as a publicly joinable room when the first user registers for the # homeserver. This behaviour can be customised with the settings below. # If the room already exists, make certain it is a publicly joinable # room. The join rule of the room must be set to 'public'. # #auto_join_rooms: # - "#example:example.com" # Where auto_join_rooms are specified, setting this flag ensures that the # the rooms exist by creating them when the first user on the # homeserver registers. # # By default the auto-created rooms are publicly joinable from any federated # server. Use the autocreate_auto_join_rooms_federated and # autocreate_auto_join_room_preset settings below to customise this behaviour. # # Setting to false means that if the rooms are not manually created, # users cannot be auto-joined since they do not exist. # # Defaults to true. Uncomment the following line to disable automatically # creating auto-join rooms. # #autocreate_auto_join_rooms: false # Whether the auto_join_rooms that are auto-created are available via # federation. Only has an effect if autocreate_auto_join_rooms is true. # # Note that whether a room is federated cannot be modified after # creation. # # Defaults to true: the room will be joinable from other servers. # Uncomment the following to prevent users from other homeservers from # joining these rooms. # #autocreate_auto_join_rooms_federated: false # The room preset to use when auto-creating one of auto_join_rooms. Only has an # effect if autocreate_auto_join_rooms is true. # # This can be one of "public_chat", "private_chat", or "trusted_private_chat". # If a value of "private_chat" or "trusted_private_chat" is used then # auto_join_mxid_localpart must also be configured. # # Defaults to "public_chat", meaning that the room is joinable by anyone, including # federated servers if autocreate_auto_join_rooms_federated is true (the default). # Uncomment the following to require an invitation to join these rooms. # #autocreate_auto_join_room_preset: private_chat # The local part of the user id which is used to create auto_join_rooms if # autocreate_auto_join_rooms is true. If this is not provided then the # initial user account that registers will be used to create the rooms. # # The user id is also used to invite new users to any auto-join rooms which # are set to invite-only. # # It *must* be configured if autocreate_auto_join_room_preset is set to # "private_chat" or "trusted_private_chat". # # Note that this must be specified in order for new users to be correctly # invited to any auto-join rooms which have been set to invite-only (either # at the time of creation or subsequently). # # Note that, if the room already exists, this user must be joined and # have the appropriate permissions to invite new members. # #auto_join_mxid_localpart: system # When auto_join_rooms is specified, setting this flag to false prevents # guest accounts from being automatically joined to the rooms. # # Defaults to true. # #auto_join_rooms_for_guests: false """ % locals())
def generate_config_section(self, generate_secrets=False, **kwargs): if generate_secrets: registration_shared_secret = 'registration_shared_secret: "%s"' % ( random_string_with_symbols(50), ) else: registration_shared_secret = "#registration_shared_secret: <PRIVATE STRING>" return ("""\ ## Registration ## # # Registration can be rate-limited using the parameters in the "Ratelimiting" # section of this file. # Enable registration for new users. # #enable_registration: false # Time that a user's session remains valid for, after they log in. # # Note that this is not currently compatible with guest logins. # # Note also that this is calculated at login time: changes are not applied # retrospectively to users who have already logged in. # # By default, this is infinite. # #session_lifetime: 24h # Time that an access token remains valid for, if the session is # using refresh tokens. # For more information about refresh tokens, please see the manual. # Note that this only applies to clients which advertise support for # refresh tokens. # # Note also that this is calculated at login time and refresh time: # changes are not applied to existing sessions until they are refreshed. # # By default, this is 5 minutes. # #refreshable_access_token_lifetime: 5m # Time that a refresh token remains valid for (provided that it is not # exchanged for another one first). # This option can be used to automatically log-out inactive sessions. # Please see the manual for more information. # # Note also that this is calculated at login time and refresh time: # changes are not applied to existing sessions until they are refreshed. # # By default, this is infinite. # #refresh_token_lifetime: 24h # Time that an access token remains valid for, if the session is NOT # using refresh tokens. # Please note that not all clients support refresh tokens, so setting # this to a short value may be inconvenient for some users who will # then be logged out frequently. # # Note also that this is calculated at login time: changes are not applied # retrospectively to existing sessions for users that have already logged in. # # By default, this is infinite. # #nonrefreshable_access_token_lifetime: 24h # The user must provide all of the below types of 3PID when registering. # #registrations_require_3pid: # - email # - msisdn # Explicitly disable asking for MSISDNs from the registration # flow (overrides registrations_require_3pid if MSISDNs are set as required) # #disable_msisdn_registration: true # Uncomment to set the display name of new users to their email address, # rather than using the default heuristic. # #register_just_use_email_for_display_name: true # Mandate that users are only allowed to associate certain formats of # 3PIDs with accounts on this server. # #allowed_local_3pids: # - medium: email # pattern: '^[^@]+@matrix\\.org$' # - medium: email # pattern: '^[^@]+@vector\\.im$' # - medium: msisdn # pattern: '\\+44' # If true, stop users from trying to change the 3PIDs associated with # their accounts. # #disable_3pid_changes: false # Enable 3PIDs lookup requests to identity servers from this server. # #enable_3pid_lookup: true # Require users to submit a token during registration. # Tokens can be managed using the admin API: # https://matrix-org.github.io/synapse/latest/usage/administration/admin_api/registration_tokens.html # Note that `enable_registration` must be set to `true`. # Disabling this option will not delete any tokens previously generated. # Defaults to false. Uncomment the following to require tokens: # #registration_requires_token: true # If set, allows registration of standard or admin accounts by anyone who # has the shared secret, even if registration is otherwise disabled. # %(registration_shared_secret)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 is 12 (which equates to 2^12 rounds). # N.B. that increasing this will exponentially increase the time required # to register or login - e.g. 24 => 2^24 rounds which will take >20 mins. # #bcrypt_rounds: 12 # Allows users to register as guests without a password/email/etc, and # participate in rooms hosted on this server which have been made # accessible to anonymous users. # #allow_guest_access: false # The identity server which we suggest that clients should use when users log # in on this server. # # (By default, no suggestion is made, so it is left up to the client. # This setting is ignored unless public_baseurl is also explicitly set.) # #default_identity_server: https://matrix.org # If enabled, user IDs, display names and avatar URLs will be replicated # to this server whenever they change. # This is an experimental API currently implemented by sydent to support # cross-homeserver user directories. # #replicate_user_profiles_to: example.com # If enabled, don't let users set their own display names/avatars # other than for the very first time (unless they are a server admin). # Useful when provisioning users based on the contents of a 3rd party # directory and to avoid ambiguities. # #disable_set_displayname: false #disable_set_avatar_url: false # Handle threepid (email/phone etc) registration and password resets through a set of # *trusted* identity servers. Note that this allows the configured identity server to # reset passwords for accounts! # # Be aware that if `email` is not set, and SMTP options have not been # configured in the email config block, registration and user password resets via # email will be globally disabled. # # Additionally, if `msisdn` is not set, registration and password resets via msisdn # will be disabled regardless, and users will not be able to associate an msisdn # identifier to their account. This is due to Synapse currently not supporting # any method of sending SMS messages on its own. # # To enable using an identity server for operations regarding a particular third-party # identifier type, set the value to the URL of that identity server as shown in the # examples below. # # Servers handling the these requests must answer the `/requestToken` endpoints defined # by the Matrix Identity Service API specification: # https://matrix.org/docs/spec/identity_service/latest # account_threepid_delegates: #email: https://example.com # Delegate email sending to example.com #msisdn: http://localhost:8090 # Delegate SMS sending to this local process # Whether users are allowed to change their displayname after it has # been initially set. Useful when provisioning users based on the # contents of a third-party directory. # # Does not apply to server administrators. Defaults to 'true' # #enable_set_displayname: false # Whether users are allowed to change their avatar after it has been # initially set. Useful when provisioning users based on the contents # of a third-party directory. # # Does not apply to server administrators. Defaults to 'true' # #enable_set_avatar_url: false # Whether users can change the 3PIDs associated with their accounts # (email address and msisdn). # # Defaults to 'true' # #enable_3pid_changes: false # Users who register on this homeserver will automatically be joined # to these rooms. # # By default, any room aliases included in this list will be created # as a publicly joinable room when the first user registers for the # homeserver. This behaviour can be customised with the settings below. # If the room already exists, make certain it is a publicly joinable # room. The join rule of the room must be set to 'public'. # #auto_join_rooms: # - "#example:example.com" # Where auto_join_rooms are specified, setting this flag ensures that the # the rooms exist by creating them when the first user on the # homeserver registers. # # By default the auto-created rooms are publicly joinable from any federated # server. Use the autocreate_auto_join_rooms_federated and # autocreate_auto_join_room_preset settings below to customise this behaviour. # # Setting to false means that if the rooms are not manually created, # users cannot be auto-joined since they do not exist. # # Defaults to true. Uncomment the following line to disable automatically # creating auto-join rooms. # #autocreate_auto_join_rooms: false # Whether the auto_join_rooms that are auto-created are available via # federation. Only has an effect if autocreate_auto_join_rooms is true. # # Note that whether a room is federated cannot be modified after # creation. # # Defaults to true: the room will be joinable from other servers. # Uncomment the following to prevent users from other homeservers from # joining these rooms. # #autocreate_auto_join_rooms_federated: false # The room preset to use when auto-creating one of auto_join_rooms. Only has an # effect if autocreate_auto_join_rooms is true. # # This can be one of "public_chat", "private_chat", or "trusted_private_chat". # If a value of "private_chat" or "trusted_private_chat" is used then # auto_join_mxid_localpart must also be configured. # # Defaults to "public_chat", meaning that the room is joinable by anyone, including # federated servers if autocreate_auto_join_rooms_federated is true (the default). # Uncomment the following to require an invitation to join these rooms. # #autocreate_auto_join_room_preset: private_chat # The local part of the user id which is used to create auto_join_rooms if # autocreate_auto_join_rooms is true. If this is not provided then the # initial user account that registers will be used to create the rooms. # # The user id is also used to invite new users to any auto-join rooms which # are set to invite-only. # # It *must* be configured if autocreate_auto_join_room_preset is set to # "private_chat" or "trusted_private_chat". # # Note that this must be specified in order for new users to be correctly # invited to any auto-join rooms which have been set to invite-only (either # at the time of creation or subsequently). # # Note that, if the room already exists, this user must be joined and # have the appropriate permissions to invite new members. # #auto_join_mxid_localpart: system # When auto_join_rooms is specified, setting this flag to false prevents # guest accounts from being automatically joined to the rooms. # # Defaults to true. # #auto_join_rooms_for_guests: false # Rewrite identity server URLs with a map from one URL to another. Applies to URLs # provided by clients (which have https:// prepended) and those specified # in `account_threepid_delegates`. URLs should not feature a trailing slash. # #rewrite_identity_server_urls: # "https://somewhere.example.com": "https://somewhereelse.example.com" # When a user registers an account with an email address, it can be useful to # bind that email address to their mxid on an identity server. Typically, this # requires the user to validate their email address with the identity server. # However if Synapse itself is handling email validation on registration, the # user ends up needing to validate their email twice, which leads to poor UX. # # It is possible to force Sydent, one identity server implementation, to bind # threepids using its internal, unauthenticated bind API: # https://github.com/matrix-org/sydent/#internal-bind-and-unbind-api # # Configure the address of a Sydent server here to have Synapse attempt # to automatically bind users' emails following registration. The # internal bind API must be reachable from Synapse, but should NOT be # exposed to any third party, as it allows the creation of bindings # without validation. # #bind_new_user_emails_to_sydent: https://example.com:8091 # Whether to inhibit errors raised when registering a new account if the user ID # already exists. If turned on, that requests to /register/available will always # show a user ID as available, and Synapse won't raise an error when starting # a registration with a user ID that already exists. However, Synapse will still # raise an error if the registration completes and the username conflicts. # # Defaults to false. # #inhibit_user_in_use_error: true """ % locals())