diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-06-27 10:57:16 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-06-27 11:51:03 -0700 |
commit | bc851a03960a1f26b0dccf00adc70c75ba31d651 (patch) | |
tree | 85a957481413388bf571ca6995572385dbbed917 /src/property/sshd.lisp | |
parent | ecd897ca3ea733b8449c30bf39654d3ceb9ee51f (diff) | |
download | consfigurator-bc851a03960a1f26b0dccf00adc70c75ba31d651.tar.gz |
SSH known host properties: add :ALIASES parameter
Also, when updating existing lines, consider only the hostname as identifying
a matching existing line, disregarding whatever aliases and short hostname may
also be present. This means we can update lines if the aliases change.
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/property/sshd.lisp')
-rw-r--r-- | src/property/sshd.lisp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/property/sshd.lisp b/src/property/sshd.lisp index b55dd0f..96fe568 100644 --- a/src/property/sshd.lisp +++ b/src/property/sshd.lisp @@ -64,10 +64,10 @@ The private key is obtained as an item of prerequisite data." (file:host-secret-uploaded (merge-pathnames (strcat "ssh_host_" type "_key") #P"/etc/ssh/"))) -(defun get-host-public-keys (host &key short-hostname) +(defun get-host-public-keys (host &key short-hostname (aliases t)) (let* ((host (preprocess-host host)) - (hostname (get-hostname host))) - (cons (format nil "~A~:[~;,~A~]" - hostname (and short-hostname (find #\. hostname)) - (car (split-string hostname :separator "."))) + (hostname (get-hostname host)) + (short (and short-hostname (list (get-short-hostname host)))) + (aliases (and aliases (get-hostattrs :aliases host)))) + (cons (format nil "~{~A~^,~}" (cons hostname (append aliases short))) (mapcar #'cdr (get-hostattrs 'host-public-key host))))) |