1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

services: openssh: Add 'generate-host-keys?' field.

* gnu/services/ssh.scm (<openssh-configuration>)[generate-host-keys?]:
New field.
(openssh-activation): Honor it.
* doc/guix.texi (Networking Services): Document it.
This commit is contained in:
Ludovic Courtès
2022-03-10 22:33:58 +01:00
parent 5e34e873af
commit 0691ab6779
2 changed files with 20 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014-2019, 2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016 David Craven <david@craven.ch>
;;; Copyright © 2016 Julien Lepiller <julien@lepiller.eu>
;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
@@ -351,6 +351,10 @@ The other options should be self-descriptive."
(authorized-keys openssh-authorized-keys
(default '()))
;; Boolean
(generate-host-keys? openssh-configuration-generate-host-keys?
(default #t))
;; Boolean
;; XXX: This should really be handled in an orthogonal way, for instance as
;; proposed in <https://bugs.gnu.org/27155>. Keep it internal/undocumented
@@ -402,9 +406,10 @@ The other options should be self-descriptive."
(unless (file-exists? lastlog)
(touch lastlog))))
;; Generate missing host keys.
(system* (string-append #$(openssh-configuration-openssh config)
"/bin/ssh-keygen") "-A"))))
(when #$(openssh-configuration-generate-host-keys? config)
;; Generate missing host keys.
(system* (string-append #$(openssh-configuration-openssh config)
"/bin/ssh-keygen") "-A")))))
(define (authorized-key-directory keys)
"Return a directory containing the authorized keys specified in KEYS, a list