Yum repo basic auth not working

8,268

For anyone interested the problem is related to our nexus repo and this bug.

Share:
8,268

Related videos on Youtube

maverick
Author by

maverick

Updated on September 18, 2022

Comments

  • maverick
    maverick almost 2 years

    So we've got this yum repo that is protected via basic auth. My yum.repo definition looks like this

    [custom-repo]
    name=Releases Repository
    baseurl=http://user:[email protected]:8080/mrepo/nexus-noarch/RPMS.releases-rpm/
    enabled=1
    gpgcheck=0
    sslverify=0
    

    Yum is able to pull the metadata and find the packages on my repo. I even confirmed via a sniffer that the correct basic auth is happening. But when I try to install a package it fails with the typical 401.

    From the message shown and from the info grabbed from the sniffer I can tell that no authentication is been used at all.

    Total download size: 34 M
    Installed size: 39 M
    Downloading packages:
    http://user:[email protected]:8080/mrepo/nexus-noarch/RPMS.releases-rpm/com/company/artifact/xxxxx/0.9-SNAPSHOT/artifact-0.9-20140515.171948-39-   rpm.rpm: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 401 Unauthorized"
    Trying other mirror.
    

    Based on yum.conf I also tried adding username and password params as described there, but that didn't work.

    What is that that I'm doing wrong?

    Any ideas?

    Cheers!

    • faker
      faker almost 10 years
      Which yum version? Also, there could be a problem with using basic auth and a non-default port, see: stackoverflow.com/questions/10182050/…
    • maverick
      maverick almost 10 years
      @faker thanks for link, I'm using yum-3.4.3-137.51.amzn1.noarch, I'll try a workaround to avoid the port number and see if that works.
    • maverick
      maverick almost 10 years
      Well I can confirm that port is not the issue. Even when using the default port the same error happen again. After peeking at /var/cache/yum/x86_64/2014.03/custom-repo/repomd.xml I see all the url's there have no auth info included. Should it be there? shouldn't be yum using the one base url provided? or the username and password provided?
    • Petter H
      Petter H almost 10 years
      Using other browsers, can you then download the file which yum cant?
    • maverick
      maverick almost 10 years
      @PetterH yes I can, using the credentials in the url as http://username:password@host..