8000 Allow less modern ciphers for outgoing connections by balloob · Pull Request #15546 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Allow less modern ciphers for outgoing connections #15546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
102F5
Diff view
18 changes: 6 additions & 12 deletions homeassistant/util/ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,14 @@

def client_context():
"""Return an SSL context for making requests."""
context = _get_context()
context.verify_mode = ssl.CERT_REQUIRED
context.check_hostname = True
context.load_verify_locations(cafile=certifi.where(), capath=None)
context = ssl.create_default_context(
purpose=ssl.Purpose.SERVER_AUTH,
cafile=certifi.where()
)
return context


def server_context():
"""Return an SSL context for being a server."""
context = _get_context()
context.options |= ssl.OP_CIPHER_SERVER_PREFERENCE
return context


def _get_context():
"""Return an SSL context following the Mozilla recommendations.

TLS configuration follows the best-practice guidelines specified here:
Expand All @@ -31,7 +24,8 @@ def _get_context():

context.options |= (
ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3 |
ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1
ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1 |
ssl.OP_CIPHER_SERVER_PREFERENCE
)
if hasattr(ssl, 'OP_NO_COMPRESSION'):
context.options |= ssl.OP_NO_COMPRESSION
Expand Down
0