Open lheckemann opened 5 years ago
I marked this as stale due to inactivity. → More info
I currently use this NixOS module which does this.
{ config, pkgs, ...}: {
systemd.services.generate-nix-cache-key = {
wantedBy = [ "multi-user.target" ];
serviceConfig.Type = "oneshot";
path = [ pkgs.nix ];
script = ''
[[ -f /etc/nix/private-key ]] && exit
nix-store --generate-binary-cache-key ${config.networking.hostName}-1 /etc/nix/private-key /etc/nix/public-key
'';
};
nix.extraOptions = ''
secret-key-files = /etc/nix/private-key
'';
}
I marked this as stale due to inactivity. → More info
Yes, let's please do this.
Even as remote builders and substituters have been somewhat unified with the C++, the fact that the latter doesn't require sigs but the former does is a big difference.
If everyone signs by default, then we should be able to use the trusted-public-keys
for substitutors and binary caches by default.
builders-use-substitutes
makes me queasy today, but it doesn't really mean much: even if the builder doesn't substitute on demand, the path could have already been substituted. Either way, there are transitive trust issues. But if paths aren't re-signed on substitution, we can at least audit where stuff came from. Security wise, the builder can always be free to substitute instead and the requester will just reject the result if it doesn't trust the public key
Finally, with CA-derivations this gets all better still by better auditing dependencies.
I marked this as stale due to inactivity. → More info
It would sure be a much bigger change but if all builds are signed right away it seems possible to get rid of the ultimate
flag and just verify locally built derivations in the same way as remotely built ones.
Background
For the sake of building stuff faster, I often use remote builds in a bit of a nonstandard way, e.g.:
This allows building remotely without copying the whole dependency graph to my laptop. However:
⇒ my laptop will start building everything itself. I'd also prefer not to use the blanket
--no-require-sigs
option.Suggestion
If no
secret-key-files
are specified in the nix config, the option should default to/etc/nix/secret-key
, and this file should be generated automatically along with/etc/nix/public-key
if it doesn't exist, using the machine's hostname as a key name. This makes it easier to track where builds come from when usingnix copy
or remote builds, and allows usingnix copy
without--no-require-sigs
.This allows me:
--no-require-sigs