diff options
| author | Sergey Trofimov <sarg@sarg.org.ru> | 2025-03-14 16:06:54 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2025-04-06 11:45:18 +0200 |
| commit | a2ef2bcbfd75593a865e726b014594a73aa0e441 (patch) | |
| tree | 59b0750ddc094ba3c1c8ad51ab9d62d275f71213 /gnu/machine/hetzner.scm | |
| parent | 6a440c842b5c221cddf96a7bce92d61faac563ac (diff) | |
machine: hetzner: Allow connections using ssh-agent.
* gnu/machine/hetzner.scm (<hetzner-configuration>): Add ssh-public-key.
* doc/guix.texi (System Configuration)[hetzner-configuration]: Document it.
Change-Id: I7354ead508b1a4819534c6b22ba1f089749927c2
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Modified-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/machine/hetzner.scm')
| -rw-r--r-- | gnu/machine/hetzner.scm | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/gnu/machine/hetzner.scm b/gnu/machine/hetzner.scm index bc8d2efbd34..e8484e4d51e 100644 --- a/gnu/machine/hetzner.scm +++ b/gnu/machine/hetzner.scm | |||
| @@ -77,6 +77,7 @@ | |||
| 77 | hetzner-configuration-location | 77 | hetzner-configuration-location |
| 78 | hetzner-configuration-server-type | 78 | hetzner-configuration-server-type |
| 79 | hetzner-configuration-ssh-key | 79 | hetzner-configuration-ssh-key |
| 80 | hetzner-configuration-ssh-public-key | ||
| 80 | hetzner-configuration? | 81 | hetzner-configuration? |
| 81 | hetzner-environment-type)) | 82 | hetzner-environment-type)) |
| 82 | 83 | ||
| @@ -204,20 +205,24 @@ Have you run 'guix archive --generate-key'?") | |||
| 204 | (default "fsn1")) | 205 | (default "fsn1")) |
| 205 | (server-type hetzner-configuration-server-type ; string | 206 | (server-type hetzner-configuration-server-type ; string |
| 206 | (default "cx42")) | 207 | (default "cx42")) |
| 207 | (ssh-key hetzner-configuration-ssh-key)) ; string | 208 | (ssh-public-key hetzner-configuration-ssh-public-key ; public-key | string |
| 209 | (thunked) | ||
| 210 | (default (public-key-from-file (hetzner-configuration-ssh-key this-hetzner-configuration))) | ||
| 211 | (sanitize | ||
| 212 | (lambda (value) | ||
| 213 | (if (string? value) (public-key-from-file value) value)))) | ||
| 214 | (ssh-key hetzner-configuration-ssh-key | ||
| 215 | (default #f))) ; #f | string | ||
| 208 | 216 | ||
| 209 | (define (hetzner-configuration-ssh-key-fingerprint config) | 217 | (define (hetzner-configuration-ssh-key-fingerprint config) |
| 210 | "Return the SSH public key fingerprint of CONFIG as a string." | 218 | "Return the SSH public key fingerprint of CONFIG as a string." |
| 211 | (and-let* ((file-name (hetzner-configuration-ssh-key config)) | 219 | (and-let* ((pubkey (hetzner-configuration-ssh-public-key config)) |
| 212 | (privkey (private-key-from-file file-name)) | ||
| 213 | (pubkey (private-key->public-key privkey)) | ||
| 214 | (hash (get-public-key-hash pubkey 'md5))) | 220 | (hash (get-public-key-hash pubkey 'md5))) |
| 215 | (bytevector->hex-string hash))) | 221 | (bytevector->hex-string hash))) |
| 216 | 222 | ||
| 217 | (define (hetzner-configuration-ssh-key-public config) | 223 | (define (hetzner-configuration-ssh-key-public config) |
| 218 | "Return the SSH public key of CONFIG as a string." | 224 | "Return the SSH public key of CONFIG as a string." |
| 219 | (and-let* ((ssh-key (hetzner-configuration-ssh-key config)) | 225 | (let ((public-key (hetzner-configuration-ssh-public-key config))) |
| 220 | (public-key (public-key-from-file ssh-key))) | ||
| 221 | (format #f "ssh-~a ~a" (get-key-type public-key) | 226 | (format #f "ssh-~a ~a" (get-key-type public-key) |
| 222 | (public-key->string public-key)))) | 227 | (public-key->string public-key)))) |
| 223 | 228 | ||
