diff options
| author | Christopher Lemmer Webber <cwebber@dustycloud.org> | 2021-07-29 13:09:48 -0400 |
|---|---|---|
| committer | Christopher Lemmer Webber <cwebber@dustycloud.org> | 2021-07-29 13:09:48 -0400 |
| commit | 45235e67e4aeac96ad8d60265bef054990aeb425 (patch) | |
| tree | eb542dc2b5b4e3003176e7c911b0105ca43baf30 | |
| parent | a85ec0bf69df9ec3333a214feff54d4e58b15bec (diff) | |
system: Add (gnu system setuid).
I flubbed and somehow when including the patch series, this got dropped.
Oops... should fix things again.
* gnu/system/setuid.scm: New file.
| -rw-r--r-- | gnu/system/setuid.scm | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/gnu/system/setuid.scm b/gnu/system/setuid.scm new file mode 100644 index 00000000000..83111d932c7 --- /dev/null +++ b/gnu/system/setuid.scm | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | ||
| 2 | ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re> | ||
| 3 | ;;; | ||
| 4 | ;;; This file is part of GNU Guix. | ||
| 5 | ;;; | ||
| 6 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | ||
| 7 | ;;; under the terms of the GNU General Public License as published by | ||
| 8 | ;;; the Free Software Foundation; either version 3 of the License, or (at | ||
| 9 | ;;; your option) any later version. | ||
| 10 | ;;; | ||
| 11 | ;;; GNU Guix is distributed in the hope that it will be useful, but | ||
| 12 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | ;;; GNU General Public License for more details. | ||
| 15 | ;;; | ||
| 16 | ;;; You should have received a copy of the GNU General Public License | ||
| 17 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | ||
| 18 | |||
| 19 | (define-module (gnu system setuid) | ||
| 20 | #:use-module (guix records) | ||
| 21 | #:export (setuid-program | ||
| 22 | setuid-program? | ||
| 23 | setuid-program-program | ||
| 24 | setuid-program-setuid? | ||
| 25 | setuid-program-setgid? | ||
| 26 | setuid-program-user | ||
| 27 | setuid-program-group | ||
| 28 | |||
| 29 | file-like->setuid-program)) | ||
| 30 | |||
| 31 | ;;; Commentary: | ||
| 32 | ;;; | ||
| 33 | ;;; Data structures representing setuid/setgid programs. This is meant to be | ||
| 34 | ;;; used both on the host side and at run time--e.g., in activation snippets. | ||
| 35 | ;;; | ||
| 36 | ;;; Code: | ||
| 37 | |||
| 38 | (define-record-type* <setuid-program> | ||
| 39 | setuid-program make-setuid-program | ||
| 40 | setuid-program? | ||
| 41 | ;; Path to program to link with setuid permissions | ||
| 42 | (program setuid-program-program) ;file-like | ||
| 43 | ;; Whether to set user setuid bit | ||
| 44 | (setuid? setuid-program-setuid? ;boolean | ||
| 45 | (default #t)) | ||
| 46 | ;; Whether to set group setgid bit | ||
| 47 | (setgid? setuid-program-setgid? ;boolean | ||
| 48 | (default #f)) | ||
| 49 | ;; The user this should be set to (defaults to root) | ||
| 50 | (user setuid-program-user ;integer or string | ||
| 51 | (default 0)) | ||
| 52 | ;; Group we want to set this to (defaults to root) | ||
| 53 | (group setuid-program-group ;integer or string | ||
| 54 | (default 0))) | ||
| 55 | |||
| 56 | (define (file-like->setuid-program program) | ||
| 57 | (setuid-program (program program))) | ||
