summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau2024-12-16 10:46:23 +0000
committerFelix Fietkau2024-12-16 10:46:23 +0000
commit8f15fc306a4018893bc0e68be097eda2d3444547 (patch)
treea6f05e82d717461adf9df9c6c37a54061c0a0dde
parent188ba05eadf2053c96b20a9544b5d30e560cdf6c (diff)
unet-cli: fix add-ssh-host with seed keys
Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rwxr-xr-xscripts/unet-cli14
1 files changed, 7 insertions, 7 deletions
diff --git a/scripts/unet-cli b/scripts/unet-cli
index 9beda2c..8cb790e 100755
--- a/scripts/unet-cli
+++ b/scripts/unet-cli
@@ -249,10 +249,10 @@ function key_arg(file, net_data) {
return `-K ${file}.key`;
}
-function sync_ssh_host(host) {
+function sync_ssh_host(host, net_data) {
let interface = args.interface ?? "unet";
let connect = replace(args.connect ?? "", ",", " ");
- let auth_key = args.auth_key;
+ let auth_key = args.auth_key ?? net_data.config.id;
let tunnels = replace(replace(args.tunnels ?? "", ",", " "), ":", "=");
let domain = args.domain ?? "unet";
let dht;
@@ -339,11 +339,6 @@ if (command in [ "add-service", "set-service" ]) {
fetch_args();
-if (command in [ "add-ssh-host", "set-ssh-host" ]) {
- sync_ssh_host(ssh_host);
- command = replace(command, "ssh-", "");
-}
-
let net_data;
if (command == "import") {
@@ -373,6 +368,11 @@ if (command == "create") {
}
}
+if (command in [ "add-ssh-host", "set-ssh-host" ]) {
+ sync_ssh_host(ssh_host, net_data);
+ command = replace(command, "ssh-", "");
+}
+
if (command == "sign") {
let ret = system(`${unet_tool} -S ${key_arg(file, net_data)} -o ${file}.bin ${file}`);
if (ret != 0)