From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id KH+pBENBGmd6MQAA62LTzQ:P1 (envelope-from ) for ; Thu, 24 Oct 2024 12:44:51 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id KH+pBENBGmd6MQAA62LTzQ (envelope-from ) for ; Thu, 24 Oct 2024 14:44:51 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=OAGmKFKb; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=L82DNEgh; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1729773891; a=rsa-sha256; cv=none; b=VvqkcUqhoxWvajfV8VW4X2S2vtA6xovsB4T/xxVDI2jyFjgh2J7/jDR6344y/HEod9nYPi IgWnrvqpERkVoKES79rTfr3odlrfPd16sFiUE+qBEbGaAmMMtv/8VZlVXsDsS4iFsjxziW lFuPJKsLs9xQc2KGR6jwQey5SlmQGJQYbFfa7GNhf7p4tR+cWb167rD5SzkYNECMWoix/R /ImhG/jguF5vDHhdcCx3ZremCWddqBlxyBdsqzNMR+IL4auRtHkC9g58sf8lEzIWMlHMu1 1krVXBsbWkjvcYkz0ORF6enTS6bUJqNvM2+nv9Nyd1IK4skTWb58a2RZlGdprQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=OAGmKFKb; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=L82DNEgh; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1729773891; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=TcNQgYI3zxD8DCGUxJhiRD6gmdCihjcRUl0b2X4z1bs=; b=GLADN8h/0Zu05II9c9BI77XlCyeMIgKZqSnuj16YsBUSN8kvA9Htqtr9k/3m4kuRJ6pDg1 l/5P4INoaBuPwZSdUSkhoSMa0llBIidiarJczMLfNGbdl6gJamN0tYnaY8yQ3teWz2dP8K 0iZ56RyiMAACwXEGJLpD+DU/ord80nIvF32OUtT0Qd3+NuLWOvcOFv4fzadMrgCCn/6l2W cw14OIaXrT7pQ9ViDR81f59VOQ9Y1C7g8cvUHkj7KTlE7OeAeeQlYSJUzd0FBVbvocvaz0 KefKDd30o07f1B5dfr1WnASMSnwzqv86nzc9Cuf/G99zacMVseiSZAVsl8MNSg== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 84B907F6BF for ; Thu, 24 Oct 2024 14:44:50 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3xCb-000346-3J; Thu, 24 Oct 2024 08:44:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3xCZ-00033g-Jk for guix-patches@gnu.org; Thu, 24 Oct 2024 08:44:31 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t3xCZ-0001QV-Ar for guix-patches@gnu.org; Thu, 24 Oct 2024 08:44:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=TcNQgYI3zxD8DCGUxJhiRD6gmdCihjcRUl0b2X4z1bs=; b=OAGmKFKbKKmLkoxcqlSOYPhe4Uy4vnG9nBHXTmqEORirweUF0VtXa8jLdfFOfJ//XQ15alL6cgSRcv8GPwDgcjhDS3l/13B+BlCikDq5YbEKCbUVb1lXHX+AniKIc/gs0z3gbJ6JAaIe23RAPv55rlajDyG4hPst3TAscUP/OutheWKIrr6Q/tRwbxLXq5N26s9FXkaxprmBSGLwbL4UyqiRQCSEgFqaWs+tEgAaWd5LJ7WtFjcChefcbz9k7i8X2kIswBClGduZtRP701Fdur+4kRaeA+fXktNUxq8FwZxv6n8rPDKLg/PuzMfMXtouKJdnXMZCDxwnZrI1ovZ3xw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t3xD3-0001LP-SB for guix-patches@gnu.org; Thu, 24 Oct 2024 08:45:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73925] [PATCH] add access control to daemon socket in shepherd service Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 24 Oct 2024 12:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73925 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Reepca Russelstein Cc: 73925@debbugs.gnu.org Received: via spool by 73925-submit@debbugs.gnu.org id=B73925.17297738715099 (code B ref 73925); Thu, 24 Oct 2024 12:45:01 +0000 Received: (at 73925) by debbugs.gnu.org; 24 Oct 2024 12:44:31 +0000 Received: from localhost ([127.0.0.1]:33999 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t3xCY-0001KB-Nd for submit@debbugs.gnu.org; Thu, 24 Oct 2024 08:44:31 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46056) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t3xCW-0001Jy-0R for 73925@debbugs.gnu.org; Thu, 24 Oct 2024 08:44:29 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3xBv-0001O1-A8; Thu, 24 Oct 2024 08:43:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=TcNQgYI3zxD8DCGUxJhiRD6gmdCihjcRUl0b2X4z1bs=; b=L82DNEghV8g4J6UxrUu6 jLYkr9OP9RnDVgvy/aKppDq31HtIbgNjzAll5RbDZCF7GOKv4atVMWs7NafDU+/NIUsl0Q5WUsO7E QtevpjGyqApjWkbhVUCu225j0lzUFd/OtO0msmVUn0l3E2QF/h6TZwohT7jFKylJj6O9gWuwBIUww z5qL9S6h7w4sWMWrVW3z25/T7utSefOXn8ApK5+qoPfuaIi0aQlD9N9IAujOpzOaHHzOYgkYBufpo cmLtAnH//JhaQmUAKCzWMIVwANI60ZDMIHP9gK67jdjmtiSBEFscayc2fNbxNMA49GrMFj9zuJ+bK zpG2nG6wsAUtLA==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: <87a5eyjqr0.fsf@russelstein.xyz> (Reepca Russelstein's message of "Sun, 20 Oct 2024 18:31:31 -0500") References: <87a5eyjqr0.fsf@russelstein.xyz> Date: Thu, 24 Oct 2024 14:43:48 +0200 Message-ID: <871q05658b.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -3.72 X-Spam-Score: -3.72 X-Migadu-Queue-Id: 84B907F6BF X-Migadu-Scanner: mx10.migadu.com X-TUID: ot+/exb4AxWs Hi, Reepca Russelstein skribis: > From b5163889efb544cfe83cd2bcb3ebd3a957c95a18 Mon Sep 17 00:00:00 2001 > Message-ID: > From: Reepca Russelstein > Date: Sat, 19 Oct 2024 22:43:27 -0500 > Subject: [PATCH] services: guix-configuration: add access control to daem= on > socket. > > * gnu/services/base.scm > (guix-configuration-socket-directory-{perms,group,user}): new fields. > (guix-shepherd-service): use them. > * doc/guix.texi: document them. > > Change-Id: Ic228377b25a83692b0c637dafbd03c4609e332fc That=E2=80=99s a welcome addition. > +@item @code{socket-directory-perms} (default: @code{#o755}) s/perms/permissions/ > +Permissions to set for the directory @file{/var/guix/daemon-socket}. > +This, together with @code{socket-directory-group} and > +@code{socket-directory-user}, determines who can connect to the guix > +daemon via its unix socket. TCP socket operation is unaffected by > +these. s/guix daemon/build daemon/ and s/unix/Unix/ > +@item @code{socket-directory-group} (default: @code{#f}) > +Group to set for the directory @file{/var/guix/daemon-socket}, or > +@code{#f} to keep its group as root. > + > +@item @code{socket-directory-user} (default: @code{#f}) > +User to set for the directory @file{/var/guix/daemon-socket}, or > +@code{#f} to keep its user as root. Maybe group them together: @item @code{socket-directory-user} (default: @code{#f}) @itemx @code{socket-directory-group} (default: @code{#f}) User and group owning the @file{/var/guix/daemon-socket} directory. =E2=80=A6 > - (guix build-group build-accounts authorize-key? authorized-keys > - use-substitutes? substitute-urls max-silent-time timeout > - log-compression discover? extra-options log-file > - http-proxy tmpdir chroot-directories environment) > + (guix build-group build-accounts authorize-key? authoriz= ed-keys Please avoid reindenting. > + ;; Ensure that a fresh directory is used, in case the = old > + ;; one was more permissive and processes have a file > + ;; descriptor referencing it hanging around, ready to = use > + ;; with openat. > + (false-if-exception > + (delete-file-recursively "/var/guix/daemon-socket")) > + (let ((perms #$(logand socket-directory-perms > + (lognot #o022)))) > + (mkdir "/var/guix/daemon-socket" perms) > + ;; Override umask > + (chmod "/var/guix/daemon-socket" perms)) Speaking of =E2=80=98openat=E2=80=99, maybe use =E2=80=98mkdir-p/perms=E2= =80=99 instead of doing it in two steps? Apart from that it LGTM. Could you send an updated patch? Thanks, Ludo=E2=80=99.