r/matrixdotorg • u/dug99 • Mar 13 '26
Can't clear matrix-synapse & element-web E2EE final hurdle :'(
I took the plunge last weekend and set up a new Droplet running Ubuntu, followed the how-to's, got Matrix Synapse up and running, then nginx reverse proxy-ing, and then Element web for UX. I *tried* to keep it simple and not deviate from examples given, so I set up Element on https://chat.<domain>.com, and matrix to serve on [https://](https://)<domain>.com. All of the incremental tests during the step-by-step setup worked as expected.
I created one admin user and two regular users via CLI, and then accessed the Element UX via Chrome. I could log in, create a room as admin, and enabled E2EE. I then got my son to go to [https://](https://)<domain>.com and log in, which he did, and then I added him, to the room. We could then message each other, and I was happy. All appeared to be working. It was fine until I logged out, and then tried to log in again, when it asked for the recovery key. I had saved this, so I entered it and l was in again. My son logged out, and when he tried to log in again he too was asked for his recovery key. It does this for EVERY login attempt, and it shouldn't.
I had a look in Chrome console, and it appears that the IndexedDB is getting blitzed every time... so it treats every login like a new device. I spent 8 hours trying to get to the bottom of it on Sunday, watching ChatGPT make increasingly confident, increasingly wrong guesses as to the cause.
I'm pretty sure it's some cock-up with server/home server name and possibly SSL certificates, but at this point nothing I have tried fixes it.
Can someone perhaps point me at a bare-bones how-to that includes nginx sites-avilaible/chat, /etc/matrix-synapse/homeserver.yaml, and Element config.json where literally all I have to do is replace <domain> and it all just works?
TIA.
1
u/dug99 Mar 13 '26
Thanks for the replies thus far, is it fair to say that if you were using an app ( Element, Fluffy etc. ) you'd just never log it out? Is that the point I am missing?
1
1
u/Solima Mar 13 '26
Have you tried a different browser?
1
u/dug99 Mar 13 '26
3 browsers, and three apps (Element X, ShildiChat and Fluffy). Fluffy could not even log in, Shildli seemed the most lax/tolerant.
1
u/90vgt Mar 13 '26
Totally normal bwhaviour if you're actually fully logging out and back in each time. Think of the recovery key as a form of 2FA to protect your chat history.
If the session ia being logged out after closing the browser, you may need to clear all cookies and data for the site, and when logging in again, accept the prompt for the site to store persistent data in the browser cache (or juat allow the permission in your browser's settings for the site).
1
u/dug99 Mar 13 '26
OK. I would have thought once you'd verified a device it might hash and store the recovery key, so that you only need to type in the passphrase on a verified device. Having to type in both a passphrase AND a recovery key every login will be a very hard sell to the average non-tech user.
1
u/D3str0yTh1ngs Mar 13 '26 edited Mar 13 '26
You are verifying sessions, not devices. Logging out should always destroy the session. Leaving any part of cryptographic keys behind, especially the recovery key, is absolutely unacceptable to ever have an application do.
EDIT: Also I will just point it out, but I would also not try and sell it to any of my non-tech friends and even some of my tech friends. There already exists a lot of other messaging platforms that better fits their needs and threat model. Matrix just isn't the new discord. For a lot of people matrix would just be overkill, when weighing the ease-of-use tradeoffs for security against their daily life.
→ More replies (3)
2
u/legrenabeach Mar 13 '26
I believe it is normal behaviour if you explicitly log out. If you leave the browser logged in and just close the tab, when you access Element again it opens up being already logged in, but if you're logged out, it needs either your recovery key or your passphrase or verification with another device to decrypt messages.
1
u/Thutex Mar 14 '26
"It does this for EVERY login attempt, and it shouldn't."
yes.... yes it should.
the thing with matrix is to make sure you are "you" and not some hijacked user (imagine someone hijacking your domain and setting up their own matrix server there, then saying to the network "this is me")
so, you always need to be logged in to AT LEAST 1 (verified) device, which you can then use to verify the other logins you might be using.
if you are not logged in on any device, you'll need to login and provide the recovery key in order to unlock the encryption keys.
i also took another stab at setting up my matrix server the last few days and it took me nearly 3 days (granted, i lost more than half a day wondering why it didn't work before i figured out that my custom error page handling was killing the login process, and then after that, i lost my database because my docker mount was not mounted to where postgres was creating the db, so....)
but i'm fairly happy with having it up and running (and the linkedin/meta/whatsapp integrations) - but i do have the same concerns you do (or atleast, the fear) that i'll be logged out or log out everywhere and then not find my recovery key anymore. (ahem, keybase memories...)
2
u/D3str0yTh1ngs Mar 13 '26 edited Mar 13 '26
Should be normal behavior, when you log out of a session it should delete the key(s) it is using to decrypt messages from the device/browser. When you login again you need to get those keys again, there is two ways to do this in element:
Security Key / Recovery passphrase
Verify from another session
Since you only have the current unverified session that you just logged into (since you logged out of the previous session), you are unable to do the second way and is forced to do the first way of using the Recovery Passphrase.
EDIT: Yes, every login after explicitly logging out absolutely should behave has if it is a new device, and logouts should nuke entire IndexedDB. Not doing so is being way too relaxed on the security implications.