Pass custom CA in built-in fetchers #654
Labels
No labels
Affects/CppNix
Affects/Nightly
Affects/Only nightly
Affects/Stable
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/lix ci
Area/nix-eval-jobs
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/repl/debugger
Area/store
bug
Context
contributors
Context
drive-by
Context
maintainers
Context
RFD
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
imported
Language/Bash
Language/C++
Language/NixLang
Language/Python
Language/Rust
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
Topic/Large Scale Installations
ux
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lix-project/lix#654
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Is your feature request related to a problem? Please describe.
Currently, working with custom CA endpoints that are not part of your system certificate bundle is quite frustrating and has no real easy workarounds to the best of my knowledge.
If you are able to leak environment variables, you can try to influence their behaviors via
SSL_CERT_FILE
orNIX_SSL_CERT_FILE
but it's not guaranteed to affect the daemon's environment except… if you just cause that.Describe the solution you'd like
Any TLS/network related built-in should accept
CApath
orCAfile
in the sense of OpenSSL or curl, that is: either a file or a path to a set of bundles.And propagate this adequately to the underlying fetchers.
Enabling:
Describe alternatives you've considered
SSL_CERT_FILE
to the daemon and let it reexport the variable to its childrenAdditional context
I can send a CL if we agree on the design of the feature.
Hmmm, except built in fetchers in the language are actually client side. The only fetching that's on the daemon is
builtin:fetchurl
or FODs. So it's a matter of giving the client the correct certs, today, and there should be very few security implications to the whole thing. Note there's been a security bug due to former lack of cert checking inbuiltin:fetchurl
; I'm unsure if this is super meaningful to this feature idea though.On macOS we actually gave up on enterprise certs at work because of nixpkgs curl not consulting the keychain for certs. On discussing with a friend at Apple we learned that the LibreSSL they use for /usr/bin/curl has some really bad patches that should not be repeated upstream since they use private frameworks, aren't public (except for openssl 0.98), and most crucially can't check the cert usage restrictions correctly, instead trusting the CA for signing all kinds of certs. The correct implementation is that curl itself should call Security.framework for getting system keychain CAs.
The same problem with usage restrictions exists for the directory based trust store; both macOS and Windows and the browsers are way ahead on this.
Anyway, all of this is to say, this infrastructure in curl itself sucks and it should be made better.
Allowing the client to send certs to the daemon can be dangerous in the presence of caching keyed on the URL due to poisoning attacks; I'm not sure if this is the case anywhere in the system today but it's a somewhat concerning type of possible issue.