aboutsummaryrefslogtreecommitdiffstats
path: root/mod/ssh-keys-import.rsc
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-08-18 09:15:44 +0200
committerGravatar Christian Hesse <mail@eworm.de>2023-08-18 15:23:20 +0200
commit53a80c81b18a01dadaef967fd52e2fc2474714fa (patch)
tree079a2771d746ecc504acf4fa6f2bc6b17503dfa5 /mod/ssh-keys-import.rsc
parentad6825571dba2d3f0654f5822c00b2e7f898db09 (diff)
mod/ssh-keys-import: $SSHKeysImport: add check for key type
Diffstat (limited to 'mod/ssh-keys-import.rsc')
-rw-r--r--mod/ssh-keys-import.rsc6
1 files changed, 6 insertions, 0 deletions
diff --git a/mod/ssh-keys-import.rsc b/mod/ssh-keys-import.rsc
index 170139d..31bb3e6 100644
--- a/mod/ssh-keys-import.rsc
+++ b/mod/ssh-keys-import.rsc
@@ -17,6 +17,7 @@
:global GetRandom20CharAlNum;
:global LogPrintExit2;
:global MkDir;
+ :global RequiredRouterOS;
:global WaitForFile;
:if ([ :len $Key ] = 0 || [ :len $User ] = 0) do={
@@ -27,6 +28,11 @@
$LogPrintExit2 warning $0 ("User '" . $User . "' does not exist.") true;
}
+ :local Type [ :pick $Key 0 [ :find $Key " " ] ];
+ :if (!(([ $RequiredRouterOS $0 "7.12beta1" ] = true && $Type = "ssh-ed25519") || $Type = "ssh-rsa")) do={
+ $LogPrintExit2 warning $0 ("SSH key of type '" . $Type . "' is not supported.") true;
+ }
+
:if ([ $MkDir "tmpfs/ssh-keys-import" ] = false) do={
$LogPrintExit2 warning $0 ("Creating directory 'tmpfs/ssh-keys-import' failed!") true;
}