From 3959be03083f1a9710546ef8dc0f4a645c0d2f9e Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Fri, 29 Apr 2022 16:21:22 -0700 Subject: export SSHD:HOST-PUBLIC-KEYS hostattr, unexport GET-HOST-PUBLIC-KEYS Signed-off-by: Sean Whitton --- src/property/ssh.lisp | 16 ++++++++++++++-- src/property/sshd.lisp | 14 +------------- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'src/property') diff --git a/src/property/ssh.lisp b/src/property/ssh.lisp index 3f98d2a..0c15a49 100644 --- a/src/property/ssh.lisp +++ b/src/property/ssh.lisp @@ -42,6 +42,18 @@ `(file:secret-uploaded ,iden1 ,dest ,dest) `(file:host-secret-uploaded ,dest)))) +(defun get-host-public-keys (host &key short-hostname (aliases t) + (ips t) additional-names) + (let* ((host (preprocess-host host)) + (hostname (get-hostname host)) + (short (and short-hostname (list (get-short-hostname host)))) + (aliases (and aliases (get-hostattrs :aliases host))) + (ips (and ips (append (get-hostattrs :ipv6 host) + (get-hostattrs :ipv4 host))))) + (cons (format nil "~{~A~^,~}" + (cons hostname (append aliases short ips additional-names))) + (mapcar #'cdr (get-hostattrs 'sshd:host-public-keys host))))) + (defprop %update-known-hosts :posix (file host &key short-hostname (aliases t) (ips t) additional-names) (:apply @@ -50,7 +62,7 @@ (lambda (lines) (loop with host = (preprocess-host host) with (identifier . keys) - = (sshd:get-host-public-keys + = (get-host-public-keys host :aliases aliases :short-hostname short-hostname :ips ips :additional-names additional-names) and hostname = (get-hostname host) @@ -71,7 +83,7 @@ collect (format nil "~A ~A" identifier key)))))))) (:unapply (destructuring-bind (identifier . keys) - (sshd:get-host-public-keys + (get-host-public-keys host :aliases aliases :short-hostname short-hostname :ips ips :additional-names additional-names) (file:lacks-lines file diff --git a/src/property/sshd.lisp b/src/property/sshd.lisp index 8d1022c..78c954b 100644 --- a/src/property/sshd.lisp +++ b/src/property/sshd.lisp @@ -54,7 +54,7 @@ refuses to proceed if root has no authorized_keys." (defprop has-host-public-key :posix (type public-key) "Records an SSH public key of type TYPE as identifying this host." (:desc #?"Has SSH host key of type ${type}") - (:hostattrs (push-hostattr 'host-public-key (cons type public-key)))) + (:hostattrs (push-hostattr 'host-public-keys (cons type public-key)))) (defproplist has-host-key :posix (type public-key) "Installs the host key whose public part is PUBLIC-KEY and is of type TYPE. @@ -66,15 +66,3 @@ The private key is obtained as an item of prerequisite data." public-key) (file:host-secret-uploaded (merge-pathnames (strcat "ssh_host_" type "_key") #P"/etc/ssh/"))) - -(defun get-host-public-keys (host &key short-hostname (aliases t) - (ips t) additional-names) - (let* ((host (preprocess-host host)) - (hostname (get-hostname host)) - (short (and short-hostname (list (get-short-hostname host)))) - (aliases (and aliases (get-hostattrs :aliases host))) - (ips (and ips (append (get-hostattrs :ipv6 host) - (get-hostattrs :ipv4 host))))) - (cons (format nil "~{~A~^,~}" - (cons hostname (append aliases short ips additional-names))) - (mapcar #'cdr (get-hostattrs 'host-public-key host))))) -- cgit v1.2.3