##// END OF EJS Templates
sslutil: require TLS 1.1+ when supported...
Gregory Szorc -
r29560:303e9300 default
parent child Browse files
Show More
@@ -1008,10 +1008,18 b' The following options control default be'
1008 ``minimumprotocol``
1008 ``minimumprotocol``
1009 Defines the minimum channel encryption protocol to use.
1009 Defines the minimum channel encryption protocol to use.
1010
1010
1011 By default, the highest version of TLS - 1.0 or greater - supported by
1011 By default, the highest version of TLS supported by both client and server
1012 both client and server is used.
1012 is used.
1013
1013
1014 Allowed values are: ``tls1.0`` (the default), ``tls1.1``, ``tls1.2``.
1014 Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``.
1015
1016 When running on an old Python version, only ``tls1.0`` is allowed since
1017 old versions of Python only support up to TLS 1.0.
1018
1019 When running a Python that supports modern TLS versions, the default is
1020 ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this
1021 weakens security and should only be used as a feature of last resort if
1022 a server does not support TLS 1.1+.
1015
1023
1016 Options in the ``[hostsecurity]`` section can have the form
1024 Options in the ``[hostsecurity]`` section can have the form
1017 ``hostname``:``setting``. This allows multiple settings to be defined on a
1025 ``hostname``:``setting``. This allows multiple settings to be defined on a
@@ -154,9 +154,17 b' def _hostsettings(ui, hostname):'
154 hint=_('valid protocols: %s') %
154 hint=_('valid protocols: %s') %
155 ' '.join(sorted(configprotocols)))
155 ' '.join(sorted(configprotocols)))
156
156
157 # Legacy Python can only do TLS 1.0. We default to TLS 1.1+ where we
158 # can because TLS 1.0 has known vulnerabilities (like BEAST and POODLE).
159 # We allow users to downgrade to TLS 1.0+ via config options in case a
160 # legacy server is encountered.
161 if modernssl:
162 defaultprotocol = 'tls1.1'
163 else:
164 defaultprotocol = 'tls1.0'
165
157 key = 'minimumprotocol'
166 key = 'minimumprotocol'
158 # Default to TLS 1.0+ as that is what browsers are currently doing.
167 protocol = ui.config('hostsecurity', key, defaultprotocol)
159 protocol = ui.config('hostsecurity', key, 'tls1.0')
160 validateprotocol(protocol, key)
168 validateprotocol(protocol, key)
161
169
162 key = '%s:minimumprotocol' % hostname
170 key = '%s:minimumprotocol' % hostname
@@ -377,6 +377,11 b' Clients talking same TLS versions work'
377
377
378 Clients requiring newer TLS version than what server supports fail
378 Clients requiring newer TLS version than what server supports fail
379
379
380 $ P="$CERTSDIR" hg id https://localhost:$HGPORT/
381 (could not negotiate a common protocol; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error)
382 abort: error: *unsupported protocol* (glob)
383 [255]
384
380 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.1 id https://localhost:$HGPORT/
385 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.1 id https://localhost:$HGPORT/
381 (could not negotiate a common protocol; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error)
386 (could not negotiate a common protocol; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error)
382 abort: error: *unsupported protocol* (glob)
387 abort: error: *unsupported protocol* (glob)
General Comments 0
You need to be logged in to leave comments. Login now