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

python3Packages.requests: set default system certificate path #94024

Closed
wants to merge 1 commit into from

Conversation

symphorien
Copy link
Member

Motivation for this change

The next version of ihatemoney will use requests in a system service to connect to a https third party. In the nixos test, I mock this api with nginx and a self signed certificate which I add to the system certificate store. The mock certificated it accepted by curl but not by requests. The reason is that requests seems to ignore the system certificate store. This patch makes it use it.

I don't know if it's the best way to do so, or if there is a better way. In any case:

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@FRidh
Copy link
Member

FRidh commented Jul 31, 2020

related issue #8247

@FRidh
Copy link
Member

FRidh commented Jul 31, 2020

requests falls back to what the certifi package offers. https://2.python-requests.org/en/master/user/advanced/#ca-certificates
Not having gone through the code, this will likely kill that fallback method.

Is setting the environment variable no option?

Example https://github.com/NixOS/nixpkgs/pull/71291/files#diff-3ac514cd8063d3114597ce7aa42b27cfR210

@symphorien
Copy link
Member Author

Yes setting the environment variable is an option, but curl already accepts the certificate (because we teach it to respect global certificates), so I would expect python utilities to do the same...

@symphorien symphorien closed this Jul 31, 2020
@FRidh
Copy link
Member

FRidh commented Jul 31, 2020

Right. So, there are a couple of options there and neither is nice and we would really need to document what we do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants