Skip to content

Commit

Permalink
Taught https-download to trust system certstore.
Browse files Browse the repository at this point in the history
fixes #3036.
  • Loading branch information
ggainey committed Jan 23, 2024
1 parent 65841c2 commit c044a49
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES/3036.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Taught downloader to trust system-cert-store on HTTPS proxy connections.
2 changes: 2 additions & 0 deletions pulpcore/download/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ def _make_aiohttp_session_from_remote(self):
sslcontext.verify_mode = ssl.CERT_NONE
if sslcontext:
tcp_conn_opts["ssl_context"] = sslcontext
# Trust the system-known CA certs, not just the end-remote CA
sslcontext.load_default_certs()

headers = MultiDict({"User-Agent": DownloaderFactory.user_agent()})
if self._remote.headers is not None:
Expand Down
32 changes: 32 additions & 0 deletions pulpcore/tests/functional/api/using_plugin/test_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pulpcore.client.pulp_file import (
RepositorySyncURL,
)
import sys


def _run_basic_sync_and_assert(
Expand Down Expand Up @@ -163,3 +164,34 @@ def test_sync_http_through_https_proxy(
file_content_api_client,
monitor_task,
)


@pytest.mark.parallel
def test_sync_https_through_https_proxy(
file_remote_ssl_factory,
file_repo,
file_bindings,
file_content_api_client,
https_proxy,
basic_manifest_path,
monitor_task,
):
"""
Test syncing http through an https proxy.
"""
if not (sys.version_info.major >= 3 and sys.version_info.minor >= 11):
pytest.skip("HTTPS proxy only supported on python3.11+")
remote_on_demand = file_remote_ssl_factory(
manifest_path=basic_manifest_path,
policy="on_demand",
proxy_url=https_proxy.proxy_url,
tls_validation="false",
)

_run_basic_sync_and_assert(
remote_on_demand,
file_repo,
file_bindings,
file_content_api_client,
monitor_task,
)

0 comments on commit c044a49

Please sign in to comment.