sanic/tests
L. Kärkkäinen 6c7df68c7c
Vhost support using multiple TLS certificates (#2270)
* Initial support for using multiple SSL certificates.

* Also list IP address subjectAltNames on log.

* Use Python 3.7+ way of specifying TLSv1.2 as the minimum version. Linter fixes.

* isort

* Cleanup, store server name for later use. Add RSA ciphers. Log rejected SNIs.

* Cleanup, linter.

* Alter the order of initial log messages and handling. In particular, enable debug mode early so that debug messages during init can be shown.

* Store server name (SNI) to conn_info.

* Update test with new error message.

* Refactor for readability.

* Cleanup

* Replace old expired test cert with new ones and a script for regenerating them as needed.

* Refactor TLS tests to a separate file.

* Add cryptography to dev deps for rebuilding TLS certs.

* Minor adjustment to messages.

* Tests added for new TLS code.

* Find the correct log row before testing for message. The order was different on CI.

* More log message order fixup. The tests do not account for the logo being printed first.

* Another attempt at log message indexing fixup.

* Major TLS refactoring.

CertSelector now allows dicts and SSLContext within its list.
Server names are stored even when no list is used.
SSLContext.sanic now contains a dict with any setting passed and information extracted from cert.
That information is available on request.conn_info.cert.
Type annotations added.
More tests incl. a handler for faking hostname in tests.

* Remove a problematic logger test that apparently was not adding any coverage or value to anything.

* Revert accidental commit of uvloop disable.

* Typing fixes / refactoring.

* Additional test for cert selection. Certs recreated without DNS:localhost on sanic.example cert.

* Add tests for single certificate path shorthand and SNI information.

* Move TLS dict processing to CertSimple, make the names field optional and use names from the cert if absent.

* Sanic CLI options --tls and --tls-strict-host to use the new features.

* SSL argument typing updated

* Use ValueError for internal message passing to avoid CertificateError's odd message formatting.

* Linter

* Test CLI TLS options.

* Maybe the right codeclimate option now...

* Improved TLS argument help, removed support for combining --cert/--key with --tls.

* Removed support for strict checking without any certs, black forced fscked up formatting.

* Update CLI tests for stricter TLS options.

Co-authored-by: L. Karkkainen <tronic@users.noreply.github.com>
Co-authored-by: Adam Hopkins <admhpkns@gmail.com>
2021-10-28 16:50:05 +03:00
..
benchmark Perf improv (#2074) 2021-03-21 09:47:21 +02:00
certs Vhost support using multiple TLS certificates (#2270) 2021-10-28 16:50:05 +03:00
fake Add ability to log all exceptions (#2262) 2021-10-27 10:43:58 +03:00
performance Fix imports and isort to remove from Makefile deprecated options (#1891) 2020-07-07 16:13:03 +03:00
static Static dir 2075 (#2076) 2021-03-21 15:03:54 +02:00
conftest.py Smarter auto fallback (#2162) 2021-09-29 23:53:49 +03:00
skip_test_custom_protocol.py Streaming Server (#1876) 2021-01-11 00:45:36 +02:00
test_app.py 21.9 release docs (#2218) 2021-09-30 22:36:34 +03:00
test_asgi.py New websockets (#2158) 2021-09-29 13:09:23 +03:00
test_bad_request.py Smarter auto fallback (#2162) 2021-09-29 23:53:49 +03:00
test_base.py Cleanup conftest and fix warning message (#2147) 2021-05-31 22:41:41 +03:00
test_blueprint_copy.py Copy Blueprints Implementation (#2184) 2021-08-10 01:07:04 +03:00
test_blueprint_group.py Smarter auto fallback (#2162) 2021-09-29 23:53:49 +03:00
test_blueprints.py 21.9 release docs (#2218) 2021-09-30 22:36:34 +03:00
test_cli.py Vhost support using multiple TLS certificates (#2270) 2021-10-28 16:50:05 +03:00
test_config.py Remove Duplicated Dependencies and PEP 517 Support (#2173) 2021-07-08 09:12:56 +03:00
test_constants.py Remove unnecessary import in test_constants.py, which also fixes an error on win (#2180) 2021-07-05 11:51:36 +03:00
test_cookies.py Clean up use cases: 2021-02-03 22:36:44 +02:00
test_create_task.py Signals Integration (#2160) 2021-08-05 22:55:42 +03:00
test_custom_request.py Streaming Server (#1876) 2021-01-11 00:45:36 +02:00
test_dynamic_routes.py Add SanicBase 2021-01-28 09:18:06 +02:00
test_errorpages.py Smarter auto fallback (#2162) 2021-09-29 23:53:49 +03:00
test_exceptions_handler.py Add ability to log all exceptions (#2262) 2021-10-27 10:43:58 +03:00
test_exceptions.py Allow non-conforming ErrorHandlers (#2259) 2021-10-03 01:02:56 +03:00
test_graceful_shutdown.py Close HTTP loop when connection task cancelled (#2245) 2021-09-27 10:22:30 +03:00
test_handler_annotations.py Add convenience for annotated handlers (#2225) 2021-08-30 20:04:44 +03:00
test_headers.py Smarter auto fallback (#2162) 2021-09-29 23:53:49 +03:00
test_helpers.py Add custom request support to ASGI mode; fix a couple tests 2019-06-24 22:59:23 +03:00
test_http.py HTTP tests (#2194) 2021-07-19 16:52:33 +03:00
test_json_encoding.py JSON encoder change via app (#2055) 2021-03-11 17:09:18 +02:00
test_keep_alive_timeout.py Signals Integration (#2160) 2021-08-05 22:55:42 +03:00
test_logging.py Vhost support using multiple TLS certificates (#2270) 2021-10-28 16:50:05 +03:00
test_logo.py Signals Integration (#2160) 2021-08-05 22:55:42 +03:00
test_middleware.py Add ability to return Falsey but not-None from handlers (#2236) 2021-09-12 07:19:26 +03:00
test_multiprocessing.py Add convenience decorators for new listeners (#2064) 2021-03-16 11:21:05 +02:00
test_named_routes.py v2 AST router (#2133) 2021-06-21 15:10:26 +03:00
test_payload_too_large.py debug and working stage--squash 2021-02-08 12:18:29 +02:00
test_pipelining.py Fix issues with after request handling in HTTP pipelining (#2201) 2021-07-28 11:38:28 +03:00
test_redirect.py deprecate abort (#2077) 2021-04-05 18:01:48 +03:00
test_reloader.py Add reloading on addtional directories (#2167) 2021-06-18 11:39:09 +03:00
test_request_cancel.py GIT-1591 Strict Slashes behavior fix (#1594) 2019-06-06 07:21:58 -05:00
test_request_data.py Fix linting issues 2020-09-29 00:40:24 +03:00
test_request_stream.py deprecate abort (#2077) 2021-04-05 18:01:48 +03:00
test_request_timeout.py Signals Integration (#2160) 2021-08-05 22:55:42 +03:00
test_request.py Accept header parsing (#2200) 2021-08-19 21:09:40 +03:00
test_requests.py Vhost support using multiple TLS certificates (#2270) 2021-10-28 16:50:05 +03:00
test_response_timeout.py Disable response timeout on websocket connections (#2081) 2021-03-23 01:20:17 +02:00
test_response.py 21.6 Changelog, release version, and deprecations (#2172) 2021-06-27 22:52:56 +03:00
test_routes.py New websockets (#2158) 2021-09-29 13:09:23 +03:00
test_server_events.py Signals Integration (#2160) 2021-08-05 22:55:42 +03:00
test_signal_handlers.py Close HTTP loop when connection task cancelled (#2245) 2021-09-27 10:22:30 +03:00
test_signals.py Signals Integration (#2160) 2021-08-05 22:55:42 +03:00
test_static.py Static DIR and FILE resource types (#2244) 2021-09-26 01:01:23 +03:00
test_test_client_port.py Remove test client (#2009) 2021-01-28 09:22:22 +02:00
test_timeout_logic.py deprecate abort (#2077) 2021-04-05 18:01:48 +03:00
test_tls.py Vhost support using multiple TLS certificates (#2270) 2021-10-28 16:50:05 +03:00
test_touchup.py Signals Integration (#2160) 2021-08-05 22:55:42 +03:00
test_unix_socket.py GIT-2023: Enable GitHub Actions support (#2050) 2021-04-06 23:32:01 +03:00
test_url_building.py v2 AST router (#2133) 2021-06-21 15:10:26 +03:00
test_url_for_static.py Resolve some more tests 2021-02-07 11:38:37 +02:00
test_url_for.py Signals Integration (#2160) 2021-08-05 22:55:42 +03:00
test_utf8.py Swap out requests-async for httpx (#1728) 2019-12-20 19:23:52 -08:00
test_utils.py 21.3 deprecations (#2007) 2021-01-19 01:36:50 +02:00
test_versioning.py Version prefix (#2137) 2021-05-19 13:32:40 +03:00
test_vhosts.py debug and working stage--squash 2021-02-08 12:18:29 +02:00
test_views.py CBV alternate attach; CompositionView deprecate (#2170) 2021-06-21 14:26:42 +03:00
test_worker.py New websockets (#2158) 2021-09-29 13:09:23 +03:00