all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 39819@debbugs.gnu.org
Cc: guix-devel@gnu.org
Subject: Re: bug#39819: [PATCH 1/2] services: guix: Make /etc/guix/acl really declarative by default.
Date: Sun, 25 Oct 2020 01:11:06 +0200	[thread overview]
Message-ID: <87pn57gqyd.fsf@gnu.org> (raw)
In-Reply-To: <20201021150823.20508-1-ludo@gnu.org> ("Ludovic Courtès"'s message of "Wed, 21 Oct 2020 17:08:22 +0200")

[-- Attachment #1: Type: text/plain, Size: 236 bytes --]

BTW, attached it the script I used to retrieve the signing keys of all
the build nodes of the build farm so we can have them declared in the
config of the head node.  You may find it handy if you have a similar
setup!

Ludo’.


[-- Attachment #2: the code --]
[-- Type: text/plain, Size: 1651 bytes --]

(use-modules (guix scripts offload)
             (guix ssh)
             (guix inferior)
             (ssh session)
             (srfi srfi-34)
             (ice-9 match))

(define open-ssh-session
  (@@ (guix scripts offload) open-ssh-session))

(define build-machine-name (@@ (guix scripts offload) build-machine-name))
(define build-machine-port (@@ (guix scripts offload) build-machine-port))

(define (fetch-key machine)
  (format #t "fetching key from ~s...~%" machine)
  (let* ((session  (open-ssh-session machine 5))
         (inferior (remote-inferior session)))
    (define key
      (inferior-eval '(begin
                        (use-modules (rnrs io ports))

                        (with-fluids ((%default-port-encoding "ISO-8859-1"))
                          (call-with-input-file "/etc/guix/signing-key.pub"
                            get-string-all)))
                     inferior))

    (define file
      (string-append (build-machine-name machine)
                     (match (build-machine-port machine)
                       (22 "")
                       (port
                        (string-append ":"
                                       (number->string
                                        port))))
                     ".pub"))

    (with-fluids ((%default-port-encoding "ISO-8859-1"))
      (call-with-output-file file
        (lambda (port)
          (display key port))))

    (close-inferior inferior)
    (disconnect! session)))

(let ((machines (load "/etc/guix/machines.scm")))
  (for-each (lambda (machine)
              (guard (c (pk 'fail c))
                (fetch-key machine)))
            machines))

      parent reply	other threads:[~2020-10-24 23:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-28  4:30 bug#39819: guix-service-type authorized keys are not honored when /etc/guix/acl exists Maxim Cournoyer
2020-02-28  4:32 ` Maxim Cournoyer
2020-10-11 10:39 ` Declarative /etc/guix/acl? Ludovic Courtès
2020-10-11 11:00   ` bug#39819: " Efraim Flashner
2020-10-11 11:07   ` Jan Nieuwenhuizen
2020-10-12 12:53     ` bug#39819: " Ludovic Courtès
2020-10-12 20:26       ` Jan Nieuwenhuizen
2020-10-21 15:08   ` [PATCH 1/2] services: guix: Make /etc/guix/acl really declarative by default Ludovic Courtès
2020-10-21 15:08     ` bug#39819: [PATCH 2/2] doc: Add "Getting Substitutes from Other Servers" section Ludovic Courtès
2020-10-21 16:06     ` [PATCH 1/2] services: guix: Make /etc/guix/acl really declarative by default Vagrant Cascadian
2020-10-24 23:08     ` bug#39819: " Ludovic Courtès
2020-10-25  5:59       ` Jan Nieuwenhuizen
2020-10-24 23:11     ` Ludovic Courtès [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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pn57gqyd.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=39819@debbugs.gnu.org \
    --cc=guix-devel@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.