Bug 1328092 - Unable to sync authenticated repositories while using HTTP proxy - RPM1004: Error retrieving metadata: Not found
Summary: Unable to sync authenticated repositories while using HTTP proxy - RPM1004: E...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Pulp
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: Unspecified
Assignee: Adam Price
QA Contact: Roman Plevka
URL:
Whiteboard:
Depends On:
Blocks: 1405503
TreeView+ depends on / blocked
 
Reported: 2016-04-18 12:33 UTC by Roman Plevka
Modified: 2021-05-19 10:39 UTC (History)
23 users (show)

Fixed In Version: pulp-2.8.7.5-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1405503 (view as bug list)
Environment:
Last Closed: 2017-01-26 10:40:22 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
squid access log and conf (1.33 KB, text/plain)
2016-04-18 12:35 UTC, Roman Plevka
no flags Details
pulp syslog messages (2.60 KB, text/plain)
2016-04-18 12:36 UTC, Roman Plevka
no flags Details
foreman/production.log (25.91 KB, text/plain)
2016-04-18 12:43 UTC, Roman Plevka
no flags Details
pulp syslog (7.73 KB, text/plain)
2016-05-24 15:23 UTC, Roman Plevka
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Pulp Redmine 1977 0 High CLOSED - CURRENTRELEASE basic auth in URL fails when using authenticated proxy 2016-12-19 16:02:32 UTC
Pulp Redmine 2520 0 Normal CLOSED - CURRENTRELEASE credentials in feed URL are not url-unquoted 2017-01-31 00:31:11 UTC
Red Hat Product Errata RHBA-2017:0197 0 normal SHIPPED_LIVE Satellite 6.2.7 Async Bug Release 2017-01-26 15:38:38 UTC

Description Roman Plevka 2016-04-18 12:33:51 UTC
Description of problem:
Syncing authenticated repos fail with 
RPM1004: Error retrieving metadata: Not found

this is now happening on both authenticated and unauth http proxy
According to squid logs it looks like the credentials (for the repo) are not even being sent to it.
After disabling the proxy, sync works just fine.

This is a regression since this used to work in previous snaps

Version-Release number of selected component (if applicable):
6.2.0 snap 8.2

How reproducible:
always 

Steps to Reproduce:
1. configure satellite to use http proxy
2. configure a custom http authenticated repo
3. sync it

Actual results:
RPM1004: Error retrieving metadata: Not found

Expected results:
Sync works

Additional info:
attaching pulp logs, production log and squid access logs

Comment 1 Roman Plevka 2016-04-18 12:35:42 UTC
Created attachment 1148199 [details]
squid access log and conf

Comment 2 Roman Plevka 2016-04-18 12:36:39 UTC
Created attachment 1148200 [details]
pulp syslog messages

Comment 3 Roman Plevka 2016-04-18 12:43:11 UTC
Created attachment 1148201 [details]
foreman/production.log

Comment 5 Brad Buckingham 2016-04-19 17:08:37 UTC
Roman, can we get access to the environment where this is occuring?  Is this for custom, RH or any type of content?  Thanks!

Comment 7 Justin Sherrill 2016-05-24 12:31:44 UTC
Michael, 

Any thoughts on this?  Looking pulp related to me.

Comment 8 Mike McCune 2016-05-24 13:24:47 UTC
It may be this fix from upstream:

https://github.com/pulp/nectar/commit/1cd4eedb82fda41935e2596bd99e2839df0e8a0d

Comment 9 Justin Sherrill 2016-05-24 13:34:56 UTC
I'm not sure it is because roman says its a problem even without an authenticated proxy

'this is now happening on both authenticated and unauth http proxy'

Comment 10 Roman Plevka 2016-05-24 15:23:04 UTC
Created attachment 1161066 [details]
pulp syslog

This is the part of the /var/log/messages where the failure occurs. It contains the traceback.

Looks like the credentials are not being passed to the server in authorization header.

Comment 11 Adam Price 2016-05-24 17:02:26 UTC
Upstream nightly fails on an authenticated proxy, but works properly on an unauthenticated proxy.

Comment 13 Adam Price 2016-05-26 19:21:20 UTC
I applied that nectar diff [1] to a Satellite6 installation (SNAP GA 13.1) and it still fails on authenticated proxies.


[1] https://github.com/pulp/nectar/commit/1cd4eedb82fda41935e2596bd99e2839df0e8a0d

Comment 14 Adam Price 2016-06-02 21:05:22 UTC
I can reproduce the failed sync on a basic auth repo even without Satellite6 being behind a proxy, which makes me think this issue doesn't have to do with Satellite6 being behind a proxy, but rather then communication between Katello and Pulp when Satellite6 is creating a repository with basic auth.

