Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit aa01c82

Browse files
committed
Improve documentation around user registration
Update a bunch of the documentation for user registration, add some cross links, etc.
1 parent 998e211 commit aa01c82

File tree

4 files changed

+134
-103
lines changed

4 files changed

+134
-103
lines changed

changelog.d/13640.doc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improve documentation around user registration.

docs/admin_api/register_api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ non-interactive way. This is generally used for bootstrapping a Synapse
55
instance with administrator accounts.
66

77
To authenticate yourself to the server, you will need both the shared secret
8-
(`registration_shared_secret` in the homeserver configuration), and a
9-
one-time nonce. If the registration shared secret is not configured, this API
10-
is not enabled.
8+
([`registration_shared_secret`](../configuration/config_documentation.md#registration_shared_secret)
9+
in the homeserver configuration), and a one-time nonce. If the registration
10+
shared secret is not configured, this API is not enabled.
1111

1212
To fetch the nonce, you need to request one from the API:
1313

docs/setup/installation.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -506,9 +506,13 @@ email will be disabled.
506506

507507
### Registering a user
508508

509-
The easiest way to create a new user is to do so from a client like [Element](https://element.io/).
509+
One way to create a new user is to do so from a client like
510+
[Element](https://element.io/). This requires registration to be enabled via
511+
the
512+
[`enable_registration`](../usage/configuration/config_documentation.md#enable_registration)
513+
setting.
510514

511-
Alternatively, you can do so from the command line. This can be done as follows:
515+
Alternatively, you can create new users from the command line. This can be done as follows:
512516

513517
1. If synapse was installed via pip, activate the virtualenv as follows (if Synapse was
514518
installed via a prebuilt package, `register_new_matrix_user` should already be
@@ -520,7 +524,7 @@ Alternatively, you can do so from the command line. This can be done as follows:
520524
```
521525
2. Run the following command:
522526
```sh
523-
register_new_matrix_user -c homeserver.yaml http://localhost:8008
527+
register_new_matrix_user -c homeserver.yaml
524528
```
525529

526530
This will prompt you to add details for the new user, and will then connect to
@@ -533,12 +537,13 @@ Make admin [no]:
533537
Success!
534538
```
535539

536-
This process uses a setting `registration_shared_secret` in
537-
`homeserver.yaml`, which is shared between Synapse itself and the
538-
`register_new_matrix_user` script. It doesn't matter what it is (a random
539-
value is generated by `--generate-config`), but it should be kept secret, as
540-
anyone with knowledge of it can register users, including admin accounts,
541-
on your server even if `enable_registration` is `false`.
540+
This process uses a setting
541+
[`registration_shared_secret`](../usage/configuration/config_documentation.md#registration_shared_secret),
542+
which is shared between Synapse itself and the `register_new_matrix_user`
543+
script. It doesn't matter what it is (a random value is generated by
544+
`--generate-config`), but it should be kept secret, as anyone with knowledge of
545+
it can register users, including admin accounts, on your server even if
546+
`enable_registration` is `false`.
542547

543548
### Setting up a TURN server
544549

docs/usage/configuration/config_documentation.md

Lines changed: 116 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1873,8 +1873,8 @@ See [here](../../CAPTCHA_SETUP.md) for full details on setting up captcha.
18731873
---
18741874
### `recaptcha_public_key`
18751875

1876-
This homeserver's ReCAPTCHA public key. Must be specified if `enable_registration_captcha` is
1877-
enabled.
1876+
This homeserver's ReCAPTCHA public key. Must be specified if
1877+
[`enable_registration_captcha`](#enable_registration_captcha) is enabled.
18781878

18791879
Example configuration:
18801880
```yaml
@@ -1883,7 +1883,8 @@ recaptcha_public_key: "YOUR_PUBLIC_KEY"
18831883
---
18841884
### `recaptcha_private_key`
18851885

1886-
This homeserver's ReCAPTCHA private key. Must be specified if `enable_registration_captcha` is
1886+
This homeserver's ReCAPTCHA private key. Must be specified if
1887+
[`enable_registration_captcha`](#enable_registration_captcha) is
18871888
enabled.
18881889

18891890
Example configuration:
@@ -1893,9 +1894,11 @@ recaptcha_private_key: "YOUR_PRIVATE_KEY"
18931894
---
18941895
### `enable_registration_captcha`
18951896

1896-
Set to true to enable ReCaptcha checks when registering, preventing signup
1897-
unless a captcha is answered. Requires a valid ReCaptcha public/private key.
1898-
Defaults to false.
1897+
Set to `true` to require users to complete a CAPTCHA test when registering an account.
1898+
Requires a valid ReCaptcha public/private key.
1899+
Defaults to `false`.
1900+
1901+
Note that [`enable_registration`](#enable_registration) must also be set to allow account registration.
18991902

19001903
Example configuration:
19011904
```yaml
@@ -1971,98 +1974,43 @@ Registration can be rate-limited using the parameters in the [Ratelimiting](#rat
19711974
---
19721975
### `enable_registration`
19731976

1974-
Enable registration for new users. Defaults to false. It is highly recommended that if you enable registration,
1975-
you use either captcha, email, or token-based verification to verify that new users are not bots. In order to enable registration
1976-
without any verification, you must also set `enable_registration_without_verification` to true.
1977-
1978-
Example configuration:
1979-
```yaml
1980-
enable_registration: true
1981-
```
1982-
---
1983-
### `enable_registration_without_verification`
1984-
Enable registration without email or captcha verification. Note: this option is *not* recommended,
1985-
as registration without verification is a known vector for spam and abuse. Defaults to false. Has no effect
1986-
unless `enable_registration` is also enabled.
1987-
1988-
Example configuration:
1989-
```yaml
1990-
enable_registration_without_verification: true
1991-
```
1992-
---
1993-
### `session_lifetime`
1994-
1995-
Time that a user's session remains valid for, after they log in.
1996-
1997-
Note that this is not currently compatible with guest logins.
1998-
1999-
Note also that this is calculated at login time: changes are not applied retrospectively to users who have already
2000-
logged in.
2001-
2002-
By default, this is infinite.
2003-
2004-
Example configuration:
2005-
```yaml
2006-
session_lifetime: 24h
2007-
```
2008-
----
2009-
### `refresh_access_token_lifetime`
2010-
2011-
Time that an access token remains valid for, if the session is using refresh tokens.
2012-
2013-
For more information about refresh tokens, please see the [manual](user_authentication/refresh_tokens.md).
2014-
2015-
Note that this only applies to clients which advertise support for refresh tokens.
2016-
2017-
Note also that this is calculated at login time and refresh time: changes are not applied to
2018-
existing sessions until they are refreshed.
2019-
2020-
By default, this is 5 minutes.
1977+
Enable registration for new users. Defaults to `false`.
20211978

2022-
Example configuration:
2023-
```yaml
2024-
refreshable_access_token_lifetime: 10m
2025-
```
2026-
---
2027-
### `refresh_token_lifetime: 24h`
1979+
It is highly recommended that if you enable registration, you set one or more
1980+
or the following options, to avoid abuse of your server by "bots":
20281981

2029-
Time that a refresh token remains valid for (provided that it is not
2030-
exchanged for another one first).
2031-
This option can be used to automatically log-out inactive sessions.
2032-
Please see the manual for more information.
1982+
* [`enable_registration_captcha`](#enable_registration_captcha)
1983+
* [`registrations_require_3pid`](#registrations_require_3pid)
1984+
* [`registration_requires_token`](#registration_requires_token)
20331985

2034-
Note also that this is calculated at login time and refresh time:
2035-
changes are not applied to existing sessions until they are refreshed.
1986+
(In order to enable registration without any verification, you must also set
1987+
[`enable_registration_without_verification`](#enable_registration_without_verification).)
20361988

2037-
By default, this is infinite.
1989+
Note that even if this setting is disabled, new accounts can still be created
1990+
via the admin API if
1991+
[`registration_shared_secret`](#registration_shared_secret) is set.
20381992

20391993
Example configuration:
20401994
```yaml
2041-
refresh_token_lifetime: 24h
1995+
enable_registration: true
20421996
```
20431997
---
2044-
### `nonrefreshable_access_token_lifetime`
2045-
2046-
Time that an access token remains valid for, if the session is NOT
2047-
using refresh tokens.
2048-
2049-
Please note that not all clients support refresh tokens, so setting
2050-
this to a short value may be inconvenient for some users who will
2051-
then be logged out frequently.
2052-
2053-
Note also that this is calculated at login time: changes are not applied
2054-
retrospectively to existing sessions for users that have already logged in.
1998+
### `enable_registration_without_verification`
20551999

2056-
By default, this is infinite.
2000+
Enable registration without email or captcha verification. Note: this option is *not* recommended,
2001+
as registration without verification is a known vector for spam and abuse. Defaults to false. Has no effect
2002+
unless [`enable_registration`](#enable_registration) is also enabled.
20572003

20582004
Example configuration:
20592005
```yaml
2060-
nonrefreshable_access_token_lifetime: 24h
2006+
enable_registration_without_verification: true
20612007
```
20622008
---
20632009
### `registrations_require_3pid`
20642010

2065-
If this is set, the user must provide all of the specified types of 3PID when registering.
2011+
If this is set, users must provide all of the specified types of 3PID when registering an account.
2012+
2013+
Note that [`enable_registration`](#enable_registration) must also be set to allow account registration.
20662014

20672015
Example configuration:
20682016
```yaml
@@ -2110,9 +2058,11 @@ enable_3pid_lookup: false
21102058

21112059
Require users to submit a token during registration.
21122060
Tokens can be managed using the admin [API](../administration/admin_api/registration_tokens.md).
2113-
Note that `enable_registration` must be set to true.
21142061
Disabling this option will not delete any tokens previously generated.
2115-
Defaults to false. Set to true to enable.
2062+
Defaults to `false`. Set to `true` to enable.
2063+
2064+
2065+
Note that [`enable_registration`](#enable_registration) must also be set to allow account registration.
21162066

21172067
Example configuration:
21182068
```yaml
@@ -2121,8 +2071,13 @@ registration_requires_token: true
21212071
---
21222072
### `registration_shared_secret`
21232073

2124-
If set, allows registration of standard or admin accounts by anyone who
2125-
has the shared secret, even if registration is otherwise disabled.
2074+
If set, allows registration of standard or admin accounts by anyone who has the
2075+
shared secret, even if [`enable_registration`](#enable_registration) is not
2076+
set.
2077+
2078+
This is primarily intended for use with the `register_new_matrix_user` script
2079+
(see [Registering a user](../../setup/installation.md#registering-a-user));
2080+
however, the interface is [documented](../admin_api/register_api.html).
21262081

21272082
See also [`registration_shared_secret_path`](#registration_shared_secret_path).
21282083

@@ -2376,6 +2331,79 @@ Example configuration:
23762331
```yaml
23772332
inhibit_user_in_use_error: true
23782333
```
2334+
---
2335+
## User session management
2336+
---
2337+
### `session_lifetime`
2338+
2339+
Time that a user's session remains valid for, after they log in.
2340+
2341+
Note that this is not currently compatible with guest logins.
2342+
2343+
Note also that this is calculated at login time: changes are not applied retrospectively to users who have already
2344+
logged in.
2345+
2346+
By default, this is infinite.
2347+
2348+
Example configuration:
2349+
```yaml
2350+
session_lifetime: 24h
2351+
```
2352+
----
2353+
### `refresh_access_token_lifetime`
2354+
2355+
Time that an access token remains valid for, if the session is using refresh tokens.
2356+
2357+
For more information about refresh tokens, please see the [manual](user_authentication/refresh_tokens.md).
2358+
2359+
Note that this only applies to clients which advertise support for refresh tokens.
2360+
2361+
Note also that this is calculated at login time and refresh time: changes are not applied to
2362+
existing sessions until they are refreshed.
2363+
2364+
By default, this is 5 minutes.
2365+
2366+
Example configuration:
2367+
```yaml
2368+
refreshable_access_token_lifetime: 10m
2369+
```
2370+
---
2371+
### `refresh_token_lifetime: 24h`
2372+
2373+
Time that a refresh token remains valid for (provided that it is not
2374+
exchanged for another one first).
2375+
This option can be used to automatically log-out inactive sessions.
2376+
Please see the manual for more information.
2377+
2378+
Note also that this is calculated at login time and refresh time:
2379+
changes are not applied to existing sessions until they are refreshed.
2380+
2381+
By default, this is infinite.
2382+
2383+
Example configuration:
2384+
```yaml
2385+
refresh_token_lifetime: 24h
2386+
```
2387+
---
2388+
### `nonrefreshable_access_token_lifetime`
2389+
2390+
Time that an access token remains valid for, if the session is NOT
2391+
using refresh tokens.
2392+
2393+
Please note that not all clients support refresh tokens, so setting
2394+
this to a short value may be inconvenient for some users who will
2395+
then be logged out frequently.
2396+
2397+
Note also that this is calculated at login time: changes are not applied
2398+
retrospectively to existing sessions for users that have already logged in.
2399+
2400+
By default, this is infinite.
2401+
2402+
Example configuration:
2403+
```yaml
2404+
nonrefreshable_access_token_lifetime: 24h
2405+
```
2406+
23792407
---
23802408
## Metrics ###
23812409
Config options related to metrics.
@@ -2660,13 +2688,10 @@ key_server_signing_keys_path: "key_server_signing_keys.key"
26602688
The following settings can be used to make Synapse use a single sign-on
26612689
provider for authentication, instead of its internal password database.
26622690

2663-
You will probably also want to set the following options to false to
2691+
You will probably also want to set the following options to `false` to
26642692
disable the regular login/registration flows:
2665-
* `enable_registration`
2666-
* `password_config.enabled`
2667-
2668-
You will also want to investigate the settings under the "sso" configuration
2669-
section below.
2693+
* [`enable_registration`](#enable_registration)
2694+
* [`password_config.enabled`](#password_config)
26702695

26712696
---
26722697
### `saml2_config`

0 commit comments

Comments
 (0)