-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
StoreKeyFetcher seems to do nothing if not using a trusted key server #15171
Comments
On this, I asked Rich:
His reply shed some light:
I also noticed:
Presumably the perspectives one is designed to let you query multiple keyservers. |
Is it possible that this is the trigger for the behavior in #14805 ? |
This issue makes it more likely that workers will request keys---but only on homeservers that are not using a trusted key server. But even if this issue was fixed, non-federation-sender workers could still make key requests. E.g.
|
Note that if you do have one configured it will ask the perspectives key server and then store the results in both So this sounds to me like the initial |
I find the following helpful to visualize this: flowchart
subgraph Keyring
StoreKeyFetcher
PerspectivesKeyFetcher
ServerKeyFetcher
StoreKeyFetcher ==> PerspectivesKeyFetcher ==> ServerKeyFetcher;
end
StoreKeyFetcher
server_signature_keys -- get_server_verify_keys --> StoreKeyFetcher;
PerspectivesKeyFetcher -- store_server_verify_keys --> server_signature_keys;
PerspectivesKeyFetcher -- store_server_keys_json --> server_keys_json;
ServerKeyFetcher -- store_server_keys_json --> server_keys_json;
subgraph Database
server_signature_keys[(server_signature_keys)]
server_keys_json[(server_keys_json)]
end
|
Based on the above diagram, we believe that SELECT *
FROM server_signature_keys
LEFT JOIN server_keys_json USING (server_name, key_id)
WHERE key_json IS NULL; This takes the subset, left joins the superset and then queries for anything in I ran this on a handful of servers and they call found 0 rows. 🎉 |
Conclusion: we should put a bandaid on this by making StoreKeyFetcher query both tables. At some point we should also figure out why we have two tables and if we can merge them. |
#15463 is a follow-up to clean up these tables. |
Suppose we try to fetch keys from some homeserver we've never heard of.
We'll first try to use StoreKeyFetcher, which calls
synapse/synapse/crypto/keyring.py
Line 513 in 9bb2eac
server_signature_keys
:synapse/synapse/storage/databases/main/keys.py
Lines 65 to 68 in b76f1a4
That will return no keys. So next we'll try the PerspectivesKeyFetcher, but that will do nothing because we have no trusted key server configured.
So next we try the ServerKeyFetcher. That will fetch keys via
synapse/synapse/crypto/keyring.py
Line 844 in 9bb2eac
and
synapse/synapse/crypto/keyring.py
Lines 901 to 905 in 9bb2eac
before caling
synapse/synapse/crypto/keyring.py
Line 605 in 9bb2eac
which writes to
server_keys_json
.If we try to re-fetch keys for that server, we'll try the StoreKeyFetcher. But as we saw above, that reads from a different table (
server_signature_keys
). So we'll end up repeating the same steps and making another federation request via ServerKeyFetcher.The text was updated successfully, but these errors were encountered: