From eee490f594bb2e41e95c1dd0effb8908c393efce Mon Sep 17 00:00:00 2001 From: Giacomo Sanchietti Date: Thu, 17 Apr 2025 09:34:24 +0200 Subject: [PATCH] fix(ssh): configure only main dropbear server Make sure to configure the SSH server named main. Otherwise when the HA is configured, the UI will show and configure dropbear instance dedicated to the HA. --- src/components/standalone/ssh/SshConfig.vue | 16 +++++++++++----- src/i18n/en/translation.json | 3 ++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/components/standalone/ssh/SshConfig.vue b/src/components/standalone/ssh/SshConfig.vue index 7e760e562..9c8ae3ea0 100644 --- a/src/components/standalone/ssh/SshConfig.vue +++ b/src/components/standalone/ssh/SshConfig.vue @@ -32,6 +32,7 @@ type SshConfigResponse = { PasswordAuth: string RootPasswordAuth: string GatewayPorts: string + '.name': string } ] } @@ -58,7 +59,7 @@ function submit() { submitting.value = true ubusCall('uci', 'set', { config: 'dropbear', - section: '@dropbear[0]', + section: 'dropbear.main', values: { Port: port.value, PasswordAuth: passwordAuth.value ? 'on' : 'off', @@ -96,10 +97,15 @@ function load() { loading.value = true getUciConfig('dropbear') .then((response: SshConfigResponse) => { - port.value = response.dropbear[0].Port - passwordAuth.value = response.dropbear[0].PasswordAuth == 'on' - rootPasswordAuth.value = response.dropbear[0].RootPasswordAuth == 'on' - gatewayPorts.value = response.dropbear[0].GatewayPorts == 'on' + const mainConfig = response.dropbear.find((config) => config['.name'] === 'main') + if (mainConfig) { + port.value = mainConfig.Port + passwordAuth.value = mainConfig.PasswordAuth == 'on' + rootPasswordAuth.value = mainConfig.RootPasswordAuth == 'on' + gatewayPorts.value = mainConfig.GatewayPorts == 'on' + } else { + error.value = new Error(t('standalone.ssh.ssh_access.main_config_not_found')) + } }) .catch((exception: AxiosError) => { error.value = new Error(getAxiosErrorMessage(exception)) diff --git a/src/i18n/en/translation.json b/src/i18n/en/translation.json index 2f795b384..df44abc4e 100644 --- a/src/i18n/en/translation.json +++ b/src/i18n/en/translation.json @@ -598,7 +598,8 @@ "allow_remote_host_connection": "Allow remote hosts to connect to local SSH forwarded ports", "tcp_port_too_low": "TCP port must be greater than 1", "tcp_port_too_high": "TCP port must be less than 65535", - "tcp_port_invalid": "TCP port is invalid" + "tcp_port_invalid": "TCP port is invalid", + "ssh_access.main_config_not_found": "Default SSH configuration not found" }, "ssh_keys": { "description": "Public keys allow for passwordless SSH logins with a higher security compared to the use of plain passwords",