Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

    If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

    File download with wget only works with auth-no-challenge argument

    Scheduled Pinned Locked Moved Support
    5 Posts 2 Posters 23 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • I Offline
      it_9582
      last edited by

      Hi there,
      today I want to implement a file download over a toolkit which we use in our development process. This toolkit (which runs on linux) will download files from the server (now ProGet) over wget. The username and password will be used from wget over a .netrc file.

      If I run a download of a file (I tested asset download and pypi-package download) with wget the ProGet-Server will response with 401 Unauthorized.

      ---response end---
      401 Unauthorized
      Registered socket 3 for persistent reuse.
      Skipping 105 bytes of body: [You are not authorized to perform the Feeds_DownloadPackage task on this feed anonymously. Please log in.] done.
      Unknown authentication scheme.
      
      Username/Password Authentication Failed.
      

      If I add the argument --auth-no-challenge to the wget call than the download will finish successfully but I this is more a workaround for this issue. As a side note the download of the same file over curl run without any issues and without extra arguments.

      Are there any possibilities to fix this issue?

      Best regards.

      atrippA 1 Reply Last reply Reply Quote 0
      • atrippA Offline
        atripp inedo-engineer @it_9582
        last edited by

        Hi @it_9582 ,

        Unfortunately I'm not really sure what your script is doing or how to fix it... but I will describe the server (ProGet) behavior.

        Unless you allow Anonymous access on the endpoint, ProGet will respond with a 401 when you access a URL without any authentication information (API Key header, Basic credentials). That's what the message you are sharing appears to do.

        So if you're getting that message, then I guess the username/password isn't being sent? I really don't know what --auth-no-challenge means or does.

        Thanks,
        Alana

        1 Reply Last reply Reply Quote 0
        • I Offline
          it_9582
          last edited by

          Hi @atripp,
          thanks for your fast answer.

          Our script only downloads files from the ProGet-Server with wget on Linux and username:password (cannot be changed as simple). As we are using the API-Keys to authenticate with the server, so the wget call is the following:

          wget --user api --password <api-key> <Download path>
          

          After running this command I get a 401 from the Server. If I add the --auth-no-challenge argument like in the following snipped:

          wget --user api --password <api-key> --auth-no-challenge <Download path>
          

          than the Download runs without any issues.

          The download also works without the --auth-no-challenge argument if I allow the download for Anonymous users.

          I also checked if a download works if I send the Auth-Header manually with wget.

          # generate base64 Encode Credentials
          echo -n 'api:<key>' | base64
          
          wget --header="Authorization: Basic <base64 Credentials>" <Download path>
          

          This works also without any issues.

          atrippA 1 Reply Last reply Reply Quote 0
          • atrippA Offline
            atripp inedo-engineer @it_9582
            last edited by

            Hi @it_9582 ,

            Thanks for the additional information.

            The reason this is happening is because these endpoints do not return a WWW-Authenticate: Basic ... header value when responding with 401.

            This behavior intentional, as our preferred authentication is using an API Key header value, not Basic credentials. Basic is an alternative option and can be used when you can't easily pass a header.

            We are not willing/able to change this behavior, as it would require changing code on a substantial number of endpoints and may break user integrations that have been relying on existing behavior.

            So I'm afraid this means you'll need to do one of the following:

            • add the --auth-no-challenge option
            • use wget --header="X-ApiKey: <api-key>" "<Download path>" instead
            • use curl instead
            • use pgutil instead

            Cheers,
            Alana

            1 Reply Last reply Reply Quote 0
            • I Offline
              it_9582
              last edited by

              Hi @atripp,

              thanks for the explanation.
              I can understand that you are not willing/able to change this behavior. Now I will check if it is possible for us to modify the underlying wget call to allow downloading of the files from ProGet.

              Best regards

              1 Reply Last reply Reply Quote 0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • 1 / 1
              • First post
                Last post
              Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation