From mboxrd@z Thu Jan 1 00:00:00 1970 From: "pelzflorian (Florian Pelz)" Subject: bug#38438: Fcgiwrap service has no supplementary groups Date: Wed, 4 Dec 2019 12:32:39 +0100 Message-ID: <20191204113239.immmcpixu2achory@pelzflorian.localdomain> References: <20191130184924.io5qmo6ujyy2xeyy@pelzflorian.localdomain> <20191204102212.ldt6w4whzfz6ceq5@pelzflorian.localdomain> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="n7zqetbqpholimzw" Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:37924) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icSu4-0004Y6-Qi for bug-guix@gnu.org; Wed, 04 Dec 2019 06:33:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icSu1-0003LQ-5t for bug-guix@gnu.org; Wed, 04 Dec 2019 06:33:07 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:35531) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1icSty-0003Hh-Fx for bug-guix@gnu.org; Wed, 04 Dec 2019 06:33:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1icSty-0004dH-BZ for bug-guix@gnu.org; Wed, 04 Dec 2019 06:33:02 -0500 Sender: "Debbugs-submit" Resent-Message-ID: Content-Disposition: inline In-Reply-To: <20191204102212.ldt6w4whzfz6ceq5@pelzflorian.localdomain> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: 38438@debbugs.gnu.org --n7zqetbqpholimzw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Dec 04, 2019 at 11:22:13AM +0100, pelzflorian (Florian Pelz) wrote: > I had hoped the attached quick hack would fix my issue when testing The now attached patch works now (after doing `usermod -aG git fcgiwrap`, `herd stop fcgiwrap` and `herd start fcgiwrap`). Regards, Florian --n7zqetbqpholimzw Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="quick-hack-fixed.patch" Content-Transfer-Encoding: 8bit >From 901f3e0ff52e817344a839a5f7c55c96dd530704 Mon Sep 17 00:00:00 2001 From: Florian Pelz Date: Wed, 4 Dec 2019 09:33:08 +0100 Subject: [PATCH] gnu: shepherd: Patch Shepherd to set supplementary groups to those of #:user. Fixes . * gnu/packages/patches/shepherd-set-supplementary-groups.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/admin.scm (shepherd): Use it. --- gnu/local.mk | 1 + gnu/packages/admin.scm | 4 +- .../shepherd-set-supplementary-groups.patch | 41 +++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/shepherd-set-supplementary-groups.patch diff --git a/gnu/local.mk b/gnu/local.mk index 9ddd1349da..b807e3879c 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1348,6 +1348,7 @@ dist_patch_DATA = \ %D%/packages/patches/seahorse-gkr-use-0-on-empty-flags.patch \ %D%/packages/patches/seq24-rename-mutex.patch \ %D%/packages/patches/sharutils-CVE-2018-1000097.patch \ + %D%/packages/patches/shepherd-set-supplementary-groups.patch \ %D%/packages/patches/shishi-fix-libgcrypt-detection.patch \ %D%/packages/patches/slim-session.patch \ %D%/packages/patches/slim-config.patch \ diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm index 6e5648d159..3f94b45623 100644 --- a/gnu/packages/admin.scm +++ b/gnu/packages/admin.scm @@ -201,7 +201,9 @@ and provides a \"top-like\" mode (monitoring).") version ".tar.gz")) (sha256 (base32 - "1xn6mb5bh8bpfgdrh09ja31jk0ln7bmxbbf0vjcqxkkixs2wl6sk")))) + "1xn6mb5bh8bpfgdrh09ja31jk0ln7bmxbbf0vjcqxkkixs2wl6sk")) + (patches + (search-patches "shepherd-set-supplementary-groups.patch")))) (build-system gnu-build-system) (arguments '(#:configure-flags '("--localstatedir=/var"))) diff --git a/gnu/packages/patches/shepherd-set-supplementary-groups.patch b/gnu/packages/patches/shepherd-set-supplementary-groups.patch new file mode 100644 index 0000000000..f72f7329f6 --- /dev/null +++ b/gnu/packages/patches/shepherd-set-supplementary-groups.patch @@ -0,0 +1,41 @@ +diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm +index bd7e379..74fed23 100644 +--- a/modules/shepherd/service.scm ++++ b/modules/shepherd/service.scm +@@ -758,6 +758,28 @@ daemon writing FILE is running in a separate PID namespace." + (try-again) + (apply throw args))))))) + ++(define (supplementary-gids user) ++ "Return a vector with the gid for each supplementary group USER belongs to. ++USER is the user name as a string." ++ ;; TODO: To find them, we loop through the group database, but maybe using ++ ;; glibc’s getgrouplist would be better. But it is not exported from Guile ++ ;; and it seems it is not part of POSIX (?). ++ (list->vector ++ (delete-duplicates ++ (dynamic-wind ++ (lambda () (setgrent)) ++ (lambda () ++ (let loop ((supgids '())) ++ (let ((group (getgrent))) ++ (define (user-among-group? group) ++ (member user (group:mem group))) ++ (match group ++ (#f supgids) ++ ((? user-among-group?) ++ (loop (cons (group:gid group) supgids))) ++ (else (loop supgids)))))) ++ (lambda () (endgrent)))))) ++ + (define* (exec-command command + #:key + (user #f) +@@ -826,6 +848,7 @@ false." + (when user + (catch #t + (lambda () ++ (setgroups (supplementary-gids user)) + (setuid (passwd:uid (getpw user)))) + (lambda (key . args) + (format (current-error-port) -- 2.24.0 --n7zqetbqpholimzw--