From 8f15fc306a4018893bc0e68be097eda2d3444547 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 16 Dec 2024 11:46:23 +0100 Subject: [PATCH] unet-cli: fix add-ssh-host with seed keys Signed-off-by: Felix Fietkau --- scripts/unet-cli | 14 +++++++------- 1 file 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) -- 2.30.2