aboutsummaryrefslogtreecommitdiffstats
path: root/mod/ssh-keys-import.rsc
diff options
context:
space:
mode:
Diffstat (limited to 'mod/ssh-keys-import.rsc')
-rw-r--r--mod/ssh-keys-import.rsc7
1 files changed, 7 insertions, 0 deletions
diff --git a/mod/ssh-keys-import.rsc b/mod/ssh-keys-import.rsc
index 023407a..dd80fe9 100644
--- a/mod/ssh-keys-import.rsc
+++ b/mod/ssh-keys-import.rsc
@@ -40,6 +40,13 @@
}
:local FingerPrintMD5 [ :convert from=base64 transform=md5 to=hex ($KeyVal->1) ];
+
+ :if ([ :len [ /user/ssh-keys/find where user=$User key-owner~("\\bmd5=" . $FingerPrintMD5 . "\\b") ] ] > 0) do={
+ $LogPrintExit2 warning $0 ("The ssh public key (MD5:" . $FingerPrintMD5 . \
+ ") is already available for user '" . $User . "'.") false;
+ :return false;
+ }
+
:local FileName ("tmpfs/ssh-keys-import/key-" . [ $GetRandom20CharAlNum 6 ] . ".pub");
/file/add name=$FileName contents=($Key . ", md5=" . $FingerPrintMD5);
$WaitForFile $FileName;