5050If you are *sure* you want to do this, set 'accept_keys_insecurely' on the
5151trusted_key_server configuration."""
5252
53+ TRUSTED_KEY_SERVER_NOT_CONFIGURED_WARN = """\
54+ Synapse requires that a list of trusted key servers are specified in order to
55+ provide signing keys for other servers in the federation.
56+
57+ This homeserver does not have a trusted key server configured in
58+ homeserver.yaml and will fall back to the default of 'matrix.org'.
59+
60+ Trusted key servers should be long-lived and stable which makes matrix.org a
61+ good choice for many admins, but some admins may wish to choose another. To
62+ suppress this warning, the admin should set 'trusted_key_servers' in
63+ homeserver.yaml to their desired key server and 'suppress_key_server_warning'
64+ to 'true'.
65+
66+ In a future release the software-defined default will be removed entirely and
67+ the trusted key server will be defined exclusively by the value of
68+ 'trusted_key_servers'.
69+ --------------------------------------------------------------------------------"""
70+
71+ TRUSTED_KEY_SERVER_CONFIGURED_AS_M_ORG_WARN = """\
72+ This server is configured to use 'matrix.org' as its trusted key server via the
73+ 'trusted_key_servers' config option. 'matrix.org' is a good choice for a key
74+ server since it is long-lived, stable and trusted. However, some admins may
75+ wish to use another server for this purpose.
76+
77+ To suppress this warning and continue using 'matrix.org', admins should set
78+ 'suppress_key_server_warning' to 'true' in homeserver.yaml.
79+ --------------------------------------------------------------------------------"""
5380
5481logger = logging .getLogger (__name__ )
5582
@@ -85,6 +112,7 @@ def read_config(self, config, config_dir_path, **kwargs):
85112 config .get ("key_refresh_interval" , "1d" )
86113 )
87114
115+ suppress_key_server_warning = config .get ("suppress_key_server_warning" , False )
88116 key_server_signing_keys_path = config .get ("key_server_signing_keys_path" )
89117 if key_server_signing_keys_path :
90118 self .key_server_signing_keys = self .read_signing_keys (
@@ -95,6 +123,7 @@ def read_config(self, config, config_dir_path, **kwargs):
95123
96124 # if neither trusted_key_servers nor perspectives are given, use the default.
97125 if "perspectives" not in config and "trusted_key_servers" not in config :
126+ logger .warn (TRUSTED_KEY_SERVER_NOT_CONFIGURED_WARN )
98127 key_servers = [{"server_name" : "matrix.org" }]
99128 else :
100129 key_servers = config .get ("trusted_key_servers" , [])
@@ -108,6 +137,11 @@ def read_config(self, config, config_dir_path, **kwargs):
108137 # merge the 'perspectives' config into the 'trusted_key_servers' config.
109138 key_servers .extend (_perspectives_to_key_servers (config ))
110139
140+ if not suppress_key_server_warning and "matrix.org" in (
141+ s ["server_name" ] for s in key_servers
142+ ):
143+ logger .warning (TRUSTED_KEY_SERVER_CONFIGURED_AS_M_ORG_WARN )
144+
111145 # list of TrustedKeyServer objects
112146 self .key_servers = list (
113147 _parse_key_servers (key_servers , self .federation_verify_certificates )
@@ -190,6 +224,10 @@ def generate_config_section(
190224 # This setting supercedes an older setting named `perspectives`. The old format
191225 # is still supported for backwards-compatibility, but it is deprecated.
192226 #
227+ # 'trusted_key_servers' defaults to matrix.org, but using it will generate a
228+ # warning on start-up. To suppress this warning, set
229+ # 'suppress_key_server_warning' to true.
230+ #
193231 # Options for each entry in the list include:
194232 #
195233 # server_name: the name of the server. required.
@@ -214,11 +252,13 @@ def generate_config_section(
214252 # "ed25519:auto": "abcdefghijklmnopqrstuvwxyzabcdefghijklmopqr"
215253 # - server_name: "my_other_trusted_server.example.com"
216254 #
217- # The default configuration is:
218- #
219- #trusted_key_servers:
220- # - server_name: "matrix.org"
255+ trusted_key_servers:
256+ - server_name: "matrix.org"
257+
258+ # Uncomment the following to disable the warning that is emitted when the
259+ # trusted_key_servers include 'matrix.org'. See above.
221260 #
261+ #suppress_key_server_warning: true
222262
223263 # The signing keys to use when acting as a trusted key server. If not specified
224264 # defaults to the server signing key.
0 commit comments