Total Complexity | 2 |
Total Lines | 25 |
Duplicated Lines | 0 % |
Coverage | 84.62% |
Changes | 0 |
1 | # Ciphers compatible with SAT Services |
||
2 | 1 | import ssl |
|
3 | |||
4 | 1 | import certifi |
|
5 | 1 | from requests.adapters import HTTPAdapter |
|
6 | |||
7 | 1 | CIPHERS = ( |
|
8 | 'ECDHE+AESGCM:ECDHE+CHACHA20:DHE+AESGCM:DHE+CHACHA20:ECDH+AESGCM:' |
||
9 | 'DH+AESGCM:ECDH+AES:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!eNULL:!MD5:!DSS' |
||
10 | ':HIGH:!DH' |
||
11 | ) |
||
12 | |||
13 | 1 | ssl_context = ssl.create_default_context(cafile=certifi.where()) |
|
14 | 1 | ssl_context.set_ciphers(CIPHERS) |
|
15 | |||
16 | |||
17 | 1 | class SSLAdapter(HTTPAdapter): |
|
18 | 1 | def init_poolmanager(self, *args, **kwargs): |
|
19 | 1 | kwargs['ssl_context'] = ssl_context |
|
20 | 1 | return super().init_poolmanager(*args, **kwargs) |
|
21 | |||
22 | 1 | def proxy_manager_for(self, *args, **kwargs): |
|
23 | kwargs['ssl_context'] = ssl_context |
||
24 | return super().proxy_manager_for(*args, **kwargs) |
||
25 |