aboutsummaryrefslogtreecommitdiff
path: root/src/property/ssh.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-07-15 16:48:58 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-07-16 14:22:31 -0700
commitaf2b4f1e81a31cdbdb8d640effffc25966f384ec (patch)
tree6d2071d50c16f0fee24562af883ee44d9ee88b9d /src/property/ssh.lisp
parent58bcd1fa4a00c35492d6886c0f729974e7028136 (diff)
downloadconsfigurator-af2b4f1e81a31cdbdb8d640effffc25966f384ec.tar.gz
SSH:HAS-USER-KEY: require specification of destination path
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/property/ssh.lisp')
-rw-r--r--src/property/ssh.lisp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/property/ssh.lisp b/src/property/ssh.lisp
index 58775a4..4f7a717 100644
--- a/src/property/ssh.lisp
+++ b/src/property/ssh.lisp
@@ -28,10 +28,15 @@
(: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}."
+(defpropspec has-user-key :posix (dest public-key &key iden1)
+ "Installs an SSH keypair to DEST and DEST.pub."
+ ;; The original version of this property took a key type argument and
+ ;; defaulted DEST to ~/.ssh/id_TYPE, but FILE:HOST-SECRET-UPLOADED requires
+ ;; an absolute path because the remote HOME is not known at :HOSTATTRS time,
+ ;; and the same applies here, so the caller must supply DEST. In the
+ ;; FILE:SECRET-UPLOADED branch we could use a relative path, but we should
+ ;; not use an identical relative path for both IDEN2 and the destination
+ ;; when IDEN1 is a hostname, which it might be.
`(eseqprops (file:exists-with-content
,(strcat (unix-namestring dest) ".pub") ,public-key)
,(if iden1