linux/stdenv: Fixups to accomodate boostrap-tools changes and ssl in fetchurl#8082
linux/stdenv: Fixups to accomodate boostrap-tools changes and ssl in fetchurl#8082wkennington wants to merge 9 commits intoNixOS:masterfrom
Conversation
|
@copumpkin @shlevy Let me know what needs to be done to add ssl verification support to the darwin stdenv. It looks like there is already a working curl with https in the bootstrap tools. Would it make sense to add cacert to the darwin bootstrap-tools and then enable ssl verification throughout? |
|
I added support to the darwin stdenv in both of these PR's, let me know if it works fine. |
There was a problem hiding this comment.
Was there a discussion about (dis)advantages of using insecure connection by default for fixed-output derivations? For most use cases I don't think there's any added security, and I suppose there's some (small) performance loss.
There was a problem hiding this comment.
Well, the main reason I want this implemented is for updated packages so
you can reasonably trust hashes you get out of failed fetchurls.
On Sun, May 31, 2015, 00:53 Vladimír Čunát notifications@github.com wrote:
In pkgs/build-support/fetchurl/default.nix
#8082 (comment):@@ -1,4 +1,4 @@
-{ stdenv, curl }: # Note thatcurl' may benull', in case of the native stdenv.
+{ stdenv, curl, ca_cert_file ? null, insecure ? false }: # Note thatcurl' may benull', in case of the native stdenv.Was there a discussion about (dis)advantages of using insecure connection
by default for fixed-output derivations? For most use cases I don't think
there's any added security, and I suppose there's some (small) performance
loss.—
Reply to this email directly or view it on GitHub
https://github.com/NixOS/nixpkgs/pull/8082/files#r31387880.
There was a problem hiding this comment.
The performance penalty should be minute compared to the costs of
everything else in the TLS stack.
On Sun, May 31, 2015, 00:54 William Kennington william@wkennington.com
wrote:
Well, the main reason I want this implemented is for updated packages so
you can reasonably trust hashes you get out of failed fetchurls.On Sun, May 31, 2015, 00:53 Vladimír Čunát notifications@github.com
wrote:In pkgs/build-support/fetchurl/default.nix
#8082 (comment):@@ -1,4 +1,4 @@
-{ stdenv, curl }: # Note thatcurl' may benull', in case of the native stdenv.
+{ stdenv, curl, ca_cert_file ? null, insecure ? false }: # Note thatcurl' may benull', in case of the native stdenv.Was there a discussion about (dis)advantages of using insecure connection
by default for fixed-output derivations? For most use cases I don't think
there's any added security, and I suppose there's some (small) performance
loss.—
Reply to this email directly or view it on GitHub
https://github.com/NixOS/nixpkgs/pull/8082/files#r31387880.
There was a problem hiding this comment.
I see. I suspect the main part of performance loss is due to extra latency of https handshake, but according to docs it seems that would happen even with --insecure with https, so it's more about whether to prefer https URLs over http ones.
I already thought before: it would be nice if fetching was done over plain http/ftp/... by default, but failed-hash ones would be re-checked securely afterward (ideally by PGP, or at least https re-fetch).
There was a problem hiding this comment.
Actually, thinking about it again, most traffic is supposed to go from binary caches instead of fetching sources, so having https by default for source fetches sounds good. The actual checking of certs (--insecure) will probably have completely negligible overhead, given that you need to build the package after you fetch the sources.
BTW, adding that PGP scheme would be nice, maybe as opt-in via an impure env. variable for nixpkgs devs...
There was a problem hiding this comment.
Oh it's not the performance I'm concerned about, I was wondering if it even
took into account proper CA validation when connecting over https. I dont
think it has a valid set of CA pem's in its configuration.
On Sun, May 31, 2015, 01:22 Vladimír Čunát notifications@github.com wrote:
In pkgs/build-support/fetchurl/default.nix
#8082 (comment):@@ -1,4 +1,4 @@
-{ stdenv, curl }: # Note thatcurl' may benull', in case of the native stdenv.
+{ stdenv, curl, ca_cert_file ? null, insecure ? false }: # Note thatcurl' may benull', in case of the native stdenv.Binary cache handling is done by nix itself, not nixpkgs. There, if all
fetches (from one cache) are done in a single connection, the overhead
should be pretty minimal. It might be considered to only fetch *.narinfo
files securely (tiny), but the performance difference doesn't seem worth
the bother (encoding long streams by symmetric ciphers).—
Reply to this email directly or view it on GitHub
https://github.com/NixOS/nixpkgs/pull/8082/files#r31388082.
There was a problem hiding this comment.
Anyway does this look good otherwise?
On Sun, May 31, 2015, 01:32 Vladimír Čunát notifications@github.com wrote:
In pkgs/build-support/fetchurl/default.nix
#8082 (comment):@@ -1,4 +1,4 @@
-{ stdenv, curl }: # Note thatcurl' may benull', in case of the native stdenv.
+{ stdenv, curl, ca_cert_file ? null, insecure ? false }: # Note thatcurl' may benull', in case of the native stdenv.I think this is the relevant place: NixOS/nix#491
NixOS/nix#491.—
Reply to this email directly or view it on GitHub
https://github.com/NixOS/nixpkgs/pull/8082/files#r31388163.
There was a problem hiding this comment.
What about dropping the insecure parameter and consider let insecure = ca_cert_file != null;? Is there any sense in a different setting?
With passing the flag, the cert file should be unused; without the file the verification should always fail without --insecure, I think.
There was a problem hiding this comment.
I want to make sure all implementations explicitly understand that a lack
of ca implies insecure but I wouldn't be against changing this.
On Sun, May 31, 2015, 01:53 Vladimír Čunát notifications@github.com wrote:
In pkgs/build-support/fetchurl/default.nix
#8082 (comment):@@ -1,4 +1,4 @@
-{ stdenv, curl }: # Note thatcurl' may benull', in case of the native stdenv.
+{ stdenv, curl, ca_cert_file ? null, insecure ? false }: # Note thatcurl' may benull', in case of the native stdenv.What about dropping the insecure parameter and consider let insecure =
ca_cert_file != null;? Is there any sense in a different setting?—
Reply to this email directly or view it on GitHub
https://github.com/NixOS/nixpkgs/pull/8082/files#r31388309.
|
+1, having tls support in fetching is important as we don't know how users get the hash and they might use an incorrect sha. If we decide to use insecure fetchurl, we should fix it's message not to report the hash, but to rather instruct to use nix-prefetch-url. |
If you are a direct user of fetchurl, you are encouraged to implement support for adding a default set of certificates for ssl verification. This can be done by providing the nss cacert ca-bundle.crt.
8a61525 to
95e2d55
Compare
95e2d55 to
00f3d8e
Compare
|
I don't really see the point of this. I mean, the hash is verified by Nix, so what's wrong with using |
|
For end users yes this is true, but if developers use the workflow of On Tue, Jul 7, 2015, 06:28 Eelco Dolstra notifications@github.com wrote:
|
|
Yeah, as @domenkozar said, it's better to use |
|
Sure, but it isn't always obvious what that URL is if you aren't directly On Tue, Jul 7, 2015, 11:00 Eelco Dolstra notifications@github.com wrote:
|
|
I always use the following hacky shell function around nix-prefetch-url: To use: will download the source of |
|
Would still love to have this! |
This is the second patchset for #8081. This adds support for the new boostrap-tools changes and also adds ssl verification support into fetchurl.