From 9d5708f0e52e43ff53e960d67e82b65caae4e303 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Thu, 24 Mar 2022 15:14:58 +0100 Subject: [PATCH] New post about matrix migration --- Gemfile.lock | 4 +- ...rate-encrypted-room-to-a-clear-text-one.md | 65 +++++++++++++++++++ 2 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 _posts/2022-03-24-matrix-migrate-encrypted-room-to-a-clear-text-one.md diff --git a/Gemfile.lock b/Gemfile.lock index 0afcb73..d96aded 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,7 +29,6 @@ GEM rouge (~> 3.0) safe_yaml (~> 1.0) terminal-table (~> 2.0) - jekyll-paginate (1.1.0) jekyll-sass-converter (2.1.0) sassc (> 2.0.1, < 3.0) jekyll-sitemap (1.4.0) @@ -68,7 +67,6 @@ PLATFORMS DEPENDENCIES jekyll (>= 4.2.0) - jekyll-paginate jekyll-sitemap racc redcarpet @@ -76,4 +74,4 @@ DEPENDENCIES webrick (~> 1.7) BUNDLED WITH - 2.2.15 + 2.2.33 diff --git a/_posts/2022-03-24-matrix-migrate-encrypted-room-to-a-clear-text-one.md b/_posts/2022-03-24-matrix-migrate-encrypted-room-to-a-clear-text-one.md new file mode 100644 index 0000000..35fec36 --- /dev/null +++ b/_posts/2022-03-24-matrix-migrate-encrypted-room-to-a-clear-text-one.md @@ -0,0 +1,65 @@ +--- +layout: post +slug: matrix-migrate-encrypted-room-to-a-clear-text-one +status: published +sitemap: true +title: "Matrix: Migrate an encrypted room to a clear text one" +description: Matrix E2EE does not work well with public roooms +category: operation +tags: +--- + +Some time ago, the Matrix team was pushing hard E2EE and activated for all created rooms. +Believing encryption was the future, we kept this default for all the rooms we created. +But now that one of our room starts being popular, it appeares that E2EE does not work well with public rooms: + 1. the history is not available to newcomers + 2. we can not search the history of an encrypted room (or at least, I never managed to make it work even with the desktop app) + 3. notifications options are limited on mobile + 4. scaling issues + 5. and so on. + +It seems that Matrix developpers are aware of these problems as now, if you create a "public room", you will not be asked to encrypt it at all. +But for existing rooms, we have a problem: for security reasons, you can't disable encryption in a room. +Our only option is to create a new room and to point the old one to the new one. +Thankfully, Matrix has a feature named **Tombstone** that helps redirecting users from one room to another. +This feature is used for room version upgrade, but we can "abuse" it to redirect people to a completely different room. + +First, you must create a new clear text room. +To provide the best experience to your users, take time to configure its picture, description, and so on. +Now, go to your old room, remove all its aliases to be able to set them on the new room. +You can set a new alias for your old room and send a message containing it on your new room, to "connect it with the old one", eg: + +> Hi, this is the beginning of the history of this room. If you want to go back even more in time, check the old room: #myroom-old:example.tld + +Finally, you need the identifier of your room. It starts with a `!`. For example: `!ARbIZeDKGloDOnjyyw:deuxfleurs.fr`. +Keep it somewhere accessible, and we are done configuring our new room. + +We can now prepare the tombstone for the old room. +First, you should inform your users with a message, something like: + +> Hi @room, we are migrating to a new room to fix some issues with this one. +You will not be able to post new messages here, please follow the provided redirection to join the new room. +Sorry for the inconvenience. + +Now, open the developper tools in your old room by typing in the message box: + +``` +/devtools +``` + +*You can also open it by going in "Room Settings" -> "Advanced" -> "Open Devtools"* + +A window must appear. Click on "Send Custom Event". Then click on the red button "Event" to create a "State Event". +Put `m.room.tombstone` as the Event Type, keep the State Key field empty, and finally enter the following content (replace the example room ID by the one of your new room): + +```json +{ + "body": "We migrated to a cleartext rooms as E2EE does not work well with large public rooms", + "replacement_room": "!ARbIZeDKGloDOnjyyw:deuxfleurs.fr" +} +``` + +And that's all, you have migrated your old encrypted room to a new clear text one! + +If you want to explore all the possibilities offered by the developer tools, you can read [Matrix specification](https://spec.matrix.org/). +For example, our tombstone event is documented here: [`m.room.tombstone`](https://spec.matrix.org/v1.2/client-server-api/#mroomtombstone)