aboutsummaryrefslogtreecommitdiff
path: root/src/property/ssh.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-06-24 14:52:58 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-06-25 16:10:57 -0700
commit14391860ac55c651107798f2679fca30f63faa4c (patch)
treef4e86c12c4e96c06d878cf0842c192a3c9e8e231 /src/property/ssh.lisp
parentd9aae06a5079ed79b22598332ff87ad91983e323 (diff)
downloadconsfigurator-14391860ac55c651107798f2679fca30f63faa4c.tar.gz
add SSH:HAS-USER-KEY
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/property/ssh.lisp')
-rw-r--r--src/property/ssh.lisp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/property/ssh.lisp b/src/property/ssh.lisp
index df014c3..c6b08d0 100644
--- a/src/property/ssh.lisp
+++ b/src/property/ssh.lisp
@@ -28,6 +28,16 @@
(:unapply
(apply #'file:lacks-lines ".ssh/authorized_keys" keys)))
+(defpropspec has-user-key :posix
+ (type public-key
+ &key (dest (merge-pathnames (strcat "id_" type) #P".ssh/")) iden1)
+ "Installs an SSH keypair to DEST, which defaults to ~/.ssh/id_TYPE{,.pub}."
+ `(eseqprops (file:exists-with-content
+ ,(strcat (unix-namestring dest) ".pub") ,public-key)
+ ,(if iden1
+ `(file:secret-uploaded ,iden1 ,dest)
+ `(file:host-secret-uploaded ,dest))))
+
(defprop %update-known-hosts :posix (file host &key short-hostname)
(:apply
(file:map-file-lines