From patchwork Mon Aug 29 19:15:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arun Isaac X-Patchwork-Id: 42072 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1195C27BBEA; Mon, 29 Aug 2022 20:16:43 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id CA77C27BBE9 for ; Mon, 29 Aug 2022 20:16:42 +0100 (BST) Received: from localhost ([::1]:42218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSkFW-0008Ok-0M for patchwork@mira.cbaines.net; Mon, 29 Aug 2022 15:16:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSkEt-0008Nm-Dc for guix-patches@gnu.org; Mon, 29 Aug 2022 15:16:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44106) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oSkEt-0005Vv-5U for guix-patches@gnu.org; Mon, 29 Aug 2022 15:16:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oSkEs-0003Z4-Vx for guix-patches@gnu.org; Mon, 29 Aug 2022 15:16:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57363] [PATCH v2] shepherd: Set #o640 permissions for log file of service in container. Resent-From: Arun Isaac Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 29 Aug 2022 19:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57363 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxime Devos , Arun Isaac , 57363@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 57363-submit@debbugs.gnu.org id=B57363.166180055313662 (code B ref 57363); Mon, 29 Aug 2022 19:16:02 +0000 Received: (at 57363) by debbugs.gnu.org; 29 Aug 2022 19:15:53 +0000 Received: from localhost ([127.0.0.1]:33854 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oSkEj-0003YI-4A for submit@debbugs.gnu.org; Mon, 29 Aug 2022 15:15:53 -0400 Received: from mugam.systemreboot.net ([139.59.75.54]:52128) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oSkEh-0003YA-Ca for 57363@debbugs.gnu.org; Mon, 29 Aug 2022 15:15:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=systemreboot.net; s=default; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=NMchVp3FuILhXSH+U690nax7QLXfkbdRw955bDNSnYU=; b=HBO0jbs6ElSP1oonZkKbI6HyAA YNXbPHgWxpmhs5pCdOnEcp9o/LSQnX7YeggzP1VWzpEJwHqxjXQPCTpkxDDhkj5JVPPPeNOp8E3ff 8fV/P8+UCqjIiHm8ks1yC4oy+85roGXDoFt9R8UqazuQhgMy+YYyNBiD3ysTst+Mpy8ktxDk4xxMr Fs4uR24+IyezRCjfjEvZnK9lyUYytm8OG+2i7gtWj0cdqdRrLCzIz0aV//OSkhMm4FRXF6lD4l7Jc +kG1vhf8eYIzWtszIHLK/vKJBMVMo4gjTDqCMgunZYrpOqCrTPCH53kR4O92+ggeqSD8TWATcrjkl JOhl9bfg==; Received: from [192.168.2.1] (port=2844 helo=localhost.localdomain) by systemreboot.net with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1oSkEf-0005HF-0l; Tue, 30 Aug 2022 00:45:49 +0530 From: Arun Isaac Date: Tue, 30 Aug 2022 00:45:47 +0530 Message-Id: <20220829191547.2685-1-arunisaac@systemreboot.net> X-Mailer: git-send-email 2.37.1 In-Reply-To: References: MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/build/shepherd.scm (make-forkexec-constructor/container): Set #o640 permissions for log file. --- gnu/build/shepherd.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gnu/build/shepherd.scm b/gnu/build/shepherd.scm index f4caefce3c..9d9bfcfbc0 100644 --- a/gnu/build/shepherd.scm +++ b/gnu/build/shepherd.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2017, 2018, 2019, 2020, 2022 Ludovic Courtès ;;; Copyright © 2020 Mathieu Othacehe ;;; Copyright © 2022 Leo Nikkilä +;;; Copyright © 2022 Arun Isaac ;;; ;;; This file is part of GNU Guix. ;;; @@ -186,7 +187,7 @@ (define mounts (when log-file ;; Create LOG-FILE so we can map it in the container. (unless (file-exists? log-file) - (call-with-output-file log-file (const #t)) + (close (open log-file (logior O_CREAT O_APPEND O_CLOEXEC) #o640)) (when user (let ((pw (getpwnam user))) (chown log-file (passwd:uid pw) (passwd:gid pw))))))