pulp / pulp_ansible

A Pulp plugin that manages Ansible content, i.e. roles, collections
https://docs.pulpproject.org/pulp_ansible/
GNU General Public License v2.0
60 stars 54 forks source link

Synchronization using authenticated proxy is failing #801

Closed bmclaughlin closed 2 years ago

bmclaughlin commented 2 years ago

Using proxy authentication returns 407.

galaxy_ng issue: https://issues.redhat.com/browse/AAH-1243

bmbouter commented 2 years ago

I believe I've reproduced this issue.

  1. Install a local proxy with pip install proxy.py
  2. Start that proxy to require basic auth using proxy --basic-auth foo:bar --hostname 0.0.0.0
  3. Verify that curl receives a 407 when used without auth provided curl -v --proxy http://127.0.0.1:8899 https://example.com
  4. Verify that curl works as expected when the correct credentials are passed to the proxy curl -v --proxy http://127.0.0.1:8899 -U foo:bar https://example.com

Then try to sync a collection using pulp_ansible through the proxy with auth specified using this script:

#!/bin/bash

set -ev

repo_name="repo$RANDOM"
remote_name="remote$RANDOM"
url="https://galaxy.ansible.com"
distribution_name="distribution$RANDOM"
base_path="$RANDOM"

pulp ansible remote -t collection create --name $remote_name --url $url --requirements-file ~/devel/basic.yml --proxy-url http://127.0.0.1:8899 --proxy-username foo --proxy-password bar
pulp ansible repository create --name $repo_name --remote $remote_name
pulp ansible repository sync --name $repo_name
pulp ansible distribution create --repository $repo_name --name $distribution_name --base-path $base_path

echo "Created and synced repo $repo_name"

Let ~/devel/basic.yml contain:

---
collections:
# With just the collection name
- pulp.pulp_installer
- ansible.posix
dkliban commented 2 years ago

We fixed a related bug in pulpcore with the following change https://github.com/pulp/pulpcore/commit/0c9541d3699ea54eb25509f6217002c3a4fc7576#diff-3b08c4799559edbce70a244edcc7bcc6e3817e9e8837da6e5519cbc0b3271fea Something similar is needed for any custom downloaders in this plugin.

bmbouter commented 2 years ago

Hmmm, it looks like it's present on both 0.10 and main.