unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 73810@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#73810] [PATCH] services: cuirass: Run ‘remote-worker’ under its own user/group.
Date: Mon, 14 Oct 2024 23:16:02 +0200	[thread overview]
Message-ID: <a02b40f13871e74f55794105fe704e0fbf241cc6.1728940495.git.ludo@gnu.org> (raw)

The ‘--user’ option was added to ‘cuirass remote-worker’ in Cuirass
commit 3a6abc17f904f38098d3ab08e9d82de2e821d348 (Nov. 2023).

* gnu/services/cuirass.scm (%cuirass-remote-worker-accounts): New
variable.
(cuirass-remote-worker-shepherd-service): Pass ‘--user’.
(cuirass-remote-worker-service-type): Add ACCOUNT-SERVICE-TYPE
extension.

Change-Id: I075ea02b6972adcad0a75e330073e85c4dacbbc5
---
 gnu/services/cuirass.scm | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Hello!

This is fixing longstanding flakiness...

Ludo'.

diff --git a/gnu/services/cuirass.scm b/gnu/services/cuirass.scm
index f68b4dc5a2..187766bc99 100644
--- a/gnu/services/cuirass.scm
+++ b/gnu/services/cuirass.scm
@@ -384,6 +384,19 @@ (define-record-type* <cuirass-remote-worker-configuration>
   (private-key      cuirass-remote-worker-configuration-private-key ;string
                     (default #f)))
 
+(define %cuirass-remote-worker-accounts
+  ;; User account and group for the 'cuirass remote-worker' process.
+  (list (user-group
+         (name "cuirass-worker")
+         (system? #t))
+        (user-account
+         (name "cuirass-worker")
+         (group name)
+         (system? #t)
+         (comment "Cuirass worker privilege separation user")
+         (home-directory "/var/empty")
+         (shell (file-append shadow "/sbin/nologin")))))
+
 (define (cuirass-remote-worker-shepherd-service config)
   "Return a <shepherd-service> for the Cuirass remote worker service with
 CONFIG."
@@ -397,6 +410,7 @@ (define (cuirass-remote-worker-shepherd-service config)
            (start #~(make-forkexec-constructor
                      (list (string-append #$cuirass "/bin/cuirass")
                            "remote-worker"
+                           "--user=cuirass-worker" ;drop privileges early on
                            (string-append "--workers="
                                           #$(number->string workers))
                            #$@(if server
@@ -444,6 +458,8 @@ (define cuirass-remote-worker-service-type
    (extensions
     (list (service-extension shepherd-root-service-type
                              cuirass-remote-worker-shepherd-service)
+          (service-extension account-service-type
+                             (const %cuirass-remote-worker-accounts))
           (service-extension rottlog-service-type
                              cuirass-remote-worker-log-rotations)))
    (description

base-commit: 6757bfdfc0b22a1e23a3d33566155550182244fc
-- 
2.46.0





                 reply	other threads:[~2024-10-14 21:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a02b40f13871e74f55794105fe704e0fbf241cc6.1728940495.git.ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=73810@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).