nix-super/scripts
Eelco Dolstra 0fdf4da0e9 Support cryptographically signed binary caches
NAR info files in binary caches can now have a cryptographic signature
that Nix will verify before using the corresponding NAR file.

To create a private/public key pair for signing and verifying a binary
cache, do:

  $ openssl genrsa -out ./cache-key.sec 2048
  $ openssl rsa -in ./cache-key.sec -pubout > ./cache-key.pub

You should also come up with a symbolic name for the key, such as
"cache.example.org-1".  This will be used by clients to look up the
public key.  (It's a good idea to number keys, in case you ever need
to revoke/replace one.)

To create a binary cache signed with the private key:

  $ nix-push --dest /path/to/binary-cache --key ./cache-key.sec --key-name cache.example.org-1

The public key (cache-key.pub) should be distributed to the clients.
They should have a nix.conf should contain something like:

  signed-binary-caches = *
  binary-cache-public-key-cache.example.org-1 = /path/to/cache-key.pub

If all works well, then if Nix fetches something from the signed
binary cache, you will see a message like:

  *** Downloading ‘http://cache.example.org/nar/7dppcj5sc1nda7l54rjc0g5l1hamj09j-subversion-1.7.11’ (signed by ‘cache.example.org-1’) to ‘/nix/store/7dppcj5sc1nda7l54rjc0g5l1hamj09j-subversion-1.7.11’...

On the other hand, if the signature is wrong, you get a message like

  NAR info file `http://cache.example.org/7dppcj5sc1nda7l54rjc0g5l1hamj09j.narinfo' has an invalid signature; ignoring

Signatures are implemented as a single line appended to the NAR info
file, which looks like this:

  Signature: 1;cache.example.org-1;HQ9Xzyanq9iV...muQ==

Thus the signature has 3 fields: a version (currently "1"), the ID of
key, and the base64-encoded signature of the SHA-256 hash of the
contents of the NAR info file up to but not including the Signature
line.

Issue #75.
2014-01-08 15:42:53 +01:00
..
build-remote.pl.in build-remote.pl: Don't use substituters on the remote 2013-09-18 14:04:03 +02:00
copy-from-other-stores.pl.in copy-from-other-stores.pl: Respect $NIX_BIN_DIR 2013-07-01 13:30:28 +02:00
copying-collector.pl * I said it couldn't be done. I was wrong. 2005-04-04 15:18:19 +00:00
download-from-binary-cache.pl.in Support cryptographically signed binary caches 2014-01-08 15:42:53 +01:00
download-using-manifests.pl.in Add support for uncompressed NARs in binary caches 2013-07-01 21:03:14 +02:00
find-runtime-roots.pl.in Revert "Scan /proc/<pid>/cmdline for GC roots" 2013-12-20 14:18:24 +01:00
install-nix-from-closure.sh Generate binary tarballs for installing Nix 2012-05-22 18:36:54 -04:00
Makefile.am Rename ‘nix-build --run-env’ to ‘nix-shell’ 2013-07-19 12:02:44 +02:00
nix-build.in Revert "nix-shell: Set $IN_NIX_SHELL before evaluation" 2014-01-06 17:38:04 +01:00
nix-channel.in Support xz compression of nixexprs.tar in channels 2012-12-05 11:02:44 +01:00
nix-collect-garbage.in When ‘--help’ is given, just run ‘man’ to show the manual page 2012-10-03 16:40:09 -04:00
nix-copy-closure.in nix-copy-closure: Show a proper error message if no host name is given 2013-05-03 11:12:11 +02:00
nix-generate-patches.in nix-generate-patches: Optionally write new patches to $NIX_ALL_PATCHES 2012-04-04 20:46:18 +00:00
nix-http-export.cgi.in Replace wrong (w.r.t. PATH) sed call with in-shell substitution 2009-02-19 20:46:45 +00:00
nix-install-package.in When ‘--help’ is given, just run ‘man’ to show the manual page 2012-10-03 16:40:09 -04:00
nix-prefetch-url.in nix-prefetch-url: Improve option handling 2012-10-23 18:04:11 +02:00
nix-profile.sh.in Use a shorter Nixpkgs channel URL 2012-11-09 13:33:35 +01:00
nix-pull.in When ‘--help’ is given, just run ‘man’ to show the manual page 2012-10-03 16:40:09 -04:00
nix-push.in Support cryptographically signed binary caches 2014-01-08 15:42:53 +01:00
nix-reduce-build.in * Set the executable bit on scripts. 2011-10-10 22:40:17 +00:00
remove-patches.pl * Remove the localPaths feature in manifests since it's no longer used 2011-04-06 09:16:22 +00:00
show-duplication.pl * `show-duplication.pl', a small utility that shows the amount of 2006-09-19 13:53:35 +00:00