about summary refs log tree commit diff
path: root/configure.ac
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-08-20T14·49+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-08-20T14·49+0000
commit2d35116c13e0c11210cb712f9ce6e8a38058f350 (patch)
tree62c38ca3f7a11691c54a630a4a78f0ad8810a5ad /configure.ac
parent8f1dcdfc0ae05c403fe59b592093d3e61e87f1b0 (diff)
* Setuid support for sharing a Nix installation between multiple
  users.

  If the configure flag `--enable-setuid' is used, the Nix programs
  nix-env, nix-store, etc. are installed with the setuid bit turned on
  so that they are executed as the user and group specified by
  `--with-nix-user=USER' and `--with-nix-group=GROUP', respectively
  (with defaults `nix' and `nix').

  The setuid programs drop all special privileges if they are executed
  by a user who is not a member of the Nix group.

  The setuid feature is a quick hack to enable sharing of a Nix
  installation between users who trust each other.  It is not
  generally secure, since any user in the Nix group can modify (by
  building an appropriate derivation) any object in the store, and for
  instance inject trojans into binaries used by other users.

  The setuid programs are owned by root, not the Nix user.  This is
  because on Unix normal users cannot change the real uid, only the
  effective uid.  Many programs don't work properly when the real uid
  differs from the effective uid.  For instance, Perl will turn on
  taint mode.  However, the setuid programs drop all root privileges
  immediately, changing all uids and gids to the Nix user and group.


Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac22
1 files changed, 22 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 0d7045de18..5dab9847ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,6 +142,28 @@ AC_ARG_ENABLE(init-state, AC_HELP_STRING([--disable-init-state],
   init_state=$enableval, init_state=yes)
 AM_CONDITIONAL(INIT_STATE, test "$init_state" = "yes")
 
+
+AC_ARG_ENABLE(setuid, AC_HELP_STRING([--enable-setuid],
+  [install Nix setuid]),
+  setuid_hack=$enableval, setuid_hack=no)
+AM_CONDITIONAL(SETUID_HACK, test "$setuid_hack" = "yes")
+if test "$setuid_hack" = "yes"; then
+    AC_DEFINE(SETUID_HACK, 1, [whether to install Nix setuid])
+fi
+
+AC_ARG_WITH(nix-user, AC_HELP_STRING([--with-nix-user=USER],
+  [user for Nix setuid binaries]),
+  NIX_USER=$withval, NIX_USER=nix)
+AC_SUBST(NIX_USER)
+AC_DEFINE_UNQUOTED(NIX_USER, ["$NIX_USER"], [Nix user])
+                                                      
+AC_ARG_WITH(nix-group, AC_HELP_STRING([--with-nix-group=USER],
+  [group for Nix setuid binaries]),
+  NIX_GROUP=$withval, NIX_GROUP=nix)
+AC_SUBST(NIX_GROUP)
+AC_DEFINE_UNQUOTED(NIX_GROUP, ["$NIX_GROUP"], [Nix group])
+
+                                                                                                            
 AM_CONFIG_HEADER([config.h])
 AC_CONFIG_FILES([Makefile
    externals/Makefile