aboutsummaryrefslogtreecommitdiff
path: root/src/property/ssh.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-04-29 16:21:22 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-04-29 16:21:22 -0700
commit3959be03083f1a9710546ef8dc0f4a645c0d2f9e (patch)
tree74f496c23019ff619932c1ffedf02dac773ecddf /src/property/ssh.lisp
parent6279bd8b9d742b858a095fbca1159b2cf1df2431 (diff)
downloadconsfigurator-3959be03083f1a9710546ef8dc0f4a645c0d2f9e.tar.gz
export SSHD:HOST-PUBLIC-KEYS hostattr, unexport GET-HOST-PUBLIC-KEYS
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/property/ssh.lisp')
-rw-r--r--src/property/ssh.lisp16
1 files changed, 14 insertions, 2 deletions
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