From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id uJnbHabesGGZ/AAAgWs5BA (envelope-from ) for ; Wed, 08 Dec 2021 17:34:46 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id IM+NGabesGFoVAAA1q6Kng (envelope-from ) for ; Wed, 08 Dec 2021 16:34:46 +0000 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 10464DB5C for ; Wed, 8 Dec 2021 17:34:46 +0100 (CET) Received: from localhost ([::1]:44392 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1muzu1-0006jb-3K for larch@yhetil.org; Wed, 08 Dec 2021 11:34:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41820) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1muztV-0006iM-3W for help-guix@gnu.org; Wed, 08 Dec 2021 11:34:13 -0500 Received: from knopi.disroot.org ([178.21.23.139]:42500) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1muztN-0007Tz-5j for help-guix@gnu.org; Wed, 08 Dec 2021 11:34:07 -0500 Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id C28258CB6E; Wed, 8 Dec 2021 17:34:01 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qXG37j_4HuRZ; Wed, 8 Dec 2021 17:33:58 +0100 (CET) References: <874k7mihb6.fsf@disroot.org> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1638981237; bh=+u/uKddwFASN3lUwFGX9jzURxtapV6HkAg7/Cxi6SzI=; h=References:Date:From:To:Cc:Subject:In-reply-to; b=W1kFQqSdcC8hV7cNNfvs03VFAcxLjDm3qHM+lHohpvGc9Xo+LGHkETTup4WCb8niW zOGE9bfIs486V68teNAZCxSP8fUmN9KJeOptoletIo3YLwcUrQkIorJW7py8zN/Z9R ljDm2Ie3lAqPI1UpjJOUbtEPg37lgVwDZ+NmFcTsRDfrV/AQY7e6M4ylkPLafUXuNx DY98tgccY4XRNK88LUisonsPaQffihYXhXyv26im+PiI8cHX3y7WJca1CsVqqw4rLm x44wlyKDS40PZ314my5H/vHfljgSaqWGFQyL/CR5YyquEW324LYUB1FrWsGT+E6X9C rPw2IMb1LXGDw== Date: Wed, 08 Dec 2021 11:26:21 -0500 From: Gary Johnson To: Nathan Dehnel Cc: Leo Famulari , help-guix@gnu.org Subject: Re: How to put a file in /gnu/store and set its permissions In-reply-to: Message-ID: <87mtlb83a0.fsf@disroot.org> Mime-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=178.21.23.139; envelope-from=lambdatronic@disroot.org; helo=knopi.disroot.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: "Help-Guix" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1638981286; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=/qTcb3Qekx0Z/DWdHF6OiX2xR4v2wPX22iNLj4hrgQ0=; b=qkGjaRURKdUZsFP0mJOrwDTOIZM/xjie2NhzHQvJ/1dPxVzDSAUQnvpdbP/HiWXIeig073 1YGph93FocHyefUCipj4RxIR1/lXWRLSbGHUvHERwkyYpXyPJcXCGX69TpTNGojfcsMWwJ RgKAV4MtEx+pNswALJrIN/ezFXBIDJvDjVxoMECrqRMZotfYByqrd+2LG38umj/+tczZ5C QDFbDy8SyPEx4SGMK84JbMvg5PwdGxGGx2Y1XK0xNmITcYjZWiZfAlbjI5NusTMeB2HkSU x4ApnubJn/ps257YMb8uVeS2eFn4O6MisoCVPMPosanG4jeKhni7zuFPNB7c7g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1638981286; a=rsa-sha256; cv=none; b=piK+/S6gfblKDcHYxD8lWVBDxA49m7nQs4GFU/CA/CkB7k32nAp1pDjmZq0FgaaZIdktBg x8YHRIQD/gZQyPv31+x/8mh21KDvh0Rz7fvy+SZ1yXneMiXnmI44AT7Fodmb0Hc6+PWScw 9VZtv17QaeCaRhTglkQucEks97XSvH5RSusrYMfhnnd76k0WkSrL0eVl3OKeXgOOY/tCxg FAQ7jGmwcyxvzSGTlTg1MI5Mmmkk+7gKsoeYkSDLY5/FpahUj2pIWnC7mtceg+qCRI9jS2 BK71a7aSqzqBw1T+Oya8UB1WfKnDES5F/Lw7w2CE1oucB7cGcV0z1dccw2xDrg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=disroot.org header.s=mail header.b=W1kFQqSd; dmarc=pass (policy=quarantine) header.from=disroot.org; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.65 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=disroot.org header.s=mail header.b=W1kFQqSd; dmarc=pass (policy=quarantine) header.from=disroot.org; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 10464DB5C X-Spam-Score: -3.65 X-Migadu-Scanner: scn1.migadu.com X-TUID: 6DC3d0nZwwSb > Nathan Dehnel writes: > > Thanks. I guess then I need to know how to put a file in /etc/ssh > without putting it in the store. > On Sun, Dec 5, 2021 at 8:44 PM Gary Johnson wrote: > > To programmatically add a file to /etc, you can extend the > etc-service-type in your operating-system's services field like so: > > ``` > (use-modules > ((gnu services) #:select (simple-service etc-service-type)) > ((gnu services desktop) #:select (%desktop-services)) > ((gnu system) #:select (operating-system)) > ((guix gexp) #:select (local-file))) > > (define guixrig_host_rsa_key > (local-file "ssh/guixrig_host_rsa_key" #:recursive? #t)) > > (operating-system > ... > (services (cons* (simple-service 'my-secret-service etc-service-type > `(("ssh/guixrig_host_rsa_key" ,guixrig_host_rsa_key))) > %desktop-services))) > ``` > > Have fun and happy hacking! > ~Gary > Nathan Dehnel writes: > > Thanks. Though that code causes "guix system: error: symlink: File > exists: "/etc/ssh"" when I use it, and by the looks of it, would still > be putting the key in the store, which is insecure. Bummer. It works as expected when I run that code on my system with: ``` sudo guix system reconfigure config.scm ``` Maybe you manually created /etc/ssh already, which could be causing the error on your end? Either way, your file does end up in the store and is owned by root:root with permissions 444. I'm not aware of a way to add files to /etc or any other guix-managed directory without placing a copy in the store. However, once your file lands in /etc/ssh/guixrig_host_rsa_key, isn't it owned by root:root and readable as well? Perhaps one of the other Guix wizards on this mailing list would have some ideas on how to control the permissions on these auto-generated files. Good luck, Gary -- GPG Key ID: 7BC158ED Use `gpg --search-keys lambdatronic' to find me Protect yourself from surveillance: https://emailselfdefense.fsf.org ======================================================================= () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments Why is HTML email a security nightmare? See https://useplaintext.email/ Please avoid sending me MS-Office attachments. See http://www.gnu.org/philosophy/no-word-attachments.html