GNU bug report logs - #67867
[PATCH shepherd] service: fix ownership+permissions on Unix sockets

Previous Next

Package: guix-patches;

Reported by: Ulrich Baum <ulrich.baum <at> ubaum.de>

Date: Sun, 17 Dec 2023 15:53:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 67867 in the body.
You can then email your comments to 67867 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#67867; Package guix-patches. (Sun, 17 Dec 2023 15:53:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ulrich Baum <ulrich.baum <at> ubaum.de>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 17 Dec 2023 15:53:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ulrich Baum <ulrich.baum <at> ubaum.de>
To: "guix-patches <at> gnu.org" <guix-patches <at> gnu.org>
Subject: [PATCH shepherd] service: fix ownership+permissions on Unix sockets
Date: Sun, 17 Dec 2023 14:38:12 +0100 (CET)
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




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Tue, 19 Dec 2023 22:40:02 GMT) Full text and rfc822 format available.

Notification sent to Ulrich Baum <ulrich.baum <at> ubaum.de>:
bug acknowledged by developer. (Tue, 19 Dec 2023 22:40:02 GMT) Full text and rfc822 format available.

Message #10 received at 67867-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Ulrich Baum <ulrich.baum <at> ubaum.de>
Cc: 67867-done <at> debbugs.gnu.org
Subject: Re: bug#67867: [PATCH shepherd] service: fix ownership+permissions
 on Unix sockets
Date: Tue, 19 Dec 2023 23:38:57 +0100
Hi Ulrich,

Ulrich Baum <ulrich.baum <at> 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’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 17 Jan 2024 12:24:14 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 210 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.