comparison tests/test-https.t @ 52289:323e3626929a

sslutil: add support for clients to set TLSv1.3 as the minimum protocol AFAICT, all of the TLS versions are supported by the server without doing any explicit work, and there's only a `devel` config to specify an exact version on the server side. Clients would also use TLSv1.3 if available, but this prevents the server from negotiating down. This also causes "tls1.3" to be listed in `hg debuginstall`, even though it was previously supported (if the Python intepreter supported it- IDK if there's a good way to proactively test for and show future protocols without requiring manual updates like this). The v1.3 tests are nested inside the v1.2 tests for simplicity. The v1.2 blocks already assume v1.0 and v1.1 support, so this seems reasonable for now. If/when the older protocols start getting dropped, this will have to be reworked anyway.
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 21 Dec 2020 20:21:46 -0500
parents 73a43fe3e6fd
children e03bc88776d3
comparison
equal deleted inserted replaced
52288:7f8d0c2c3692 52289:323e3626929a
350 > --config devel.server-insecure-exact-protocol=tls1.1 350 > --config devel.server-insecure-exact-protocol=tls1.1
351 $ cat ../hg1.pid >> $DAEMON_PIDS 351 $ cat ../hg1.pid >> $DAEMON_PIDS
352 $ hg serve -p $HGPORT2 -d --pid-file=../hg2.pid --certificate=$PRIV \ 352 $ hg serve -p $HGPORT2 -d --pid-file=../hg2.pid --certificate=$PRIV \
353 > --config devel.server-insecure-exact-protocol=tls1.2 353 > --config devel.server-insecure-exact-protocol=tls1.2
354 $ cat ../hg2.pid >> $DAEMON_PIDS 354 $ cat ../hg2.pid >> $DAEMON_PIDS
355 #if tls1.3
356 $ hg serve -p $HGPORT3 -d --pid-file=../hg3.pid --certificate=$PRIV \
357 > --config devel.server-insecure-exact-protocol=tls1.3
358 $ cat ../hg3.pid >> $DAEMON_PIDS
359 #endif
355 $ cd .. 360 $ cd ..
356 361
357 Clients talking same TLS versions work 362 Clients talking same TLS versions work
358 363
359 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.0 --config hostsecurity.ciphers="DEFAULT:@SECLEVEL=0" id https://localhost:$HGPORT/ 364 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.0 --config hostsecurity.ciphers="DEFAULT:@SECLEVEL=0" id https://localhost:$HGPORT/
360 5fed3813f7f5 365 5fed3813f7f5
361 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.1 --config hostsecurity.ciphers="DEFAULT:@SECLEVEL=0" id https://localhost:$HGPORT1/ 366 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.1 --config hostsecurity.ciphers="DEFAULT:@SECLEVEL=0" id https://localhost:$HGPORT1/
362 5fed3813f7f5 367 5fed3813f7f5
363 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.2 id https://localhost:$HGPORT2/ 368 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.2 id https://localhost:$HGPORT2/
364 5fed3813f7f5 369 5fed3813f7f5
370 #if tls1.3
371 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.3 id https://localhost:$HGPORT3/
372 5fed3813f7f5
373 #endif
365 374
366 Clients requiring newer TLS version than what server supports fail 375 Clients requiring newer TLS version than what server supports fail
367 376
368 $ P="$CERTSDIR" hg id https://localhost:$HGPORT/ 377 $ P="$CERTSDIR" hg id https://localhost:$HGPORT/
369 (could not negotiate a common security protocol (tls1.1+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support) 378 (could not negotiate a common security protocol (tls1.1+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support)
389 (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server) 398 (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
390 (see https://mercurial-scm.org/wiki/SecureConnections for more info) 399 (see https://mercurial-scm.org/wiki/SecureConnections for more info)
391 abort: error: .*(unsupported protocol|wrong ssl version|alert protocol version).* (re) 400 abort: error: .*(unsupported protocol|wrong ssl version|alert protocol version).* (re)
392 [100] 401 [100]
393 402
403 #if tls1.3
404 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.3 id https://localhost:$HGPORT/
405 (could not negotiate a common security protocol (tls1.3+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support)
406 (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
407 (see https://mercurial-scm.org/wiki/SecureConnections for more info)
408 abort: error: .*(unsupported protocol|wrong ssl version|alert protocol version).* (re)
409 [100]
410 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.3 id https://localhost:$HGPORT1/
411 (could not negotiate a common security protocol (tls1.3+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support)
412 (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
413 (see https://mercurial-scm.org/wiki/SecureConnections for more info)
414 abort: error: .*(unsupported protocol|wrong ssl version|alert protocol version).* (re)
415 [100]
416 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.3 id https://localhost:$HGPORT2/
417 (could not negotiate a common security protocol (tls1.3+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support)
418 (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
419 (see https://mercurial-scm.org/wiki/SecureConnections for more info)
420 abort: error: .*(unsupported protocol|wrong ssl version|alert protocol version).* (re)
421 [100]
422 #endif
423
424
394 --insecure will allow TLS 1.0 connections and override configs 425 --insecure will allow TLS 1.0 connections and override configs
395 426
396 $ hg --config hostsecurity.minimumprotocol=tls1.2 id --insecure https://localhost:$HGPORT1/ 427 $ hg --config hostsecurity.minimumprotocol=tls1.2 id --insecure https://localhost:$HGPORT1/
397 warning: connection security to localhost is disabled per current settings; communication is susceptible to eavesdropping and tampering 428 warning: connection security to localhost is disabled per current settings; communication is susceptible to eavesdropping and tampering
398 5fed3813f7f5 429 5fed3813f7f5
430
431 #if tls1.3
432 $ hg --config hostsecurity.minimumprotocol=tls1.3 id --insecure https://localhost:$HGPORT2/
433 warning: connection security to localhost is disabled per current settings; communication is susceptible to eavesdropping and tampering
434 5fed3813f7f5
435 #endif
399 436
400 The per-host config option overrides the default 437 The per-host config option overrides the default
401 438
402 $ P="$CERTSDIR" hg id https://localhost:$HGPORT/ \ 439 $ P="$CERTSDIR" hg id https://localhost:$HGPORT/ \
403 > --config hostsecurity.ciphers="DEFAULT:@SECLEVEL=0" \ 440 > --config hostsecurity.ciphers="DEFAULT:@SECLEVEL=0" \
429 [100] 466 [100]
430 467
431 $ killdaemons.py hg0.pid 468 $ killdaemons.py hg0.pid
432 $ killdaemons.py hg1.pid 469 $ killdaemons.py hg1.pid
433 $ killdaemons.py hg2.pid 470 $ killdaemons.py hg2.pid
471 #if tls1.3
472 $ killdaemons.py hg3.pid
473 #endif
434 #endif 474 #endif
435 475
436 Prepare for connecting through proxy 476 Prepare for connecting through proxy
437 477
438 $ hg serve -R test -p $HGPORT -d --pid-file=hg0.pid --certificate=$PRIV 478 $ hg serve -R test -p $HGPORT -d --pid-file=hg0.pid --certificate=$PRIV