Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
HomeAssistant
Core
Commits
dff2e4eb
Commit
dff2e4eb
authored
6 years ago
by
Paulus Schoutsen
Committed by
Paulus Schoutsen
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Don't be so strict client-side (#15546)
parent
9c337bc6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
homeassistant/util/ssl.py
+6
-12
6 additions, 12 deletions
homeassistant/util/ssl.py
with
6 additions
and
12 deletions
homeassistant/util/ssl.py
+
6
−
12
View file @
dff2e4eb
...
...
@@ -6,21 +6,14 @@ import certifi
def
client_context
():
"""
Return an SSL context for making requests.
"""
context
=
_ge
t_context
(
)
context
.
verify_mode
=
ssl
.
CERT_REQUIRED
c
ontext
.
check_hostname
=
True
context
.
load_verify_locations
(
cafile
=
certifi
.
where
(),
capath
=
None
)
context
=
ssl
.
create_defaul
t_context
(
purpose
=
ssl
.
Purpose
.
SERVER_AUTH
,
c
afile
=
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:
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment