Nix Packages collection & NixOS
Go to file
Eelco Dolstra cba92bbdf1 * First step towards setuid/setgid support: a setuid/setgid wrapper
program.

  The Nix store cannot directly support setuid binaries for a number
  of reasons:

  - Builds are generally not performed as root (and they shouldn't
    be), so the builder cannot chown/chmod executables to the right
    setuid ownership.

  - Unpacking a NAR archive containing a setuid binary would only work
    when Nix is run as root.

  - Worst of all, setuid binaries don't fit in the purely functional
    model: if a security bug is discovered in a setuid binary, that
    binary should be removed from the system to prevent users from
    calling it.  But we cannot garbage collect it unless all
    references to it are gone, which might never happen.  Of course,
    we could just remove setuid permission, but that would also be
    impure.

  So the solution is to keep setuid-ness out of the Nix store.
  Rather, for programs that we want to execute as setuid, we generate
  wrapper programs (as root) that are setuid and do an execve() to
  call the real, non-setuid program in the Nix store.

  That's what setuid-wrapper does.  It determines its own name (e.g.,
  /var/setuid-wrappers/passwd), reads the name of the wrapped program
  from <self>.real (e.g., /var/setuid-wrappers/passwd.real, which
  might contain /nix/var/nix/profiles/system/bin/passwd), and executes
  it.  Thus, the non-setuid passwd in the Nix store would be executed
  with the effective user set to root.

  Setuid-wrapper also performs a few security checks to prevent it
  from reading a fake <self>.real file through hard-linking tricks.

svn path=/nixos/trunk/; revision=7157
2006-11-28 13:36:27 +00:00
boot * Refactoring. 2006-11-28 10:45:21 +00:00
configuration * Refactoring. 2006-11-28 10:45:21 +00:00
helpers * First step towards setuid/setgid support: a setuid/setgid wrapper 2006-11-28 13:36:27 +00:00
installer * Refactoring. 2006-11-28 10:45:21 +00:00
instances * Refactoring. 2006-11-28 10:45:21 +00:00
upstart-jobs * Moving stuff around. 2006-11-27 19:49:05 +00:00
README * Moving stuff around. 2006-11-27 19:49:05 +00:00
upgrade.sh * Moving stuff around. 2006-11-27 19:49:05 +00:00

To get a Stage 1 shell:

Add "debug1" to the kernel command line.


Switching to maintenance mode:

$ shutdown now

To get out of maintenance mode:

$ initctl emit startup 


Updating the current system configuration:

$ nix-env -p /nix/var/nix/profiles/system -f system-configuration.nix -i -A systemConfiguration
$ /nix/var/nix/profiles/system/bin/switch-to-configuration