[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#61462] [PATCH 05/10] system: Add (gnu system privilege).
From: |
Tobias Geerinckx-Rice |
Subject: |
[bug#61462] [PATCH 05/10] system: Add (gnu system privilege). |
Date: |
Sun, 5 Feb 2023 01:00:14 +0100 |
* gnu/system/privilege.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
---
gnu/local.mk | 1 +
gnu/system/privilege.scm | 58 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+)
create mode 100644 gnu/system/privilege.scm
diff --git a/gnu/local.mk b/gnu/local.mk
index cdb99813d0..acf74cd9ae 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -723,6 +723,7 @@ GNU_SYSTEM_MODULES = \
%D%/system/mapped-devices.scm \
%D%/system/nss.scm \
%D%/system/pam.scm \
+ %D%/system/privilege.scm \
%D%/system/setuid.scm \
%D%/system/shadow.scm \
%D%/system/uuid.scm \
diff --git a/gnu/system/privilege.scm b/gnu/system/privilege.scm
new file mode 100644
index 0000000000..d89d5d5d1c
--- /dev/null
+++ b/gnu/system/privilege.scm
@@ -0,0 +1,58 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2022 Tobias Geerinckx-Rice <me@tobias.gr>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu system privilege)
+ #:use-module (guix records)
+ #:export (privileged-program
+ privileged-program?
+ privileged-program-program
+ privileged-program-setuid?
+ privileged-program-setgid?
+ privileged-program-user
+ privileged-program-group
+ privileged-program-capabilities))
+
+;;; Commentary:
+;;;
+;;; Data structures representing privileged programs: binaries with additional
+;;; permissions such as setuid/setgid, or POSIX capabilities. This is meant to
+;;; be used both on the host side and at run time--e.g., in activation
snippets.
+;;;
+;;; Code:
+
+(define-record-type* <privileged-program>
+ privileged-program make-privileged-program
+ privileged-program?
+ ;; File name of the program to assign elevated privileges.
+ (program privileged-program-program) ;file-like
+ ;; Whether to set the setuid (‘set user ID’) bit.
+ (setuid? privileged-program-setuid? ;boolean
+ (default #f))
+ ;; Whether to set the setgid (‘set group ID’) bit.
+ (setgid? privileged-program-setgid? ;boolean
+ (default #f))
+ ;; The user name or ID this should be set to (defaults to root's).
+ (user privileged-program-user ;integer or string
+ (default 0))
+ ;; The group name or ID we want to set this to (defaults to root's).
+ (group privileged-program-group ;integer or string
+ (default 0))
+ ;; POSIX capabilities in cap_from_text(3) form (defaults to #f: none).
+ (capabilities privileged-program-capabilities ;string or #f
+ (default #f)))
--
2.39.1
- [bug#61462] Add support for file capabilities(7), Tobias Geerinckx-Rice, 2023/02/12
- [bug#61462] [PATCH 01/10] system: Disallow file-like setuid-programs., Tobias Geerinckx-Rice, 2023/02/12
- [bug#61462] [PATCH 02/10] services: setuid-program: Populate /run/privileged/bin., Tobias Geerinckx-Rice, 2023/02/12
- [bug#61462] [PATCH 04/10] gnu: Replace (almost) all uses of /run/setuid-programs., Tobias Geerinckx-Rice, 2023/02/12
- [bug#61462] [PATCH 06/10] system: (gnu system setuid) wraps (gnu system privilege)., Tobias Geerinckx-Rice, 2023/02/12
- [bug#61462] [PATCH 03/10] system: Use /run/privileged/bin in search paths., Tobias Geerinckx-Rice, 2023/02/12
- [bug#61462] [PATCH 09/10] system: Use privileged-program-service-type by default., Tobias Geerinckx-Rice, 2023/02/12
- [bug#61462] [PATCH 08/10] services: Rename setuid-program-service-type., Tobias Geerinckx-Rice, 2023/02/12
- [bug#61462] [PATCH 07/10] build: Rename activate-setuid-programs., Tobias Geerinckx-Rice, 2023/02/12
- [bug#61462] [PATCH 05/10] system: Add (gnu system privilege).,
Tobias Geerinckx-Rice <=
- [bug#61462] [PATCH 10/10] system: Add privileged-programs to <operating-system>., Tobias Geerinckx-Rice, 2023/02/12
- [bug#61462] Add support for file capabilities(7), Tobias Geerinckx-Rice, 2023/02/12