diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -68,6 +68,7 @@ from . import ( setdiscovery, simplemerge, sshserver, + sslutil, streamclone, templatekw, templater, @@ -2703,6 +2704,25 @@ def debuginstall(ui, **opts): fm.write('pythonlib', _("checking Python lib (%s)...\n"), os.path.dirname(os.__file__)) + security = set(sslutil.supportedprotocols) + if sslutil.hassni: + security.add('sni') + + fm.write('pythonsecurity', _("checking Python security support (%s)\n"), + fm.formatlist(sorted(security), name='protocol', + fmt='%s', sep=',')) + + # These are warnings, not errors. So don't increment problem count. This + # may change in the future. + if 'tls1.2' not in security: + fm.plain(_(' TLS 1.2 not supported by Python install; ' + 'network connections lack modern security\n')) + if 'sni' not in security: + fm.plain(_(' SNI not supported by Python install; may have ' + 'connectivity issues with some servers\n')) + + # TODO print CA cert info + # hg version hgver = util.version() fm.write('hgver', _("checking Mercurial version (%s)\n"), diff --git a/tests/test-install.t b/tests/test-install.t --- a/tests/test-install.t +++ b/tests/test-install.t @@ -4,6 +4,9 @@ hg debuginstall checking Python executable (*) (glob) checking Python version (2.*) (glob) checking Python lib (*lib*)... (glob) + checking Python security support (*) (glob) + TLS 1.2 not supported by Python install; network connections lack modern security (?) + SNI not supported by Python install; may have connectivity issues with some servers (?) checking Mercurial version (*) (glob) checking Mercurial custom build (*) (glob) checking module policy (*) (glob) @@ -33,6 +36,7 @@ hg debuginstall JSON "problems": 0, "pythonexe": "*", (glob) "pythonlib": "*", (glob) + "pythonsecurity": [*], (glob) "pythonver": "*.*.*", (glob) "templatedirs": "*mercurial?templates", (glob) "username": "test", @@ -47,6 +51,9 @@ hg debuginstall with no username checking Python executable (*) (glob) checking Python version (2.*) (glob) checking Python lib (*lib*)... (glob) + checking Python security support (*) (glob) + TLS 1.2 not supported by Python install; network connections lack modern security (?) + SNI not supported by Python install; may have connectivity issues with some servers (?) checking Mercurial version (*) (glob) checking Mercurial custom build (*) (glob) checking module policy (*) (glob) @@ -71,6 +78,9 @@ path variables are expanded (~ is the sa checking Python executable (*) (glob) checking Python version (*) (glob) checking Python lib (*lib*)... (glob) + checking Python security support (*) (glob) + TLS 1.2 not supported by Python install; network connections lack modern security (?) + SNI not supported by Python install; may have connectivity issues with some servers (?) checking Mercurial version (*) (glob) checking Mercurial custom build (*) (glob) checking module policy (*) (glob)