Commit Graph

16221 Commits

Author SHA1 Message Date
Eelco Dolstra
28627c839f
Merge pull request #11779 from NixOS/mergify/bp/2.20-maintenance/pr-11775
doc/rl-2.19: add entry for always-allow-substitutes option (backport #11775)
2024-11-01 16:54:56 +01:00
Bjørn Forsman
71d8a615d1 doc/rl-2.19: add entry for always-allow-substitutes option (#11775)
* doc/rl-2.19: add entry for always-allow-substitutes option

Fixes https://github.com/NixOS/nix/issues/9427.

(cherry picked from commit 020dbac0e0)
2024-11-01 10:56:24 +00:00
Eelco Dolstra
49c999daee Bump version 2024-10-31 14:02:19 +01:00
Eelco Dolstra
f983ce6b39 maintainers/upload-release.pl: Delete temporary directories when we're done
(cherry picked from commit 02bb633a58)
2024-10-31 13:57:03 +01:00
Eelco Dolstra
d9775222fb Fix perlBindings build on macOS
https://hydra.nixos.org/build/276515695
(cherry picked from commit 750db54bfc)
2024-10-31 12:44:42 +01:00
Eelco Dolstra
a640aa0c9b Merge remote-tracking branch 'nix-ghsa-wf4c-57rh-9pjg/advisory-fix-1-2.20' into 2.20-maintenance 2024-10-30 21:42:47 +01:00
Robert Hensing
55be7deee1 local-derivation-goal: Move builder preparation to non-builtin code path 2024-10-22 21:52:12 +02:00
Robert Hensing
db6bcf3f77 local-derivation-goal: Refactor
This works because the `builder` and `args` variables are only used
in the non-builtin code path.

Co-Authored-By: Théophane Hufschmitt <theophane.hufschmitt@tweag.io>
2024-10-22 21:52:12 +02:00
Robert Hensing
b78e489f79 local-derivation-goal: Print sandbox error detail on darwin
Co-Authored-By: Théophane Hufschmitt <theophane.hufschmitt@tweag.io>
2024-10-22 21:52:12 +02:00
Puck Meerburg
aa54b01af5 fix: Run all derivation builders inside the sandbox on macOS 2024-10-22 21:52:09 +02:00
Robert Hensing
e5f45f4b98
Merge pull request #11686 from NixOS/backport-11610-to-2.20-maintenance
Backport #11610 to 2.20 maintenance
2024-10-21 22:25:46 +02:00
Tom Bereknyei
c31abadb25 feat: better warning for common SSL errors
(cherry picked from commit 3e5bf90341)
2024-10-14 15:00:04 +02:00
Théophane Hufschmitt
e8e62c95dd Test the inclusion of transitive symlinks in the sandbox
(cherry picked from commit cef677ddbc)
2024-10-14 14:42:45 +02:00
Théophane Hufschmitt
1cc79f1343 Fix the access of symlinks to host files in the sandbox
https://github.com/NixOS/nix/pull/10456 fixed the addition of symlink
store paths to the sandbox, but also made it so that the hardcoded
sandbox paths (like `/etc/hosts`) were now bind-mounted without
following the possible symlinks. This made these files unreadable if
there were symlinks (because the sandbox would now contain a symlink to
an unreachable file rather than the underlying file).
In particular, this broke FOD derivations on NixOS as `/etc/hosts` is a
symlink there.

Fix that by canonicalizing all these hardcoded sandbox paths before
adding them to the sandbox.

(cherry picked from commit acbb1523c1)
2024-10-14 14:42:45 +02:00
Jörg Thalheim
8d763e7ab9 tests/nixos/fetchurl: drop unused variables
(cherry picked from commit de9946cbfd4858133462c8cc6b7838edb3be2451)
2024-10-13 13:06:58 +02:00
Puck Meerburg
9b818f14dd fix passing CA files into builtins:fetchurl sandbox
This patch has been manually adapted from
14dc84ed03

Tested with:

$ NIX_SSL_CERT_FILE=$(nix-build '<nixpkgs>' -A cacert)/etc/ssl/certs/ca-bundle.crt nix-build --store $(mktemp -d) -E 'import <nix/fetchurl.nix> { url = https://google.com; }'
warning: found empty hash, assuming 'sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='
this derivation will be built:
  /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv
building '/nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv'...
error:
       … writing file '/nix/store/0zynn4n8yx59bczy1mgh1lq2rnprvvrc-google.com'

       error: unable to download 'https://google.com': Problem with the SSL CA cert (path? access rights?) (77)
error: builder for '/nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv' failed with exit code 1

Now returns:

nix-env % NIX_SSL_CERT_FILE=$(nix-build '<nixpkgs>' -A cacert)/etc/ssl/certs/ca-bundle.crt nix-build --store $(mktemp -d) -E 'import <nix/fetchurl.nix> { url = https://google.com; }'
this derivation will be built:
  /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv
building '/nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv'...
error: hash mismatch in fixed-output derivation '/nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv':
         specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
            got:    sha256-5xXEhGtnRdopaUTqaz2M1o2NE7ovhU0SjcSOPwntqwY=

(cherry picked from commit 1fbdf409524bb350b8614f3d95067cb9ba3c57f2)
2024-10-13 13:06:19 +02:00
Puck Meerburg
de2a27caab fixup! Add a test for builtin:fetchurl cert verification 2024-10-13 13:02:46 +02:00
Eelco Dolstra
8429c6990c
Merge pull request #11588 from NixOS/mergify/bp/2.20-maintenance/pr-11585
builtin:fetchurl: Enable TLS verification (backport #11585)
2024-09-26 01:06:48 +02:00
Eelco Dolstra
ebff89a4e5 Resolve conflict 2024-09-26 00:20:13 +02:00
Eelco Dolstra
708ea7cf7f Typo
(cherry picked from commit ef8987955b)
2024-09-26 00:20:11 +02:00
Eelco Dolstra
b91412595b Add release note
(cherry picked from commit 7b39cd631e)
2024-09-25 21:53:43 +00:00
Eelco Dolstra
10e3c1631e Add a test for builtin:fetchurl cert verification
(cherry picked from commit f2f47fa725)

# Conflicts:
#	tests/nixos/default.nix
2024-09-25 21:53:43 +00:00
Eelco Dolstra
7e46d4077a builtin:fetchurl: Enable TLS verification
This is better for privacy and to avoid leaking netrc credentials in a
MITM attack, but also the assumption that we check the hash no longer
holds in some cases (in particular for impure derivations).

Partially reverts 5db358d4d7.

(cherry picked from commit c04bc17a5a)
2024-09-25 21:53:42 +00:00
John Ericson
0969e6375c
Merge pull request #11572 from NixOS/mergify/bp/2.20-maintenance/pr-11390
Don't refer to public keys as secret keys in error (backport #11390)
2024-09-23 18:22:25 -04:00
Alyssa Ross
236a9f5c47 Don't refer to public keys as secret keys in error
This constructor is used for public keys as well.

(cherry picked from commit 9cc550d652)
2024-09-23 22:02:15 +00:00
Robert Hensing
1da3fd549e
Merge pull request #11480 from NixOS/mergify/bp/2.20-maintenance/pr-11473
Fix making the build directory kept by `keep-failed` readable (backport #11473)
2024-09-16 12:40:28 +02:00
Artturin
584dd39b4a Fix making the build directory kept by keep-failed readable
Caused by 1d3696f0fb

Without this fix the kept build directory is readable only by root

```
$ sudo ls -ld /comp-temp/nix-build-openssh-static-x86_64-unknown-linux-musl-9.8p1.drv-5
drwx------ root root 60 B Wed Sep 11 00:09:48 2024  /comp-temp/nix-build-openssh-static-x86_64-unknown-linux-musl-9.8p1.drv-5/

$ sudo ls -ld /comp-temp/nix-build-openssh-static-x86_64-unknown-linux-musl-9.8p1.drv-5/build
drwxr-xr-x nixbld1 nixbld 80 B Wed Sep 11 00:09:58 2024  /comp-temp/nix-build-openssh-static-x86_64-unknown-linux-musl-9.8p1.drv-5/build/
```

(cherry picked from commit ebebe626ff)
2024-09-11 12:54:12 +00:00
Eelco Dolstra
09a192989d
Merge pull request #11417 from NixOS/mergify/bp/2.20-maintenance/pr-10919
install-darwin: fix _nixbld uids for macOS sequoia (backport #10919)
2024-09-10 21:28:38 +02:00
Robert Hensing
b9adc6e654
Merge pull request #11451 from NixOS/backport-11449-to-2.20-maintenance
[Backport 2.20-maintenance] [Backport 2.22-maintenance] installerScriptForGHA: aarch64-darwin
2024-09-09 18:24:00 +02:00
Robert Hensing
719c80734f installerScriptForGHA: aarch64-darwin
Backport of https://github.com/NixOS/nix/pull/11009

(cherry picked from commit c2a428eac3)
2024-09-09 15:55:04 +00:00
Emily
ae4156b489 install-darwin: increment base UID by 1 (#15)
(cherry picked from commit 11cf29b15c)
2024-09-03 23:57:08 +00:00
Travis A. Everett
2bcd6ea51a install-darwin: move nixbld gid to match first UID
(cherry picked from commit 75567423fb)
2024-09-03 23:57:08 +00:00
Travis A. Everett
efd6511555 install-darwin: fix _nixbld uids for macOS sequoia
Starting in macOS 15 Sequoia, macOS daemon UIDs are encroaching on our
default UIDs of 301-332. This commit relocates our range up to avoid
clashing with the current UIDs of 301-304 and buy us a little time
while still leaving headroom for people installing more than 32 users.

(cherry picked from commit df36ff0d1e)
2024-09-03 23:57:07 +00:00
Robert Hensing
8b906d3811
Merge pull request #11338 from NixOS/backport-11332-to-2.20-maintenance
[Backport 2.20-maintenance] [Backport 2.22-maintenance] fix: check to see if there are any lines before
2024-08-19 17:11:45 +02:00
Tom Bereknyei
bbeaaa3fa3 fix: check to see if there are any lines before
(cherry picked from commit 59db8fd62b)
(cherry picked from commit aab801db98)
2024-08-19 14:28:15 +00:00
Eelco Dolstra
45cfd02414 Bump version 2024-07-08 16:35:52 +02:00
Robert Hensing
db4153d272
Merge pull request #11049 from NixOS/backport-11046-to-2.20-maintenance
[Backport 2.20-maintenance] [Backport 2.21-maintenance] libstore: fix sandboxed builds on macOS
2024-07-05 19:48:14 +02:00
Emily
87d2913bbf libstore: fix sandboxed builds on macOS
The recent fix for CVE-2024-38531 broke the sandbox on macOS
completely. As it’s not practical to use `chroot(2)` on
macOS, the build takes place in the main filesystem tree, and the
world‐unreadable wrapper directory prevents the build from accessing
its `$TMPDIR` at all.

The macOS sandbox probably shouldn’t be treated as any kind of a
security boundary in its current state, but this specific vulnerability
wasn’t possible to exploit on macOS anyway, as creating `set{u,g}id`
binaries is blocked by sandbox policy.

Locking down the build sandbox further may be a good idea in future,
but it already has significant compatibility issues. For now, restore
the previous status quo on macOS.

Thanks to @alois31 for helping me come to a better understanding of
the vulnerability.

Fixes: 1d3696f0fb
Closes: #11002
(cherry picked from commit af2e1142b1)
(cherry picked from commit 9feee13952)
2024-07-05 15:59:25 +00:00
Emily
98a7d3b0a4 libstore: clean up the build directory properly
After the fix for CVE-2024-38531, this was only removing the nested
build directory, rather than the top‐level temporary directory.

Fixes: 1d3696f0fb
(cherry picked from commit 76e4adfaac)
(cherry picked from commit 0d68b40dda)
2024-07-05 15:59:25 +00:00
Robert Hensing
1e896c1738
Merge pull request #11026 from NixOS/backport-11022-to-2.20-maintenance
[Backport 2.20-maintenance] Use proper struct sockpeercred for SO_PEERCRED for OpenBSD
2024-07-03 20:39:58 +02:00
John Ericson
c8d2bc72a5 Remove invalid release notes YAML field
There is no PR for this, since it was an embargoed fix before
disclosure.

(cherry picked from commit 32e67eba8b)
2024-07-03 20:02:23 +02:00
kn
4a42535dc0 Use proper struct sockpeercred for SO_PEERCRED for OpenBSD
getsockopt(2) documents this;  ucred is wrong ("cr_" member prefix, no pid).

(cherry picked from commit 10ccdb7a41)
2024-07-03 15:57:06 +00:00
John Ericson
2040540717 Ident some CPP in nix daemon
Makes it easier for me to read.

(cherry picked from commit a09360400b)
2024-07-03 15:57:06 +00:00
Eelco Dolstra
7891e56fb1 Bump version 2024-06-27 11:07:06 +02:00
tomberek
2b15b0b9b0
Merge pull request from GHSA-q82p-44mg-mgh5
Fix sandbox escape 2.20
2024-06-26 18:49:22 -04:00
Eelco Dolstra
caf4082dce Fix --no-sandbox
When sandboxing is disabled, we cannot put $TMPDIR underneath an
inaccessible directory.

(cherry picked from commit 86ca2d6d94c0581fda0c666c5e022784952f3542)
(cherry picked from commit 8f58b98770)
2024-06-21 16:39:44 +02:00
Eelco Dolstra
eee27e83e0 Formatting
(cherry picked from commit 3af22860759509d5040ff70618247031d96a095c)
2024-06-21 16:39:44 +02:00
Eelco Dolstra
879d814a75 Put the chroot inside a directory that isn't group/world-accessible
Previously, the .chroot directory had permission 750 or 755 (depending
on the uid-range system feature) and was owned by root/nixbld. This
makes it possible for any nixbld user (if uid-range is disabled) or
any user (if uid-range is enabled) to inspect the contents of the
chroot of an active build and maybe interfere with it (e.g. via /tmp
in the chroot, which has 1777 permission).

To prevent this, the root is now a subdirectory of .chroot, which has
permission 700 and is owned by root/root.

(cherry picked from commit af280e72fa0e62e1c2eaccfb992c0dbb6f27f895)
2024-06-21 16:39:44 +02:00
John Ericson
d3ca72cfd5
Merge pull request #10850 from NixOS/backport-10549-to-2.20-maintenance
[Backport 2.20-maintenance] Fix exportReferencesGraph when given store subpath
2024-06-04 06:46:39 -04:00
Alyssa Ross
f6b6c996a7 Fix exportReferencesGraph when given store subpath
With Nix 2.3, it was possible to pass a subpath of a store path to
exportReferencesGraph:

	with import <nixpkgs> {};

	let
	  hello = writeShellScriptBin "hello" ''
	    echo ${toString builtins.currentTime}
	  '';
	in

	writeClosure [ "${hello}/bin/hello" ]

This regressed with Nix 2.4, with a very confusing error message, that
presumably indicates it was unintentional:

	error: path '/nix/store/3gl7kgjr4pwf03f0x70dgx9ln3bhl7zc-hello/bin/hello' is not in the Nix store

(cherry picked from commit 0774e8ba33)
2024-06-04 10:26:19 +00:00