Skip to content

Commit ff06b5e

Browse files
reivilibresandhose
authored andcommitted
syn2mas: document new tool
1 parent e378539 commit ff06b5e

File tree

1 file changed

+74
-27
lines changed

1 file changed

+74
-27
lines changed

docs/setup/migration.md

Lines changed: 74 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,29 @@ There will be tools to help with the migration process itself. But these aren't
1818

1919
The deployment is non-trivial so it is important to read through and understand the steps involved and make a plan before starting.
2020

21-
### Get `syn2mas`
21+
### Is your setup ready to be migrated?
2222

23-
The easiest way to get `syn2mas` is through [`npm`](https://www.npmjs.com/package/@vector-im/syn2mas):
23+
#### SAML2 and LDAP Single Sign-On Providers are not supported
2424

25-
```sh
26-
npm install -g @vector-im/syn2mas
27-
```
25+
A deployment which requires SAML or LDAP-based authentication should use a service like [Dex](https://github.com/dexidp/dex) to bridge between the SAML provider and the authentication service.
26+
MAS is different from Synapse in that it does **not** have built-in support for SAML or LDAP-based providers.
2827

29-
### Run the migration advisor
28+
#### Custom password providers are not supported
3029

31-
You can use the advisor mode of the `syn2mas` tool to identify extra configuration steps or issues with the configuration of the homeserver.
30+
If your Synapse homeserver currently uses a custom password provider module, please note that MAS does not support these.
3231

33-
```sh
34-
syn2mas --command=advisor --synapseConfigFile=homeserver.yaml
35-
```
32+
#### SQLite databases are not supported
3633

37-
This will output `WARN` entries for any identified actions and `ERROR` entries in the case of any issues that will prevent the migration from working.
34+
It is worth noting that MAS currently only supports PostgreSQL as a database backend.
3835

3936
### Install and configure MAS alongside your existing homeserver
4037

4138
Follow the instructions in the [installation guide](installation.md) to install MAS alongside your existing homeserver.
4239

40+
You'll need a blank PostgreSQL database for MAS to use; it does not share the database with the homeserver.
41+
42+
Set up a configuration file but don't start MAS, or create any users, yet.
43+
4344
#### Local passwords
4445

4546
Synapse uses bcrypt as its password hashing scheme while MAS defaults to using the newer argon2id.
@@ -52,65 +53,111 @@ Example passwords configuration:
5253
passwords:
5354
enabled: true
5455
schemes:
55-
- version: 1
56+
- version: 1 # TODO I think v:2 has to come first in this list
5657
algorithm: bcrypt
5758
# Optional, must match the `password_config.pepper` in the Synapse config
5859
#secret: secretPepperValue
5960
- version: 2
6061
algorithm: argon2id
6162
```
6263
64+
If you have a pepper configured in your Synapse password configuration, you'll need to match that on version 1 of the equivalent MAS configuration.
65+
66+
The migration checker will inform you if this has not been configured properly.
67+
6368
### Map any upstream SSO providers
6469
65-
If you are using an upstream SSO provider then you will need to provision the upstream provide in MAS manually.
70+
If you are using an upstream SSO provider, then you will need to configure the upstream provider in MAS manually.
6671
67-
Each upstream provider will need to be given as an `--upstreamProviderMapping` command line option to the import tool.
72+
MAS does not support SAML or LDAP upstream providers.
73+
If you are using one of these, you will need to use an adapter such as Dex at this time,
74+
but we have not yet documented this procedure.
6875
69-
### Prepare the MAS database
76+
Each upstream provider that was used by at least one user in Synapse will need to be configured in MAS.
7077
71-
Once the database is created, it still needs to have its schema created and synced with the configuration.
72-
This can be done with the following command:
78+
Set the `synapse_idp_id` attribute on the provider to:
7379

74-
```sh
75-
mas-cli config sync
76-
```
80+
- `"oidc"` if you used an OIDC provider in Synapse's legacy `oidc_config` configuration section.
81+
- `"oidc-myprovider"` if you used an OIDC provider in Synapse's `oidc_providers` configuration list,
82+
with a `provider` of `"myprovider"`.
83+
(This is because Synapse prefixes the provider ID with `oidc-` internally.)
7784

78-
### Do a dry-run of the import to test
85+
Without the `synapse_idp_id`s being set, syn2mas does not understand which providers
86+
in Synapse correspond to which provider in MAS.
87+
88+
!!!!!!!!! TODO add an example here
89+
90+
The migration checker will inform you if a provider is missing from MAS' config.
91+
92+
### Run the migration checker
93+
94+
You can use the `check` command of the `syn2mas` tool to identify configuration problems before starting the migration.
95+
You do not need to stop Synapse to run this command.
7996

8097
```sh
81-
syn2mas --command migrate --synapseConfigFile homeserver.yaml --masConfigFile config.yaml --dryRun
98+
mas-cli --config mas_config.yaml syn2mas --synapse-config homeserver.yaml check
8299
```
83100

84-
If no errors are reported then you can proceed to the next step.
101+
This will either output a list of errors and warnings, or tell you that the check completed with no errors or warnings.
102+
103+
If you have any errors, you must resolve these before starting the migration.
104+
105+
If you have any warnings, please read, understand and possibly resolve them.
106+
With that said, resolving them is not strictly required before starting the migration.
107+
108+
### Do a dry-run of the import to test
109+
110+
!!!!!!! TODO we don't have an exact dry-run mode exposed at the moment...
85111

86112
## Doing the migration
87113

88114
Having done the preparation, you can now proceed with the actual migration. Note that this will require downtime for the homeserver and is not easily reversible.
89115

90-
### Backup your data
116+
### Backup your data and configuration
91117

92118
As with any migration, it is important to backup your data before proceeding.
93119

120+
We also suggest making a backup copy of your homeserver's known good configuration,
121+
before making any changes to enable MAS integration.
122+
94123
### Shutdown the homeserver
95124

96125
This is to ensure that no new sessions are created whilst the migration is in progress.
97126

98-
### Configure the homeserver
127+
### Configure the homeserver to enable MAS integration
99128

100129
Follow the instructions in the [homeserver configuration guide](homeserver.md) to configure the homeserver to use MAS.
101130

102131
### Do the import
103132

104-
Run `syn2mas` in non-dry-run mode.
133+
Once the homeserver has been stopped, MAS has been configured (but is not running!)
134+
and you have a successful migration check,
135+
run `syn2mas`'s `migrate` command.
136+
137+
Other than the change of command word, the syntax is exactly the same as the `check` command.
105138

106139
```sh
107-
syn2mas --command migrate --synapseConfigFile homeserver.yaml --masConfigFile config.yaml --dryRun false
140+
mas-cli --config mas_config.yaml syn2mas --synapse-config homeserver.yaml migrate
108141
```
109142

143+
#### What to do if it goes wrong
144+
145+
If the migration fails with an error:
146+
147+
- You can either try to fix the error and make another attempt by re-running the command; or
148+
- you can revert your homeserver configuration (so MAS integration is disabled once more)
149+
and abort the migration for now. In this case, you should not start MAS up.
150+
151+
Please report migration failures to the developers.
152+
110153
### Start up the homeserver
111154

112155
Start up the homeserver again with the new configuration.
113156

157+
### Start up MAS
158+
159+
Start up MAS.
160+
114161
### Update or serve the .well-known
115162

116163
The `.well-known/matrix/client` needs to be served as described [here](./well-known.md).

0 commit comments

Comments
 (0)