unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#67867] [PATCH shepherd] service: fix ownership+permissions on Unix sockets
@ 2023-12-17 13:38 Ulrich Baum
  2023-12-19 22:38 ` bug#67867: " Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Ulrich Baum @ 2023-12-17 13:38 UTC (permalink / raw)
  To: 67867

Previously, ownership and permissions of AF_UNIX sockets created by
make-inetd-constructor and make-systemd-constructor were not set,
leaving the socket with root:root and 755 permissions.

modules/shepherd/service.scm (endpoint->listening-socket): fix chown and
chmod calls
---
 modules/shepherd/service.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 41c6248..f22aaaf 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -1867,8 +1867,8 @@ retrying to bind it in one second.")
        (listen sock backlog)

        (when (= AF_UNIX (sockaddr:fam address))
-         (chown sock owner group)
-         (chmod sock #o666))
+         (chown (sockaddr:path address) owner group)
+         (chmod (sockaddr:path address) #o666))

        sock))))

--
2.43.0




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

* bug#67867: [PATCH shepherd] service: fix ownership+permissions on Unix sockets
  2023-12-17 13:38 [bug#67867] [PATCH shepherd] service: fix ownership+permissions on Unix sockets Ulrich Baum
@ 2023-12-19 22:38 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2023-12-19 22:38 UTC (permalink / raw)
  To: Ulrich Baum; +Cc: 67867-done

Hi Ulrich,

Ulrich Baum <ulrich.baum@ubaum.de> skribis:

> Previously, ownership and permissions of AF_UNIX sockets created by
> make-inetd-constructor and make-systemd-constructor were not set,
> leaving the socket with root:root and 755 permissions.
>
> modules/shepherd/service.scm (endpoint->listening-socket): fix chown and
> chmod calls

[...]

>         (when (= AF_UNIX (sockaddr:fam address))
> -         (chown sock owner group)
> -         (chmod sock #o666))
> +         (chown (sockaddr:path address) owner group)
> +         (chmod (sockaddr:path address) #o666))

Good catch!  I was surprised that fchown(2) and fchmod(2) silently did
nothing, but that’s how it is.

Pushed together with a test, which allowed me to find a related bug
(more serious, because it’s about permissions on the socket’s
directory):

  9dfeb4e support: ‘mkdir-p’ sets permissions when directory already exists.
  f5b7411 service: Really set ownership and permissions on Unix sockets.

(BTW, I have just renamed ‘master’ to ‘main’, but ‘master’ hasn’t been
deleted yet from the server; make sure to pick ‘main’ and adjust your
Git config.)

Thanks,
Ludo’.




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

end of thread, other threads:[~2023-12-19 22:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-17 13:38 [bug#67867] [PATCH shepherd] service: fix ownership+permissions on Unix sockets Ulrich Baum
2023-12-19 22:38 ` bug#67867: " Ludovic Courtès

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