Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with SBOM generation in Harbor v2.11.0 when using external Reverse Proxy (HTTP 404) #20565

Closed
omaster395464gh opened this issue Jun 9, 2024 · 1 comment · Fixed by #20575

Comments

@omaster395464gh
Copy link

omaster395464gh commented Jun 9, 2024

Issue:
The new SBOM generation feature in version 2.11.0 uses the external URL, leading to 404 errors due to the reverse proxy configuration.

Suggested Fix:
I recommend that the internal server name be used for SBOM uploads like other internal communications to avoid this issue. This would ensure consistency and prevent misdirected requests that result in 404 errors (and connections failures when calling external services).

Question:
Is there a way to configure Harbor to use the container internal server name instead of the external URL when uploading SBOM results?

Thank for your great work and for looking into this issue. I appreciate any guidance or updates you can provide.

Best regards,
Oliver


My configuration:

User Access --> https://myrepo.example.com (HTTPS)
|
External Nginx Reverse Proxy --> https://internalserver.example.local (HTTPS)
|
Harbor by docker compose

In version 2.10.x, everything functions as expected, including upload of vulnerability scans.
However, in version 2.11.x, the new SBOM generation feature seems to be mistakenly using the external URL (https://myrepo.example.com) for internal communications. This misconfiguration leads to a situation where the external reverse proxy only returns HTTP 404 when accessed from the internal network.

docker compose logs

harbor-jobservice  | 2024-06-09T13:20:26Z [ERROR] [/pkg/scan/sbom/sbom.go:108]: error when create accessory from image GET https://myrepo.example.com/v2/: unexpected status code 404 Not Found: <html>
harbor-jobservice  | <head><title>404 Not Found</title></head>
harbor-jobservice  | <body>
harbor-jobservice  | <center><h1>404 Not Found</h1></center>
harbor-jobservice  | <hr><center>nginx</center>
harbor-jobservice  | </body>
harbor-jobservice  | </html>
harbor-jobservice  | 2024-06-09T13:20:26Z [ERROR] [/pkg/scan/job.go:307]: Failed to convert vulnerability data to new schema for report 08c76d25-a6e4-4c5c-bc45-1e01260cc224, error GET https://myrepo.example.com/v2/: unexpected status code 404 Not Found: <html>
harbor-jobservice  | <head><title>404 Not Found</title></head>
harbor-jobservice  | <body>
harbor-jobservice  | <center><h1>404 Not Found</h1></center>
harbor-jobservice  | <hr><center>nginx</center>
harbor-jobservice  | </body>
harbor-jobservice  | </html>
harbor-jobservice  | 2024-06-09T13:20:26Z [ERROR] [/jobservice/runner/redis.go:123]: Job 'IMAGE_SCAN:6c49933c8512c5f47b6739c7' exit with error: run error: GET https://myrepo.example.com/v2/: unexpected status code 404 Not Found: <html>
harbor-jobservice  | <head><title>404 Not Found</title></head>
harbor-jobservice  | <body>
harbor-jobservice  | <center><h1>404 Not Found</h1></center>
harbor-jobservice  | <hr><center>nginx</center>
harbor-jobservice  | </body>
harbor-jobservice  | </html>

harbor.yml

hostname: myrepo.example.com
http:
  port: 80
https:
  port: 443
  certificate: /root/owa/harbor_install/harbor/data/cert/internalserver.example.local.crt
  private_key: /root/owa/harbor_install/harbor/data/cert/internalserver.example.local.key

# internal_tls:
#   # set enabled to true means internal tls is enabled
#   enabled: true

# external_url: https://myrepo.example.com:443
# test only
# external_url: https://nginx:8443

I tried to switch my configuration to external_url: https://nginx:8443 and the sbom upload is working, but docker pull from https://myrepo.example.com failed with dial tcp: lookup nginx on ...: server misbehaving

@stonezdj
Copy link
Contributor

stonezdj commented Jun 11, 2024

To solve this issue, the sbom.go should use the internal URL to generate SBOM, the internal URL always starts with http://core:8080, and the accessory upload function fails to validate the reference if it contains the http:// or https://. need to remove it

stonezdj added a commit to stonezdj/harbor that referenced this issue Jun 11, 2024
fixes goharbor#20565

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
stonezdj added a commit to stonezdj/harbor that referenced this issue Jun 12, 2024
fixes goharbor#20565

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
stonezdj added a commit to stonezdj/harbor that referenced this issue Jun 12, 2024
fixes goharbor#20565

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
stonezdj added a commit to stonezdj/harbor that referenced this issue Jun 12, 2024
fixes goharbor#20565

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
stonezdj added a commit to stonezdj/harbor that referenced this issue Jun 12, 2024
fixes goharbor#20565

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
stonezdj added a commit to stonezdj/harbor that referenced this issue Jun 12, 2024
  fixes goharbor#20565

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
stonezdj added a commit to stonezdj/harbor that referenced this issue Jun 12, 2024
  fixes goharbor#20565

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
stonezdj added a commit that referenced this issue Jun 13, 2024
…20581)

Use internal registry url to push artifact accessory

  fixes #20565

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
stonezdj added a commit to stonezdj/harbor that referenced this issue Jun 14, 2024
  fixes goharbor#20565

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
stonezdj added a commit to stonezdj/harbor that referenced this issue Jun 14, 2024
  fixes goharbor#20565

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
stonezdj added a commit to stonezdj/harbor that referenced this issue Jun 14, 2024
  fixes goharbor#20565

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
stonezdj added a commit that referenced this issue Jun 14, 2024
fixes #20565

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
chlins pushed a commit to chlins/harbor that referenced this issue Jun 17, 2024
fixes goharbor#20565

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants