aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-08-18 09:00:54 +0200
committerGravatar Christian Hesse <mail@eworm.de>2023-08-18 15:23:20 +0200
commitad6825571dba2d3f0654f5822c00b2e7f898db09 (patch)
tree52b8832f47fd83f8b911cdbd0aea86789610f57e
parent413be6f504b926e5e271001a00bd9e0d2aad5f43 (diff)
mod/ssh-keys-import: support ed25519 keys...routeros-7.12beta1-1
... with RouterOS 7.12beta1
-rw-r--r--doc/mod/ssh-keys-import.md7
-rw-r--r--mod/ssh-keys-import.rsc3
2 files changed, 8 insertions, 2 deletions
diff --git a/doc/mod/ssh-keys-import.md b/doc/mod/ssh-keys-import.md
index 410bb5a..cf28ee2 100644
--- a/doc/mod/ssh-keys-import.md
+++ b/doc/mod/ssh-keys-import.md
@@ -29,6 +29,11 @@ import that key:
$SSHKeysImport "ssh-rsa AAAAB3Nza...QYZk8= user" admin;
+Starting with RouterOS *7.12beta1* support for keys of type `ed25519` has
+been added:
+
+ $SSHKeysImport "ssh-ed25519 AAAAC3Nza...ZVugJT user" admin;
+
The third part of the key (`user` in this example) is inherited as
`key-owner` in RouterOS.
@@ -39,7 +44,7 @@ and import all the keys. The user given to the function can be overwritting
from comments in the file. Create a file `keys.pub` with this content:
```
-ssh-rsa AAAAB3Nza...QYZk8= user@client
+ssh-ed25519 AAAAC3Nza...3OcN8A user@client
ssh-rsa AAAAB3Nza...ozyts= worker@station
# user=example
ssh-rsa AAAAB3Nza...GXQVk= person@host
diff --git a/mod/ssh-keys-import.rsc b/mod/ssh-keys-import.rsc
index dd02d16..170139d 100644
--- a/mod/ssh-keys-import.rsc
+++ b/mod/ssh-keys-import.rsc
@@ -50,6 +50,7 @@
:global EitherOr;
:global LogPrintExit2;
:global ParseKeyValueStore;
+ :global RequiredRouterOS;
:global SSHKeysImport;
:if ([ :len $FileName ] = 0 || [ :len $User ] = 0) do={
@@ -67,7 +68,7 @@
:local Line [ :pick $Keys 0 [ :find $Keys "\n" ] ];
:set Keys [ :pick $Keys ([ :find $Keys "\n" ] + 1) [ :len $Keys ] ];
:local Type [ :pick $Line 0 [ :find $Line " " ] ];
- :if ($Type = "ssh-rsa") do={
+ :if (([ $RequiredRouterOS $0 "7.12beta1" ] = true && $Type = "ssh-ed25519") || $Type = "ssh-rsa") do={
$SSHKeysImport $Line $User;
:set Continue true;
}