unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Vivien Kraus via Bug reports for GNU Guix <bug-guix@gnu.org>
To: 51487@debbugs.gnu.org
Subject: bug#51487: Acknowledgement (The openssh service does not allow multiple authorized key files per user)
Date: Fri, 29 Oct 2021 23:26:02 +0200	[thread overview]
Message-ID: <e9d6b181ddd0dd156a10bbba9500da11a8f4cfde.camel@planete-kraus.eu> (raw)
In-Reply-To: <a3baa9271aba2624bcdcc5f831d071a7dd792128.camel@planete-kraus.eu>

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

Le vendredi 29 octobre 2021 à 23:22 +0200, Vivien Kraus a écrit :
> After some discussion on #guix, this seems to be the easier way to
> fix
> the problem:
Sorry, I forgot to update the commit message.

Vivien

[-- Attachment #2: 0001-gnu-openssh-service-Collect-all-keys-for-all-users.patch --]
[-- Type: text/x-patch, Size: 1291 bytes --]

From b2f47730a3d9aa97716741134917c340354d9c3a Mon Sep 17 00:00:00 2001
From: Vivien Kraus <vivien@planete-kraus.eu>
Date: Fri, 29 Oct 2021 18:25:24 +0200
Subject: [PATCH] gnu: openssh-service: Collect all keys for all users.

* gnu/services/ssh.scm (extend-openssh-authorized-keys): ensure that no key is forgotten.
---
 gnu/services/ssh.scm | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/gnu/services/ssh.scm b/gnu/services/ssh.scm
index a018052eeb..1309e062ce 100644
--- a/gnu/services/ssh.scm
+++ b/gnu/services/ssh.scm
@@ -532,10 +532,16 @@ (define (openssh-pam-services config)
 
 (define (extend-openssh-authorized-keys config keys)
   "Extend CONFIG with the extra authorized keys listed in KEYS."
-  (openssh-configuration
-   (inherit config)
-   (authorized-keys
-    (append (openssh-authorized-keys config) keys))))
+  (let ((all-keys (make-hash-table)))
+    (for-each
+     (match-lambda
+       ((user keys ...)
+        (hash-set! all-keys user (append (hash-ref all-keys user '()) keys))))
+     (append (openssh-authorized-keys config) keys))
+    (openssh-configuration
+     (inherit config)
+     (authorized-keys
+      (hash-map->list cons all-keys)))))
 
 (define openssh-service-type
   (service-type (name 'openssh)
-- 
2.33.1


  reply	other threads:[~2021-10-29 21:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-29 16:15 bug#51487: The openssh service does not allow multiple authorized key files per user Vivien Kraus via Bug reports for GNU Guix
     [not found] ` <handler.51487.B.16355241781380.ack@debbugs.gnu.org>
2021-10-29 16:39   ` bug#51487: Acknowledgement (The openssh service does not allow multiple authorized key files per user) Vivien Kraus via Bug reports for GNU Guix
2021-10-29 16:45     ` Vivien Kraus via Bug reports for GNU Guix
2021-10-29 16:51   ` Vivien Kraus via Bug reports for GNU Guix
2021-10-29 21:22     ` Vivien Kraus via Bug reports for GNU Guix
2021-10-29 21:26       ` Vivien Kraus via Bug reports for GNU Guix [this message]
2021-11-07 15:04         ` bug#51487: The openssh service does not allow multiple authorized key files per user Ludovic Courtès
2021-11-07 17:29           ` Vivien Kraus via Bug reports for GNU Guix
2021-11-15 14:42             ` Ludovic Courtès
2021-11-15 15:31               ` Vivien Kraus via Bug reports for GNU Guix
2021-11-16  9:03                 ` Ludovic Courtès

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=e9d6b181ddd0dd156a10bbba9500da11a8f4cfde.camel@planete-kraus.eu \
    --to=bug-guix@gnu.org \
    --cc=51487@debbugs.gnu.org \
    --cc=vivien@planete-kraus.eu \
    /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 public inbox

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

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).