From d6c9754c568588929c3350da8f7b17ae92d2b801 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sun, 29 May 2022 02:00:00 +0200 Subject: [PATCH] services: setuid-program: Populate /run/privileged/bin. Create /run/setuid-programs compatibility symlinks so that we can migrate all users (both package and human) piecemeal at our leisure. Apart from being symlinks, this should be a user-invisible change. * gnu/build/activation.scm (%privileged-program-directory): New variable. [activate-setuid-programs]: Put privileged copies in %PRIVILEGED-PROGRAM-DIRECTORY, with compatibility symlinks to each in %SETUID-DIRECTORY. * gnu/services.scm (setuid-program-service-type): Update docstring. * doc/guix.texi (Setuid Programs): Update @file{} name accordingly. --- doc/guix.texi | 2 +- gnu/build/activation.scm | 54 ++++++++++++++++++++++++++-------------- gnu/services.scm | 9 +++++-- 3 files changed, 44 insertions(+), 21 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 403e1924bd428b6ef864bd5b8772e2f50720b16f..03a8c13d0cf9d0a725096c878b1eaffbbcbc381e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -41732,7 +41732,7 @@ The list includes commands such as @command{passwd}, @command{ping}, @end defvar Under the hood, the actual setuid programs are created in the -@file{/run/setuid-programs} directory at system activation time. The +@file{/run/privileged/bin} directory at system activation time. The files in this directory refer to the ``real'' binaries, which are in the store. diff --git a/gnu/build/activation.scm b/gnu/build/activation.scm index d8c0cd22a3e4f58127a3cad6dfbb0d59639b850d..249b84c076bb3b68c1368299ac5c4fd109c4db82 100644 --- a/gnu/build/activation.scm +++ b/gnu/build/activation.scm @@ -8,6 +8,7 @@ ;;; Copyright © 2021 Maxime Devos ;;; Copyright © 2020 Christine Lemmer-Webber ;;; Copyright © 2021 Brice Waegeneire +;;; Copyright © 2022 Tobias Geerinckx-Rice ;;; Copyright © 2024 Nicolas Graves ;;; ;;; This file is part of GNU Guix. @@ -279,14 +280,29 @@ they already exist." string)) + (scandir directory + (lambda (file) + (not (member file '("." "..")))) + string)) - (scandir %setuid-directory - (lambda (file) - (not (member file '("." "..")))) - string. (format (current-error-port) "warning: failed to make ~s setuid/setgid: ~a~%" diff --git a/gnu/services.scm b/gnu/services.scm index 88593e80913c41c6f7be6f239fdf14a91286f76f..98355c20f5470d90dc7367681a3e65937ee5e957 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2021 raid5atemyhomework ;;; Copyright © 2020 Christine Lemmer-Webber ;;; Copyright © 2020, 2021 Brice Waegeneire +;;; Copyright © 2022 Tobias Geerinckx-Rice ;;; Copyright © 2023 Brian Cully ;;; Copyright © 2024 Nicolas Graves ;;; @@ -921,8 +922,12 @@ FILES must be a list of name/file-like object pairs." (extend (lambda (config extensions) (append config extensions))) (description - "Populate @file{/run/setuid-programs} with the specified -executables, making them setuid and/or setgid."))) + "Copy the specified executables to @file{/run/privileged/bin} +and apply special privileges like setuid and/or setgid. + +The deprecated @file{/run/setuid-programs} directory is also populated with +symbolic links to their @file{/run/privileged/bin} counterpart. It will be +removed in a future Guix release."))) (define (packages->profile-entry packages) "Return a system entry for the profile containing PACKAGES."