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

Invalid peer certificate with --tls-no-verify #1982

Open
2 tasks done
zen-xu opened this issue Sep 5, 2024 · 13 comments
Open
2 tasks done

Invalid peer certificate with --tls-no-verify #1982

zen-xu opened this issue Sep 5, 2024 · 13 comments
Labels
auth Related to authentication 🐞 bug Something isn't working 🐍 pypi Issue related to PyPI dependencies

Comments

@zen-xu
Copy link
Contributor

zen-xu commented Sep 5, 2024

Checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pixi, using pixi --version.

Reproducible example

image

Issue description

I installed a pypi package published on nexus using the latest pixi on the company's intranet server, but encountered invalid peer certificate: UnknownIssuer
image

Expected behavior

--tls-no-verify should work

@zen-xu zen-xu added the 🐞 bug Something isn't working label Sep 5, 2024
@zen-xu
Copy link
Contributor Author

zen-xu commented Sep 5, 2024

Additionally, version 0.28.2 does not have this issue.

It seems to be related to #1929

@baszalmstra
Copy link
Contributor

That is strange! How did you install pixi?

@zen-xu
Copy link
Contributor Author

zen-xu commented Sep 5, 2024

download it from github

@zen-xu
Copy link
Contributor Author

zen-xu commented Sep 5, 2024

Or is it possible to provide an option for specifying a self-signed certificate?

@baszalmstra
Copy link
Contributor

You should be able to add the certificate to your oses certificate store and it should be picked up.

Ill investigate the regression.

@zen-xu
Copy link
Contributor Author

zen-xu commented Sep 5, 2024

I have added the certificate to /etc/ssl/certs/, version 0.28.2 can recognize it well, but version 0.29.0 cannot.

@baszalmstra
Copy link
Contributor

Ah this seems to be due to an update in uv: astral-sh/uv#6591 .

This is handled differently now between uv and pixi.. Looping in @tdejager . I think this kind of setup would also be much better for pixi but it would require a little refactoring. WDYT?

@baszalmstra
Copy link
Contributor

@zen-xu As a workaround you could try setting the SSL_CERT_FILE and/or SSL_CLIENT_CERT environment variables as described here: https://docs.astral.sh/uv/configuration/authentication/#authentication-with-alternative-package-indexes

@tdejager
Copy link
Contributor

tdejager commented Sep 5, 2024

@zen-xu As a workaround you could try setting the SSL_CERT_FILE and/or SSL_CLIENT_CERT environment variables as described here: https://docs.astral.sh/uv/configuration/authentication/#authentication-with-alternative-package-indexes

Are you sure that these are read from our library calls as well, some env variables uv reads from the command line modules only

@zen-xu
Copy link
Contributor Author

zen-xu commented Sep 5, 2024

This works

@benmoss
Copy link

benmoss commented Sep 13, 2024

Also running into the same thing, corporate MITM cert not getting respected by pixi when I use a pyproject file.

$ pixi init --pyproject
$ pixi add crane
  × default: error installing/updating PyPI dependencies
  ├─▶ Failed to prepare distributions
  ├─▶ Failed to fetch wheel: wow @ file:///private/tmp/wow
  ├─▶ Failed to install requirements from build-system.requires (resolve)
  ├─▶ No solution found when resolving: hatchling
  ├─▶ Request failed after 3 retries
  ├─▶ error sending request for url (https://pypi.org/simple/hatchling/)
  ├─▶ client error (Connect)
  ╰─▶ invalid peer certificate: UnknownIssuer

If I use a regular pixi.toml file this bug doesn't occur, so I agree it's due to uv changes rather than the switch to rustls-tls

@tdejager
Copy link
Contributor

tdejager commented Sep 13, 2024

Yes, I need to map the trusted-hosts feature from uv to our codebase, just need to think of a good spot in the pixi.toml for it. I'll try to get to in next week.

@tdejager
Copy link
Contributor

Also running into the same thing, corporate MITM cert not getting respected by pixi when I use a pyproject file.

$ pixi init --pyproject
$ pixi add crane
  × default: error installing/updating PyPI dependencies
  ├─▶ Failed to prepare distributions
  ├─▶ Failed to fetch wheel: wow @ file:///private/tmp/wow
  ├─▶ Failed to install requirements from build-system.requires (resolve)
  ├─▶ No solution found when resolving: hatchling
  ├─▶ Request failed after 3 retries
  ├─▶ error sending request for url (https://pypi.org/simple/hatchling/)
  ├─▶ client error (Connect)
  ╰─▶ invalid peer certificate: UnknownIssuer

If I use a regular pixi.toml file this bug doesn't occur, so I agree it's due to uv changes rather than the switch to rustls-tls

@benmoss in this case you get the MITM cert instead of the one from https://pypi.org right :)?

@ruben-arts ruben-arts added 🐍 pypi Issue related to PyPI dependencies auth Related to authentication labels Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth Related to authentication 🐞 bug Something isn't working 🐍 pypi Issue related to PyPI dependencies
Projects
None yet
Development

No branches or pull requests

5 participants