unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Julien Lepiller <julien@lepiller.eu>
To: 45937@debbugs.gnu.org
Subject: [bug#45937] [PATCH] gnu: php-fpm: Ensure no duplicate group.
Date: Sun, 17 Jan 2021 17:00:00 +0100	[thread overview]
Message-ID: <20210117170000.718e6062@tachikoma.lepiller.eu> (raw)

[-- Attachment #1: Type: text/plain, Size: 532 bytes --]

Hi Guix!

When updating my system, I noticed there was a duplicate php-fpm group.
The reason is that by default, the group is php-fpm, and the accounts
list contains php-fpm and the configured group. I'm not sure why, but
the hardcoded php-fpm group seems to be used by the user as a
supplementary group.

This patch only adds the php-fpm group when the configured group is not
already php-fpm. If you think it'd be better, we could also simply
remove the hard-coded php-fpm group and the supplementary group from
the php-fpm user.

[-- Attachment #2: 0001-gnu-php-fpm-Ensure-no-duplicate-group.patch --]
[-- Type: text/x-patch, Size: 1744 bytes --]

From d50e84c66d9cc9fa027035b9265e80ecab22aa00 Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Sat, 16 Jan 2021 20:42:32 +0100
Subject: [PATCH] gnu: php-fpm: Ensure no duplicate group.

* gnu/services/web.scm (php-fpm-accounts): Ensure `php-fpm` group is not
duplicated.
---
 gnu/services/web.scm | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index 855f4e649b..f8dc621614 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -922,19 +922,20 @@ of index files."
 (define php-fpm-accounts
   (match-lambda
     (($ <php-fpm-configuration> php socket user group socket-user socket-group _ _ _ _ _ _)
-     (list
-      (user-group (name "php-fpm") (system? #t))
-      (user-group
-       (name group)
-       (system? #t))
-      (user-account
-       (name user)
-       (group group)
-       (supplementary-groups '("php-fpm"))
-       (system? #t)
-       (comment "php-fpm daemon user")
-       (home-directory "/var/empty")
-       (shell (file-append shadow "/sbin/nologin")))))))
+     `(,@(if (equal? group "php-fpm")
+             '()
+             (list (user-group (name "php-fpm") (system? #t))))
+       ,(user-group
+         (name group)
+         (system? #t))
+       ,(user-account
+        (name user)
+        (group group)
+        (supplementary-groups '("php-fpm"))
+        (system? #t)
+        (comment "php-fpm daemon user")
+        (home-directory "/var/empty")
+        (shell (file-append shadow "/sbin/nologin")))))))
 
 (define (default-php-fpm-config socket user group socket-user socket-group
           pid-file log-file pm display-errors timezone workers-log-file)
-- 
2.30.0


             reply	other threads:[~2021-01-17 16:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-17 16:00 Julien Lepiller [this message]
2021-01-17 19:45 ` bug#45937: [PATCH] gnu: php-fpm: Ensure no duplicate group Leo Prikler

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=20210117170000.718e6062@tachikoma.lepiller.eu \
    --to=julien@lepiller.eu \
    --cc=45937@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).