Comment 15 Adam Price 2016-06-03 20:02:53 UTC
Welp, I believe I misspoke in comment 14. Satellite6 is able to sync a basicauth repo without a proxy successfully.

Comment 16 Michael Hrivnak 2016-06-03 20:20:46 UTC
Could this be a duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=1316229 ?

What version of python-nectar is installed when you see this issue?

Comment 18 Roman Plevka 2016-06-06 09:11:00 UTC
(In reply to Michael Hrivnak from comment #16)
> Could this be a duplicate of
> https://bugzilla.redhat.com/show_bug.cgi?id=1316229 ?
> 
> What version of python-nectar is installed when you see this issue?

Tha BZ has been created by me as well but only applied to Authed proxy (non-auth proxy setup worked back then) - That's why I opened a new one.

Comment 19 Adam Price 2016-06-06 13:08:30 UTC
(In reply to Michael Hrivnak from comment #16)
> Could this be a duplicate of
> https://bugzilla.redhat.com/show_bug.cgi?id=1316229 ?
> 
> What version of python-nectar is installed when you see this issue?

python-nectar-1.5.1-3.el7sat.noarch

Comment 20 Michael Hrivnak 2016-06-06 15:49:54 UTC
The following works for me on pulp 2.8.4 beta 2:

I put the same exact config for the authenticated proxy into /etc/pulp/server/plugins.conf.d/yum_importer.json 

I restarted pulp workers so they would pick up the new config.

pulp-admin rpm repo create --repo-id=rplevka --feed=https://rplevka.fedorapeople.org/fakerepo01/ --basicauth-user=admin --basicauth-pass=changeme
pulp-admin rpm repo sync run --repo-id=rplevka

I verified that it was indeed using the proxy, and I saw the sync succeed.

I think the difference is that katello is putting the repo credentials in the URL instead of using the settings. I tried that, and it failed as described in this bug. I'll investigate.

Comment 21 Michael Hrivnak 2016-06-06 16:00:33 UTC
My testing shows that the only case that fails is when all of these are true:

- the proxy requires auth
- the repo requires auth
- repo auth credentials are specified in the URL

All three of those must be true in order to see the sync fail with the "not found" error.

Comment 24 pulp-infra@redhat.com 2016-08-09 03:20:10 UTC
The Pulp upstream bug status is at ASSIGNED. Updating the external tracker on this bug.

Comment 25 pulp-infra@redhat.com 2016-08-09 03:20:13 UTC
The Pulp upstream bug priority is at High. Updating the external tracker on this bug.

Comment 26 pulp-infra@redhat.com 2016-08-11 17:38:27 UTC
The Pulp upstream bug status is at POST. Updating the external tracker on this bug.

Comment 27 pulp-infra@redhat.com 2016-08-15 18:00:36 UTC
The Pulp upstream bug status is at MODIFIED. Updating the external tracker on this bug.

Comment 31 pulp-infra@redhat.com 2016-10-26 05:02:02 UTC
The Pulp upstream bug status is at ON_QA. Updating the external tracker on this bug.

Comment 32 pulp-infra@redhat.com 2016-11-21 21:01:38 UTC
All upstream Pulp bugs are at MODIFIED+. Moving this bug to POST.

Comment 33 pulp-infra@redhat.com 2016-12-09 16:32:02 UTC
The Pulp upstream bug status is at VERIFIED. Updating the external tracker on this bug.

Comment 34 pulp-infra@redhat.com 2016-12-19 16:02:33 UTC
The Pulp upstream bug status is at CLOSED - CURRENTRELEASE. Updating the external tracker on this bug.

Comment 35 Roman Plevka 2017-01-09 15:10:13 UTC
(partly) VERIFIED

[root@bkr-hv02-guest27 ~]# hammer -u admin -p changeme repository create --name foo --product foo --organization-id 1 --content-type yum --url "https://admin:changeme@rplevka.fedorapeople.org/fakerepo01/"
Repository created
[root@bkr-hv02-guest27 ~]# 
[root@bkr-hv02-guest27 ~]# hammer repository list --organization-id 1
[Foreman] Password for admin: 
---|------|---------|--------------|------------------------------------------------------------
ID | NAME | PRODUCT | CONTENT TYPE | URL                                                        
---|------|---------|--------------|------------------------------------------------------------
1  | foo  | foo     | yum          | https://admin:changeme@rplevka.fedorapeople.org/fakerepo01/
---|------|---------|--------------|------------------------------------------------------------
[root@bkr-hv02-guest27 ~]# 
[root@bkr-hv02-guest27 ~]# hammer -u admin -p changeme repository synchronize --id 1
[....................................................................................] [100%]


tthere is a problem though with credentials using unsafe chars that need to be urlencoded.
e.g. https://%40dmin:changeme@rplevka.fedorapeople.org/fakerepo01/

- this used to work before introducing this bug. Am i supposed to open a new BZ or can we consider this as a regression?

Comment 36 pulp-infra@redhat.com 2017-01-09 15:32:37 UTC
All upstream Pulp bugs are at MODIFIED+. Moving this bug to POST.

Comment 37 Adam Price 2017-01-09 16:28:24 UTC
> Am i supposed to open a new BZ or can we consider this as a regression?

I'd consider that a new bug.

Comment 38 Roman Plevka 2017-01-10 10:30:26 UTC
Sorry but further checks revealed a regression:

the urlencoded special chars (especially @) no longer work even when not using a http proxy. This might cause regressions for customers who have been using auth repos with special characters in the credentials (which is quite common).


# satellite-installer --katello-proxy-url ""
Installing        Done           [100%]
[.....................................]
  Success!
  * Satellite is running at https://***.com
  * To install additional capsule on separate machine continue by running:

      capsule-certs-generate --capsule-fqdn "$CAPSULE" --certs-tar "~/$CAPSULE-certs.tar"

  The full log is at /var/log/foreman-installer/satellite.log


# hammer -u admin -p changeme repository info --id 2 | grep URL
URL:                https://%40dmin:changeme@rplevka.fedorapeople.org/fakerepo01/
# hammer repository synchronize --id 2
[Foreman] Password for admin: 
[.................................................................................................................................................................] [100%]
No new packages.
Error: RPM1004: Error retrieving metadata: Unauthorized

Comment 39 pulp-infra@redhat.com 2017-01-10 10:32:28 UTC
All upstream Pulp bugs are at MODIFIED+. Moving this bug to POST.

Comment 41 pulp-infra@redhat.com 2017-01-10 11:02:39 UTC
All upstream Pulp bugs are at MODIFIED+. Moving this bug to POST.

Comment 42 Adam Price 2017-01-10 14:07:05 UTC
Roman,

Logs and/or stack traces would greatly help me in assisting you with this new possibly related issue.

Comment 43 pulp-infra@redhat.com 2017-01-10 15:01:36 UTC
The Pulp upstream bug status is at NEW. Updating the external tracker on this bug.

Comment 44 pulp-infra@redhat.com 2017-01-10 15:01:41 UTC
The Pulp upstream bug priority is at Normal. Updating the external tracker on this bug.

Comment 46 pulp-infra@redhat.com 2017-01-11 20:01:42 UTC
The Pulp upstream bug status is at ASSIGNED. Updating the external tracker on this bug.

Comment 47 pulp-infra@redhat.com 2017-01-12 14:01:45 UTC
The Pulp upstream bug status is at POST. Updating the external tracker on this bug.

Comment 48 pulp-infra@redhat.com 2017-01-13 14:31:34 UTC
The Pulp upstream bug status is at MODIFIED. Updating the external tracker on this bug.

Comment 49 pulp-infra@redhat.com 2017-01-13 14:32:42 UTC
All upstream Pulp bugs are at MODIFIED+. Moving this bug to POST.

Comment 51 pulp-infra@redhat.com 2017-01-23 23:01:19 UTC
The Pulp upstream bug status is at ON_QA. Updating the external tracker on this bug.

Comment 52 Roman Plevka 2017-01-24 12:32:47 UTC
VERIFIED
on sat6.2.7-2

by automation (https://github.com/SatelliteQE/robottelo/blob/master/tests/foreman/cli/test_repository.py#L198)

$ pytest -k test_positive_synchronize_auth_puppet_repo test_repository.py
=== test session starts ===
platform linux2 -- Python 2.7.12, pytest-3.0.5, py-1.4.32, pluggy-0.4.0
rootdir: /home/rplevka/work/rplevka/robottelo, inifile: 
plugins: xdist-1.14
collected 65 items 

test_repository.py .

=== 64 tests deselected ===
=== 1 passed, 64 deselected in 232.05 seconds ===

Comment 54 errata-xmlrpc 2017-01-26 10:40:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:0197

Comment 55 pulp-infra@redhat.com 2017-01-31 00:31:12 UTC
The Pulp upstream bug status is at CLOSED - CURRENTRELEASE. Updating the external tracker on this bug.


Note You need to log in before you can comment on or make changes to this bug.