Skip to content
Snippets Groups Projects
Unverified Commit 46b01515 authored by Erik Johnston's avatar Erik Johnston Committed by GitHub
Browse files

Merge pull request #4757 from matrix-org/erikj/key_api_fed_readae

Move server key queries to federation reader
parents 7590e9fa d4dc527a
No related branches found
No related tags found
No related merge requests found
Move server key queries to federation reader.
...@@ -182,6 +182,7 @@ endpoints matching the following regular expressions:: ...@@ -182,6 +182,7 @@ endpoints matching the following regular expressions::
^/_matrix/federation/v1/event_auth/ ^/_matrix/federation/v1/event_auth/
^/_matrix/federation/v1/exchange_third_party_invite/ ^/_matrix/federation/v1/exchange_third_party_invite/
^/_matrix/federation/v1/send/ ^/_matrix/federation/v1/send/
^/_matrix/key/v2/query
The above endpoints should all be routed to the federation_reader worker by the The above endpoints should all be routed to the federation_reader worker by the
reverse-proxy configuration. reverse-proxy configuration.
......
...@@ -21,7 +21,7 @@ from twisted.web.resource import NoResource ...@@ -21,7 +21,7 @@ from twisted.web.resource import NoResource
import synapse import synapse
from synapse import events from synapse import events
from synapse.api.urls import FEDERATION_PREFIX from synapse.api.urls import FEDERATION_PREFIX, SERVER_KEY_V2_PREFIX
from synapse.app import _base from synapse.app import _base
from synapse.config._base import ConfigError from synapse.config._base import ConfigError
from synapse.config.homeserver import HomeServerConfig from synapse.config.homeserver import HomeServerConfig
...@@ -44,6 +44,7 @@ from synapse.replication.slave.storage.registration import SlavedRegistrationSto ...@@ -44,6 +44,7 @@ from synapse.replication.slave.storage.registration import SlavedRegistrationSto
from synapse.replication.slave.storage.room import RoomStore from synapse.replication.slave.storage.room import RoomStore
from synapse.replication.slave.storage.transactions import SlavedTransactionStore from synapse.replication.slave.storage.transactions import SlavedTransactionStore
from synapse.replication.tcp.client import ReplicationClientHandler from synapse.replication.tcp.client import ReplicationClientHandler
from synapse.rest.key.v2 import KeyApiV2Resource
from synapse.server import HomeServer from synapse.server import HomeServer
from synapse.storage.engines import create_engine from synapse.storage.engines import create_engine
from synapse.util.httpresourcetree import create_resource_tree from synapse.util.httpresourcetree import create_resource_tree
...@@ -99,6 +100,9 @@ class FederationReaderServer(HomeServer): ...@@ -99,6 +100,9 @@ class FederationReaderServer(HomeServer):
), ),
}) })
if name in ["keys", "federation"]:
resources[SERVER_KEY_V2_PREFIX] = KeyApiV2Resource(self)
root_resource = create_resource_tree(resources, NoResource()) root_resource = create_resource_tree(resources, NoResource())
_base.listen_tcp( _base.listen_tcp(
......
...@@ -142,6 +142,9 @@ def default_config(name): ...@@ -142,6 +142,9 @@ def default_config(name):
config.saml2_enabled = False config.saml2_enabled = False
config.public_baseurl = None config.public_baseurl = None
config.default_identity_server = None config.default_identity_server = None
config.key_refresh_interval = 24 * 60 * 60 * 1000
config.old_signing_keys = {}
config.tls_fingerprints = []
config.use_frozen_dicts = False config.use_frozen_dicts = False
...@@ -457,6 +460,9 @@ class MockKey(object): ...@@ -457,6 +460,9 @@ class MockKey(object):
def verify(self, message, sig): def verify(self, message, sig):
assert sig == b"\x9a\x87$" assert sig == b"\x9a\x87$"
def encode(self):
return b"<fake_encoded_key>"
class MockClock(object): class MockClock(object):
now = 1000 now = 1000
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment