mirror of
https://github.com/home-assistant/core.git
synced 2026-08-24 10:13:52 -05:00
17 lines
430 B
Python
17 lines
430 B
Python
"""Helpers for airOS."""
|
|
|
|
import ssl
|
|
|
|
|
|
def build_legacy_context(*, verify_ssl: bool) -> ssl.SSLContext:
|
|
"""Build an SSL context compatible with legacy airOS 6 devices."""
|
|
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
|
|
ctx.set_ciphers("DEFAULT:@SECLEVEL=0")
|
|
ctx.minimum_version = ssl.TLSVersion.TLSv1
|
|
|
|
if not verify_ssl:
|
|
ctx.check_hostname = False
|
|
ctx.verify_mode = ssl.CERT_NONE
|
|
|
|
return ctx
|