-
Notifications
You must be signed in to change notification settings - Fork 228
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
SSL certificates are unset inside devbox shell #177
Labels
bug
Something isn't working
Comments
Thanks for the thorough investigation into this! I agree that it makes sense to leave the cert file set by default. This should be a simple change of just adding |
gcurtis
added a commit
that referenced
this issue
Sep 26, 2022
When `NIX_SSL_CERT_FILE` and `SSL_CERT_FILE` aren't explicitly set, `nix-shell --pure` sets them to invalid paths (specifically "/no-cert-file.crt") to ensure that openssl doesn't use certificates that live outside of the current Nix environment. This causes HTTPS requests in most programs to fail. For example: (devbox) $ curl https://google.com curl: (77) error setting certificate verify locations: CAfile: /no-cert-file.crt CApath: none This is pretty inconvenient for development, so we want to undo those changes when launching a devbox shell. To do that, we: 1. Keep any `NIX_SSL_CERT_FILE` and `SSL_CERT_FILE` values that are set in the parent shell. 2. Unset `NIX_SSL_CERT_FILE` or `SSL_CERT_FILE` when they're set to the "/no-cert-file.crt" value set by `nix-shell`. This causes openssl to go back to using the default paths. NIX_SSL_CERT_FILE is used by some programs installed by Nix. SSL_CERT_FILE is used by non-Nix programs and some Nix programs. Fixes #177.
gcurtis
added a commit
that referenced
this issue
Sep 26, 2022
When `NIX_SSL_CERT_FILE` and `SSL_CERT_FILE` aren't explicitly set, `nix-shell --pure` sets them to invalid paths (specifically "/no-cert-file.crt") to ensure that openssl doesn't use certificates that live outside of the current Nix environment. This causes HTTPS requests in most programs to fail. For example: (devbox) $ curl https://google.com curl: (77) error setting certificate verify locations: CAfile: /no-cert-file.crt CApath: none This is pretty inconvenient for development, so we want to undo those changes when launching a devbox shell. To do that, we: 1. Keep any `NIX_SSL_CERT_FILE` and `SSL_CERT_FILE` values that are set in the parent shell. 2. Unset `NIX_SSL_CERT_FILE` or `SSL_CERT_FILE` when they're set to the "/no-cert-file.crt" value set by `nix-shell`. This causes openssl to go back to using the default paths. NIX_SSL_CERT_FILE is used by some programs installed by Nix. SSL_CERT_FILE is used by non-Nix programs and some Nix programs. Fixes #177.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, Nix's SSL certificates are not working properly within devbox shell.
Here's a trivial example (Devbox
0.0.6
on macOS Monterey):Investigating it a bit further:
So I tried the following and it did solve the issue:
I guess the root cause is that
devbox shell
relies onnix-shell --pure
. Apparently it is the intended design to set$NIX_SSL_CERT_FILE
to/no-cert-file.crt
inside pure nix-shells.It would be great though not to lose such a crucial env var when using a devbox shell... Or maybe at least have them somehow listed/documented somewhere? :)
For now, I'm manually editing
devbox.json
to make sure my shellinit_hook
hasexport NIX_SSL_CERT_FILE=/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt
in there.Thanks in advance!
The text was updated successfully, but these errors were encountered: