unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#45937] [PATCH] gnu: php-fpm: Ensure no duplicate group.
@ 2021-01-17 16:00 Julien Lepiller
  2021-01-17 19:45 ` bug#45937: " Leo Prikler
  0 siblings, 1 reply; 2+ messages in thread
From: Julien Lepiller @ 2021-01-17 16:00 UTC (permalink / raw)
  To: 45937

[-- 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#45937: [PATCH] gnu: php-fpm: Ensure no duplicate group.
  2021-01-17 16:00 [bug#45937] [PATCH] gnu: php-fpm: Ensure no duplicate group Julien Lepiller
@ 2021-01-17 19:45 ` Leo Prikler
  0 siblings, 0 replies; 2+ messages in thread
From: Leo Prikler @ 2021-01-17 19:45 UTC (permalink / raw)
  To: Julien Lepiller, 45937-done

Hi Julien,

I've pushed your patch with a small indentation fix.

Am Sonntag, den 17.01.2021, 17:00 +0100 schrieb Julien Lepiller:
> 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.
I'm not quite sure, but I think the use case here would be having a
www-admin group with full access to the entire directory structure and
some local users, who only have access to some directories as members
of the php-fpm group.  I might be wrong on that though, php-fpm users
please correct me if I am.

Regards,
Leo





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-17 19:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-17 16:00 [bug#45937] [PATCH] gnu: php-fpm: Ensure no duplicate group Julien Lepiller
2021-01-17 19:45 ` bug#45937: " Leo Prikler

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).