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!

    Clair integration with ProGet results in 'BadRequest for layer sha256' warnings in VulnerabilityDownloader job

    Scheduled Pinned Locked Moved Support
    35 Posts 4 Posters 96 Views 1 Watching
    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.
    • rhessingerR Offline
      rhessinger inedo-engineer
      last edited by

      Hi @scusson_9923,

      Please give me a little bit of time to work through this. If I have learned anything about Docker, it is that certificates are handled differently on every image. I need to do some digging to find out what is needed to make this work. I don't think HTTPS is a lost cause, we just need to figure out how Clair needs to handle these certs.

      Thanks,
      Rich

      Products Engineer, Inedo

      1 Reply Last reply Reply Quote 0
      • S Offline
        scusson_9923
        last edited by

        No problem Rich and thanks for looking into this. I think we will both learn something in the end. This is not a high priority at the moment, fyi.

        Thanks,
        Scott

        1 Reply Last reply Reply Quote 0
        • Dan_WoolfD Offline
          Dan_Woolf inedo-engineer
          last edited by

          Hi @scusson_9923 ,

          Can you please confirm that you do not see any errors in the diagnostic center after running a vulnerability scan? I just want to confirm that this is an SSL problem and not an underlying ProGet issue.

          Thanks,
          Dan

          1 Reply Last reply Reply Quote 0
          • S Offline
            scusson_9923
            last edited by

            Hi Dan,

            The Diagnostic Center does not contain any warnings or errors regarding vulnerabilities.

            Thanks,
            Scott

            1 Reply Last reply Reply Quote 0
            • S Offline
              scusson_9923
              last edited by

              Hi,

              Adding a little more info. I installed curl in the clair container and it comes back with success when wget does not.

              curl -I https://<proget_server>
              HTTP/2 200
              cache-control: private
              content-length: 22803
              content-type: text/html; charset=UTF-8
              server: Microsoft-IIS/10.0
              x-aspnet-version: 4.0.30319
              x-proget-version: 5.3.36.4
              x-powered-by: ASP.NET
              date: Mon, 20 Sep 2021 15:10:11 GMT

              Thanks,
              Scott

              1 Reply Last reply Reply Quote 0
              • Dan_WoolfD Offline
                Dan_Woolf inedo-engineer
                last edited by

                Hi @scusson_9923 ,

                Thanks for sending the updated info. Would you be able to attach to output of the Clair container (docker attach <RUNNING_CLAIR_CONTAINER_NAME>) and run the vulnerability downloader from ProGet? Clair will output the exact HTTP error that is happening when connecting to ProGet. That will help to confirm if it is an SSL issue or not.

                One other thing to try would be to upgrade Clair to 2.1.7. I know they fixed an issue relating to a RHEL feature they use, that happened to be affecting my test environment.

                Sorry for the delay on our end. Clair has released a new version and API which makes finding the older documentation a bit harder. We have not tested it with the latest version of Clair (4.2.2), but I would expect their to be some API issues. We are waiting for Clair's development to stabilize a bit more before we implement the new API. Last time we tested it, Clair's v4 API had so many bugs that it prevented us from supporting it.

                Thanks,
                Dan

                1 Reply Last reply Reply Quote 0
                • S Offline
                  scusson_9923
                  last edited by

                  Hi Dan,

                  I have updated Clair to 2.1.7. wget appears to ping ProGet successfully (curl as well), however, the vulnerability downloader fails to authenticate:

                  Inside Clair container:

                  curl -I https://<proget_server>
                  HTTP/2 200

                  cache-control: private
                  content-length: 23531
                  content-type: text/html; charset=UTF-8
                  server: Microsoft-IIS/10.0
                  x-aspnet-version: 4.0.30319
                  x-proget-version: 5.3.36.4
                  x-powered-by: ASP.NET
                  date: Mon, 20 Sep 2021 17:42:08 GMT

                  wget --spider https://<proget_server>
                  Connecting to <proget_server> (<proget_cluster_IP>:443)
                  remote file exists

                  /tmp # read escape sequence

                  On build machine

                  docker container ls
                  CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
                  3a8a5c58b8cc quay.io/coreos/clair:v2.1.7 "/usr/bin/dumb-init …" 11 minutes ago Up 6 minutes zealous_jemison
                  e794f6f91d08 postgres:9.6 "docker-entrypoint.s…" 10 days ago Up 10 days 0.0.0.0:5432->5432/tcp, :::5432->5432/tcp charming_gould
                  [root@optjenkinscent09 ~]# docker attach 3a8a5c58b8cc
                  {"Event":"could not download layer","Level":"warning","Location":"driver.go:130","Time":"2021-09-20 17:43:52.834425","error":"Get https://<proget_server>/api/docker-blobs/download/sha256%3A80369df487363e56aea88d4d41b61f1607fc2ec198e9327cfde36a5346c71bf2?API_Key=0E-6E-66-D2-5B-CE-CB-78-1A-C0-62-1B-E9-50-72-59-54-50-90-41-43-AB-F7-55-B5: x509: certificate signed by unknown authority"}
                  {"Event":"failed to extract data from path","Level":"error","Location":"worker.go:122","Time":"2021-09-20 17:43:52.834515","error":"could not find layer","layer":"sha256:80369df487363e56aea88d4d41b61f1607fc2ec198e9327cfde36a5346c71bf2","path":"https://<proget_server>/api/docker-blobs/download/sha256%3A80369df487363e56aea88d4d41b61f1607fc2ec198e9327cfde36a5346c71bf2"}
                  {"Event":"Handled HTTP request","Level":"info","Location":"router.go:57","Time":"2021-09-20 17:43:52.834572","elapsed time":91078190,"method":"POST","remote addr":"<proget_web_node>:59389","request uri":"/v1/layers","status":"400"}

                  Maybe there is a process in the Clair container that can't detect our trusted CA cert.

                  Hope this helps.

                  Thanks,
                  Scott

                  1 Reply Last reply Reply Quote 0
                  • rhessingerR Offline
                    rhessinger inedo-engineer
                    last edited by

                    Hi @scusson_9923,

                    I was just researching this a bit and it looks like they may have added a toggle to disable SSL checks in Clair when downloading docker layers. Can you try adding -insecure-tls to your docker run statement for Clair?

                    Thanks,
                    Rich

                    Products Engineer, Inedo

                    1 Reply Last reply Reply Quote 0
                    • S Offline
                      scusson_9923
                      last edited by

                      Hi Rich,

                      Still is failing, different reason:

                      {"Event":"could not download layer: expected 2XX","Level":"warning","Location":"driver.go:136","Time":"2021-09-20 19:01:26.736879","status code":404}
                      {"Event":"failed to extract data from path","Level":"error","Location":"worker.go:122","Time":"2021-09-20 19:01:26.737319","error":"could not find layer","layer":"sha256:f033c4f65cdbf0bfa21d5543e56c0c41645eca4d893494bb4f0661b0f19ccc79","path":"https://<proget_server>/api/docker-blobs/download/sha256%3Af033c4f65cdbf0bfa21d5543e56c0c41645eca4d893494bb4f0661b0f19ccc79"}
                      {"Event":"Handled HTTP request","Level":"info","Location":"router.go:57","Time":"2021-09-20 19:01:26.737385","elapsed time":166008805,"method":"POST","remote addr":"<proget_web_node>:59778","request uri":"/v1/layers","status":"400"}

                      Thanks,
                      Scott

                      1 Reply Last reply Reply Quote 0
                      • rhessingerR Offline
                        rhessinger inedo-engineer
                        last edited by

                        Hi @scusson_9923,

                        Progress! It looks like we are past the SSL issue now. Can you check the diagnostics center in ProGet and see if there are any errors in there now?

                        Thanks,
                        Rich

                        Products Engineer, Inedo

                        1 Reply Last reply Reply Quote 0
                        • S Offline
                          scusson_9923
                          last edited by

                          Baby steps! I still see no entries in the diagnostics center regarding vulnerabilities.

                          Thanks,
                          Scott

                          1 Reply Last reply Reply Quote 0
                          • rhessingerR Offline
                            rhessinger inedo-engineer
                            last edited by

                            Hi @scusson_9923,

                            What happens if you try to wget https://<proget_server>/api/docker-blobs/download/sha256%3Af033c4f65cdbf0bfa21d5543e56c0c41645eca4d893494bb4f0661b0f19ccc79 from the Clair container? Does that also return a 404 error? Just to confirm, all the requests in the Vulnerability log are warnings still correct?

                            Thanks,
                            Rich

                            Products Engineer, Inedo

                            1 Reply Last reply Reply Quote 0
                            • S Offline
                              scusson_9923
                              last edited by scusson_9923

                              Hi,

                              I get 'wget: server returned error: HTTP/1.1 403 Forbidden'

                              When I try curl with a ProGet user\password, I get 'An API key is required to download Docker blobs.'

                              I saw the API key in the previous logs (container without -insecure-tls), but not now.

                              Thanks,
                              Scott

                              1 Reply Last reply Reply Quote 0
                              • rhessingerR Offline
                                rhessinger inedo-engineer
                                last edited by

                                Hi @scusson_9923,

                                Could you please generate a temporary API Key and try wget with https://<proget_server>/api/docker-blobs/download/sha256%3Af033c4f65cdbf0bfa21d5543e56c0c41645eca4d893494bb4f0661b0f19ccc79?API_Key=<API_KEY> from the container? Can you also try that from your browser (it should try to download the file)?

                                It is throwing me off that you are getting a 404 for all the layer download requests. It sounds like either ProGet cannot find the layer, which should show an error in the log, or that Clair is calling to the wrong server for the download the layer.

                                I apologize for all the back and forth with this. This is the first time we have experienced this with Clair and I'm still trying to determine which component has the issue.

                                We are currently running Clair on our ProGet.inedo.com and it doesn't seem to have this issue. I'm also not able to recreate this locally, which makes this a bit more difficult.

                                Thanks,
                                Rich

                                Products Engineer, Inedo

                                1 Reply Last reply Reply Quote 0
                                • S Offline
                                  scusson_9923
                                  last edited by

                                  Hi Rich,

                                  I created an API key with full access and still get wget: server returned error: HTTP/1.1 403 Forbidden.

                                  When I place the same link in my local browser, I get:
                                  The specified API key does not permit access to the Docker Blob Reader API.

                                  In the Access Key Log:
                                  /api/docker-blobs/download/sha256:f033c4f65cdbf0bfa21d5543e56c0c41645eca4d893494bb4f0661b0f19ccc79?API_Key=<apikey>
                                  Response code: 403

                                  As a test, I used wget to download a file from an Assets directory inside the Clair container successfully.

                                  Thanks,
                                  Scott

                                  1 Reply Last reply Reply Quote 0
                                  • rhessingerR Offline
                                    rhessinger inedo-engineer
                                    last edited by

                                    This looks to be an issue when common blob storage is not enabled for a Docker registry. I have created a ticket, PG-2009, to track this fix. It is expected to be released in ProGet 5.3.39 which is scheduled to release on October 8th, 2021. I will post back here if anything changes.

                                    There was also an issue, PG-2008, that was fixed 5.3.38 that would sometimes return a 500 error to Calair when trying to download the layer. PG-2008 seems to only affect ProGet running on Linux.

                                    Thanks,
                                    Rich

                                    Products Engineer, Inedo

                                    F 1 Reply Last reply Reply Quote 0
                                    • F Offline
                                      furqan.ahmad_4378 @rhessinger
                                      last edited by

                                      @rhessinger Did you get a chance to apply update on Proget, Does that fix that issue? I'm also getting the same error: {"Event":"could not download layer: expected 2XX","Level":"warning","Location":"driver.go:136","Time":"2021-12-14 02:33:01.975151","status code":404}
                                      {"Event":"failed to extract data from path","Level":"error","Location":"worker.go:122","Time":"2021-12-14 02:33:01.975206","error":"could not find layer","layer" docker-blobs.

                                      Looking forward to hearing from you.

                                      Thanks,
                                      Furqan

                                      1 Reply Last reply Reply Quote 0
                                      • rhessingerR Offline
                                        rhessinger inedo-engineer
                                        last edited by

                                        Hi @furqan-ahmad_4378,

                                        ProGet 5.3.39 and later include the fixes for these issues. We also improved the performance of the list repositories page in ProGet 6.0.3+. What version of ProGet are you currently running? Also, is this happening for every layer?

                                        Thanks,
                                        Rich

                                        Products Engineer, Inedo

                                        F 1 Reply Last reply Reply Quote 0
                                        • F Offline
                                          furqan.ahmad_4378 @rhessinger
                                          last edited by

                                          @rhessinger Thank you for sharing this information, We are on 5.3.27 at the moment. Yup its on every docker layer :(

                                          1 Reply Last reply Reply Quote 0
                                          • F Offline
                                            furqan.ahmad_4378
                                            last edited by

                                            Hi @rhessinger May I ask you which Clair docker Image you are on?

                                            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
                                            • 2
                                            • 2 / 2
                                            • First post
                                              Last post
                                            Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation