sydent
sydent copied to clipboard
Don't update an existing config file
Followed by #402 and #404.
Currently, if you delete the signing key from the config file, a new one gets generated and the config file gets updated.
This causes two issues:
- The config file cannot be set to be read-only.
- You may want a minimal config file (with only the things you're overriding from the defaults) but this update will write all of the default values into your minimal config file as well.
How Sydent will now behave:
- If there is no config file, generate a new one and then stop, with log message telling user to run the generate-key script.
- If there is a config file and it has a base64 encoded signing key, run as normal.
- If there is a config file and it has a hex encoded signing key, run as before but without updating the format of the signing key to base64 (instead log a warning telling the user to run the new update-key script) - note keys haven't been Hex encoded since 2015
- If there is a config file and it has no signing key, exit with log message telling user to run the generate-key script
The idea is that in the future the user can/must instead run a generate-config script before the first run of Sydent, and there will be documentation on how the configuration works.
This isn't particularly a loss of backwards compatability, for people updating from previous versions:
- If they have an existing config, the only change they'll experience is having to run the the generate-key script to make new keys instead of just being able to delete their value from the config.
- If they don't have an existing config, they need to run the generate-key script before they can get Sydent to start. (Or generate-config script added in #404)
Do we want to put upgrade notes for this somewhere? It seems like it would mostly be copying out of the description. Probably in the CHANGELOG.md
file directly?
I'm going to throw this back on the @matrix-org/synapse-core pile as I'm not sure I have enough context into how these keys are used to be confident in my review!
@Azrenbeth I'm going to put this back in your court to do something about https://github.com/matrix-org/sydent/pull/401#discussion_r712414543.