Skip to content
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

NXDRIVE-2920: Upgrade to TLS 1.2 #4780

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/changes/5.5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Release date: `2024-xx-xx`

- [NXDRIVE-2882](https://jira.nuxeo.com/browse/NXDRIVE-2882): fix_db should create dump.sql in same dir as db
- [NXDRIVE-2901](https://jira.nuxeo.com/browse/NXDRIVE-2901): Authorization Error for OAuth
- [NXDRIVE-2](https://jira.nuxeo.com/browse/NXDRIVE-2):
- [NXDRIVE-2920](https://jira.nuxeo.com/browse/NXDRIVE-2920): Upgrade to TLS 1.2

### Direct Edit

Expand Down
5 changes: 4 additions & 1 deletion nxdrive/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,10 @@ def retrieve_ssl_certificate(hostname: str, /, *, port: int = 443) -> str:
import ssl

with ssl.create_connection((hostname, port)) as conn: # type: ignore
with ssl.SSLContext().wrap_socket(conn, server_hostname=hostname) as sock:
# Declaring a minimum version to restrict the protocol
context = ssl.create_default_context()
context.minimum_version = ssl.TLSVersion.TLSv1_2
swetayadav1 marked this conversation as resolved.
Show resolved Hide resolved
with context.wrap_socket(conn, server_hostname=hostname) as sock:
cert_data: bytes = sock.getpeercert(binary_form=True) # type: ignore
return ssl.DER_cert_to_PEM_cert(cert_data)

Expand Down