diff --git a/doc/guix.texi b/doc/guix.texi index c1ce5bc896373f0b41414e745635d4e952982f60..7d50f31d2056f3cbfb05175ae8b34f7fd9155454 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -26447,6 +26447,18 @@ keyring. @item @code{identity} (default: @code{#f}) If specified, the path to the SSH private key to use to authenticate with the remote host. + +@item @code{host-key} (default: @code{#f}) +This should be the SSH host key of the machine, which looks like this: + +@example +ssh-ed25519 AAAAC3Nz@dots{} root@@example.org +@end example + +When @code{host-key} is @code{#f}, the server is authenticated against +the @file{~/.ssh/known_hosts} file, just like the OpenSSH @command{ssh} +client does. + @end table @end deftp diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index 6e3ed0e092915254a25408866d533470821cf70c..23ae917b79c460eb52df0aa6a4aac236a2e23620 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -54,6 +54,7 @@ (define-module (gnu machine ssh) machine-ssh-configuration-authorize? machine-ssh-configuration-port machine-ssh-configuration-user + machine-ssh-configuration-host-key machine-ssh-configuration-session)) ;;; Commentary: @@ -87,6 +88,8 @@ (define-record-type* <machine-ssh-configuration> machine-ssh-configuration (identity machine-ssh-configuration-identity ; path to a private key (default #f)) (session machine-ssh-configuration-session ; session + (default #f)) + (host-key machine-ssh-configuration-host-key ; #f | string (default #f))) (define (machine-ssh-session machine) @@ -98,11 +101,13 @@ (define (machine-ssh-session machine) (let ((host-name (machine-ssh-configuration-host-name config)) (user (machine-ssh-configuration-user config)) (port (machine-ssh-configuration-port config)) - (identity (machine-ssh-configuration-identity config))) + (identity (machine-ssh-configuration-identity config)) + (host-key (machine-ssh-configuration-host-key config))) (open-ssh-session host-name #:user user #:port port - #:identity identity))))) + #:identity identity + #:host-key host-key))))) ;;;