spantaleev / matrix-docker-ansible-deploy

🐳 Matrix (An open network for secure, decentralized communication) server setup using Ansible and Docker
GNU Affero General Public License v3.0
4.89k stars 1.04k forks source link

Enable key discovery api per default via keys ressource in synapse role #1761

Open yncyrydybyl opened 2 years ago

yncyrydybyl commented 2 years ago

When trying to get a key from my server I discovered that the keys ressource is not per default enabled. The method: https://matrix.org/docs/spec/server_server/r0.1.4#get-matrix-key-v2-query-servername-keyid

#no auth needed
curl https://matrix.myserver.org/_matrix/key/v2/query/datanauten.de

The line default is set in mail.yml of the synapse role:

matrix_synapse_http_listener_resource_names: ["client"]

I think It should also cover the "keys" ressource. As described in https://github.com/matrix-org/synapse/blob/7013e06e2f60e1401349fd054372808376facc87/docs/sample_config.yaml#L287

matrix_synapse_http_listener_resource_names: ["client","keys"]

The federation ressource is coving it already. But since it is a client method it should be also availible via client-server port.

spantaleev commented 2 years ago

You're linking to https://matrix.org/docs/spec/server_server/r0.1.4#get-matrix-key-v2-query-servername-keyid (GET /_matrix/key/v2/query/{serverName}/{keyId}), which is part of the "Server-Server (Federation) API".

You're however trying to access this GET /_matrix/key/v2/query/{serverName}/{keyId} resource over the Client-Server API (e.g. https://matrix.DOMAIN/_matrix/key/v2/query/datanauten.de).

With the default (recommended) configuration, the playbook serves the federation API on port 8448, so you should be accessing this at https://matrix.DOMAIN:8448/_matrix/key/v2/query/datanauten.de instead. I've tested it on my setup and it works as expected.


But since it is a client method it should be also availible via client-server port.

I don't know what you're basing this on. The Client-Server API specs do not mention this /_matrix/key API at all, so I don't think it's a client method.

If some client is try to access the /_matrix/key API over the Client-Server API, it's likely that: