|
8 | 8 | resolve_ssl_version, |
9 | 9 | ) |
10 | 10 |
|
11 | | - |
12 | | -# Default ciphers imported from urllib3 as a work around for https://github.com/httpie/httpie/issues/1499 |
13 | | -# Removed from urllib3 in this commit: https://github.com/urllib3/urllib3/commit/e5eac0c |
14 | | -#################### |
15 | | -# A secure default. |
16 | | -# Sources for more information on TLS ciphers: |
17 | | -# |
18 | | -# - https://wiki.mozilla.org/Security/Server_Side_TLS |
19 | | -# - https://www.ssllabs.com/projects/best-practices/index.html |
20 | | -# - https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/ |
21 | | -# |
22 | | -# The general intent is: |
23 | | -# - prefer cipher suites that offer perfect forward secrecy (DHE/ECDHE), |
24 | | -# - prefer ECDHE over DHE for better performance, |
25 | | -# - prefer any AES-GCM and ChaCha20 over any AES-CBC for better performance and |
26 | | -# security, |
27 | | -# - prefer AES-GCM over ChaCha20 because hardware-accelerated AES is common, |
28 | | -# - disable NULL authentication, MD5 MACs, DSS, and other |
29 | | -# insecure ciphers for security reasons. |
30 | | -# - NOTE: TLS 1.3 cipher suites are managed through a different interface |
31 | | -# not exposed by CPython (yet!) and are enabled by default if they're available. |
32 | | -DEFAULT_SSL_CIPHERS = ":".join( |
33 | | - [ |
34 | | - "ECDHE+AESGCM", |
35 | | - "ECDHE+CHACHA20", |
36 | | - "DHE+AESGCM", |
37 | | - "DHE+CHACHA20", |
38 | | - "ECDH+AESGCM", |
39 | | - "DH+AESGCM", |
40 | | - "ECDH+AES", |
41 | | - "DH+AES", |
42 | | - "RSA+AESGCM", |
43 | | - "RSA+AES", |
44 | | - "!aNULL", |
45 | | - "!eNULL", |
46 | | - "!MD5", |
47 | | - "!DSS", |
48 | | - "!AESCCM", |
49 | | - ] |
50 | | -) |
| 11 | +# We used to import default SSL ciphers via `SSL_CIPHERS` from `urllib3` but it’s been removed, |
| 12 | +# so we’ve copied the original list here. |
| 13 | +# Our issue: <https://github.com/httpie/httpie/issues/1499> |
| 14 | +# Removal commit: <https://github.com/urllib3/urllib3/commit/e5eac0c> |
| 15 | +DEFAULT_SSL_CIPHERS = ":".join([ |
| 16 | + # <urllib3> |
| 17 | + # A secure default. |
| 18 | + # Sources for more information on TLS ciphers: |
| 19 | + # |
| 20 | + # - https://wiki.mozilla.org/Security/Server_Side_TLS |
| 21 | + # - https://www.ssllabs.com/projects/best-practices/index.html |
| 22 | + # - https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/ |
| 23 | + # |
| 24 | + # The general intent is: |
| 25 | + # - prefer cipher suites that offer perfect forward secrecy (DHE/ECDHE), |
| 26 | + # - prefer ECDHE over DHE for better performance, |
| 27 | + # - prefer any AES-GCM and ChaCha20 over any AES-CBC for better performance and |
| 28 | + # security, |
| 29 | + # - prefer AES-GCM over ChaCha20 because hardware-accelerated AES is common, |
| 30 | + # - disable NULL authentication, MD5 MACs, DSS, and other |
| 31 | + # insecure ciphers for security reasons. |
| 32 | + # - NOTE: TLS 1.3 cipher suites are managed through a different interface |
| 33 | + # not exposed by CPython (yet!) and are enabled by default if they're available. |
| 34 | + "ECDHE+AESGCM", |
| 35 | + "ECDHE+CHACHA20", |
| 36 | + "DHE+AESGCM", |
| 37 | + "DHE+CHACHA20", |
| 38 | + "ECDH+AESGCM", |
| 39 | + "DH+AESGCM", |
| 40 | + "ECDH+AES", |
| 41 | + "DH+AES", |
| 42 | + "RSA+AESGCM", |
| 43 | + "RSA+AES", |
| 44 | + "!aNULL", |
| 45 | + "!eNULL", |
| 46 | + "!MD5", |
| 47 | + "!DSS", |
| 48 | + "!AESCCM", |
| 49 | + # </urllib3> |
| 50 | +]) |
51 | 51 | SSL_VERSION_ARG_MAPPING = { |
52 | 52 | 'ssl2.3': 'PROTOCOL_SSLv23', |
53 | 53 | 'ssl3': 'PROTOCOL_SSLv3', |
|
0 commit comments