From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id yN54A54QDWOQugAAbAwnHQ (envelope-from ) for ; Mon, 29 Aug 2022 21:16:46 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id UP52A54QDWMbUgEA9RJhRA (envelope-from ) for ; Mon, 29 Aug 2022 21:16:46 +0200 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 B1CD72E2AD for ; Mon, 29 Aug 2022 21:16:45 +0200 (CEST) Received: from localhost ([::1]:58172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSkFY-00007a-TZ for larch@yhetil.org; Mon, 29 Aug 2022 15:16:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43152) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSkEt-0008Nl-Ar for guix-patches@gnu.org; Mon, 29 Aug 2022 15:16:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44105) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oSkEt-0005Vt-1h 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-0003Yl-IS for guix-patches@gnu.org; Mon, 29 Aug 2022 15:16:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57363] [PATCH 0/1] Set #o640 permissions for log file of shepherd 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 , 57363@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 57363-submit@debbugs.gnu.org id=B57363.166180054113637 (code B ref 57363); Mon, 29 Aug 2022 19:16:02 +0000 Received: (at 57363) by debbugs.gnu.org; 29 Aug 2022 19:15:41 +0000 Received: from localhost ([127.0.0.1]:33851 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oSkEW-0003Xt-OV for submit@debbugs.gnu.org; Mon, 29 Aug 2022 15:15:41 -0400 Received: from mugam.systemreboot.net ([139.59.75.54]:55464) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oSkET-0003Xh-Nu for 57363@debbugs.gnu.org; Mon, 29 Aug 2022 15:15:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=systemreboot.net; s=default; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding: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=ntH8DCvkNhG6bgglbRAZZOC/YMMag6WQIGqMDnhK3o0=; b=qcA6L/7CIICZ0aOWZjeyL1Gpb/ 0eZ06DQRG05JJs2PakX/8vfG8PJvDAsjBuYR10Utz68L01Nh8xiqeF0FZu8ErqnKCt/02AjlYRVN+ cUOBK0+DQYblKh1nfsZCMmj5IYm1xxOL7KuNac0UPcXDjgi7Su536BYmbSYl4IO/Vizu7JMJH9kR5 2KFTXz2tRNX7E19sTvPjDLQrVRCpoLp24rCQxLTKGAmGvhWfyPc1gaj4WFkQDaEArsjUv6ppy3t4D aGClypAjeJnGKcQ4Il8uDzZ/mZZTmUQhJGIwf1mUKTi6eC3rEVQ1Yf8v/p4n0q/CVOFo0TRbMze0K 7V46Lnmg==; Received: from [192.168.2.1] (port=1676 helo=steel) by systemreboot.net with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1oSkEQ-0005H8-0a; Tue, 30 Aug 2022 00:45:34 +0530 From: Arun Isaac In-Reply-To: References: <20220823173102.30242-1-arunisaac@systemreboot.net> Date: Tue, 30 Aug 2022 00:45:33 +0530 Message-ID: <874jxuzwru.fsf@systemreboot.net> MIME-Version: 1.0 Content-Type: text/plain 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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1661800605; 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: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=ntH8DCvkNhG6bgglbRAZZOC/YMMag6WQIGqMDnhK3o0=; b=uHDs00fL2vNv9EAYanwYFVhn1hILJMCgGkDPtcxbd/U+gAqujGMwM7R2dqpjUaihARXH+h O/ybdZdxGxmQt76T7YhgdTtiFEPMg1dSCnbPR/WhTa/l3Ohmgybi7dMo6iUBt7V8RyaJ1T a+jjwJy6X6UepCBlCo1GPAwLgWk+7MgxV3DPIn3+6bAirVve4GwSo63vM5EcP33pHvP65v dv0putVlOjBsx9GXwQJvrfx64iviYvVG11wWt4QNN4HdlixyJZGryF8HlrblQeme2aJH8i WVsy6EjBP6aaph0NIffKtNdc99P4OSUQ8r4/1OvJvHrsFpnkmp19Dfh/bgZy7A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1661800605; a=rsa-sha256; cv=none; b=q+x7UiAk/GSTeYWAaE5dMylF8stwO2pvKkiubSOjFRTCEIdoyTF2ZGvTeDkIQ0CIJPqnzg xkfMAxEQsE5WefJBaf4lkUXrDKDFT/ATHVdVfb0i1E4Hz7C7rIX17jsFOpO99hpSdl1FJ0 gDeNdGpzvBoELj/rzAmjSUBEhwYOLdp1SLeXaDzGN1k5nIyLqFOhrLr2SL0Wc4fAhaUDhI RLC6AJ6n0HiouUcHCEP0ch+0Q7H+zranWMPjAPICpjeyrKtspzjRYeaftVuKzRwMpsdahJ v7pwylXbPFVLynmppAnWmb7Rm73YBdfuwdDDrkM2xqntvvq9ChU9HuZaxq5TgQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=systemreboot.net header.s=default header.b="qcA6L/7C"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=systemreboot.net (policy=none); 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" X-Migadu-Spam-Score: 7.71 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=systemreboot.net header.s=default header.b="qcA6L/7C"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=systemreboot.net (policy=none); 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" X-Migadu-Queue-Id: B1CD72E2AD X-Spam-Score: 7.71 X-Migadu-Scanner: scn1.migadu.com X-TUID: mZqBoIF/jXs2 Hi Maxime, > There is a small window during which the log file has overly-wide > permissions, which IIUC makes the log openable when it shouldn't, which > could later be exploited (after the daemon has been running for a while) > to extract anything secret written to the log by the service. True, thanks for catching that! > Try using (close (open log-file (logior O_CREAT O_APPEND O_CLOEXEC) > #o600)) instead, that should make things atomic. Done. An updated patch follows. > I do not know if clearing the log file is desired -- if so, remove > O_APPEND, if not, keep O_APPEND. I don't think clearing the log file is desired. Append is good, I think. Users wouldn't want their log files overwritten everytime their system is restarted. Regards, Arun