From c089738bdcff78a3bf75911665301f7a93a73ba9 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 2 Jun 2010 21:10:48 +0000 Subject: [PATCH] * Use the `shadow' package instead of `pwdutils', `pam_login' and `su'. * The `usermod' from `shadow' allows setting a supplementary group equal to the user's primary group, so the special hack for the `nixbld' group is no longer needed. * Removed /etc/default/passwd since it's not used by the new passwd. The hash is configured in pam_unix. * Move some values for `security.setuidPrograms' and `security.pam.services' to the appropriate modules. svn path=/nixos/trunk/; revision=22107 --- modules/config/system-path.nix | 2 - modules/config/users-groups.nix | 25 ++---- modules/programs/pwdutils/login.defs | 8 +- modules/programs/pwdutils/passwd.conf | 15 ---- modules/programs/pwdutils/pwdutils.nix | 82 ++++++++++++------- modules/security/pam.nix | 13 --- modules/security/setuid-wrappers.nix | 4 +- modules/services/misc/nix-daemon.nix | 4 +- modules/services/ttys/mingetty.nix | 2 +- .../system/activation/activation-script.nix | 2 +- modules/system/upstart-events/shutdown.nix | 2 +- modules/tasks/network-interfaces.nix | 2 + 12 files changed, 71 insertions(+), 90 deletions(-) delete mode 100644 modules/programs/pwdutils/passwd.conf diff --git a/modules/config/system-path.nix b/modules/config/system-path.nix index 4a22aabc946..d9074732418 100644 --- a/modules/config/system-path.nix +++ b/modules/config/system-path.nix @@ -44,12 +44,10 @@ let pkgs.pciutils pkgs.perl pkgs.procps - pkgs.pwdutils pkgs.reiserfsprogs pkgs.rsync pkgs.seccure pkgs.strace - pkgs.su pkgs.sysklogd pkgs.sysvtools pkgs.time diff --git a/modules/config/users-groups.nix b/modules/config/users-groups.nix index cb84117090b..6beb7b311aa 100644 --- a/modules/config/users-groups.nix +++ b/modules/config/users-groups.nix @@ -173,16 +173,16 @@ in if ! curEnt=$(getent passwd "$name"); then useradd --system \ - "$name" \ --comment "$description" \ ''${uid:+--uid $uid} \ --gid "$group" \ --groups "$extraGroups" \ --home "$home" \ --shell "$shell" \ - ''${createHome:+--create-home} + ''${createHome:+--create-home} \ + "$name" if test "''${password:0:1}" = 'X'; then - echo "''${password:1}" | ${pkgs.pwdutils}/bin/passwd --stdin "$name" + echo "''${password:1}" | ${pkgs.shadow}/bin/passwd --stdin "$name" fi else #echo "updating user $name..." @@ -196,22 +196,13 @@ in # unnecessary warnings about logged in users. if test "$prevHome" = "$home"; then unset home; fi usermod \ - "$name" \ --comment "$description" \ ''${uid:+--uid $uid} \ --gid "$group" \ --groups "$extraGroups" \ ''${home:+--home "$home"} \ - --shell "$shell" - fi - - if test "$group" = nixbld; then - # As a special hack, add users that have nixbld as the - # primary group to the /etc/group entry for the nixbld - # group. `nix-store' currently expects this in order - # to get the UIDs of all the build users by doing a - # getprnam("nixbld") call. - groupmod "$group" -A "$name" + --shell "$shell" \ + "$name" fi done @@ -227,14 +218,14 @@ in if ! curEnt=$(getent group "$name"); then groupadd --system \ - "$name" \ - ''${gid:+--gid $gid} + ''${gid:+--gid $gid} \ + "$name" else #echo "updating group $name..." oldIFS="$IFS"; IFS=:; set -- $curEnt; IFS="$oldIFS" prevGid=$3 if test -n "$gid" -a "$prevGid" != "$gid"; then - groupmod "$name" --gid $gid + groupmod --gid $gid "$name" fi fi done <>>" echo "" - ${pkgs.pam_login}/bin/login root + ${pkgs.shadow}/bin/login root initctl emit -n startup exit 0 fi diff --git a/modules/tasks/network-interfaces.nix b/modules/tasks/network-interfaces.nix index 836950f42a6..46d608dbb9b 100644 --- a/modules/tasks/network-interfaces.nix +++ b/modules/tasks/network-interfaces.nix @@ -142,6 +142,8 @@ in pkgs.wirelesstools pkgs.rfkill ]; + + security.setuidPrograms = [ "ping" "ping6" ]; jobs.networkInterfaces = { name = "network-interfaces";