From: Gary Johnson <lambdatronic@disroot.org>
To: Nathan Dehnel <ncdehnel@gmail.com>
Cc: Leo Famulari <leo@famulari.name>, help-guix@gnu.org
Subject: Re: How to put a file in /gnu/store and set its permissions
Date: Wed, 08 Dec 2021 11:26:21 -0500 [thread overview]
Message-ID: <87mtlb83a0.fsf@disroot.org> (raw)
In-Reply-To: <CAEEhgEvt9N_1gDr_6t6_C+pFOfmap2P0KCk1pD29GC3mBqY8hQ@mail.gmail.com>
> Nathan Dehnel <ncdehnel@gmail.com> 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 <lambdatronic@disroot.org> 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 <ncdehnel@gmail.com> 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
prev parent reply other threads:[~2021-12-08 16:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-04 22:47 How to put a file in /gnu/store and set its permissions Nathan Dehnel
2021-12-05 5:12 ` Leo Famulari
2021-12-05 21:18 ` Nathan Dehnel
2021-12-06 2:30 ` Gary Johnson
2021-12-08 0:59 ` Nathan Dehnel
2021-12-08 6:02 ` Arun Isaac
2021-12-08 16:26 ` Gary Johnson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mtlb83a0.fsf@disroot.org \
--to=lambdatronic@disroot.org \
--cc=help-guix@gnu.org \
--cc=leo@famulari.name \
--cc=ncdehnel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).