From 25bcee6488336d67022e9db2e5eb67813d39c807 Mon Sep 17 00:00:00 2001 From: Birger Schacht Date: Tue, 5 Nov 2019 15:45:35 +0100 Subject: [PATCH] backups: Show proper error when SSH server is not reachable The backup module is connecting to the remote backup host using ssh-keyscan to get a list of SSH public keys. When the connection fails, the form should inform the user that there was a problem, instead of simply not listing any SSH public keys. Closes: #1656. Signed-off-by: Birger Schacht [sunil: Minor indentation] Signed-off-by: Sunil Mohan Adapa Reviewed-by: Sunil Mohan Adapa --- .../backups/templates/verify_ssh_hostkey.html | 60 +++++++++++-------- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/plinth/modules/backups/templates/verify_ssh_hostkey.html b/plinth/modules/backups/templates/verify_ssh_hostkey.html index 91ec0e558..5c549abb6 100644 --- a/plinth/modules/backups/templates/verify_ssh_hostkey.html +++ b/plinth/modules/backups/templates/verify_ssh_hostkey.html @@ -28,35 +28,45 @@
{% csrf_token %} -

- The authenticity of SSH host {{ hostname }} could not be established. The host advertises the following SSH public keys. Please verify any one of them. -

- -
+ {% if form.ssh_public_key|length_is:"0" %}

- + {% blocktrans trimmed %} + Could not reach SSH host {{ hostname }}. Please verify that the host + is up and accepting connections. + {% endblocktrans %} +

+ {% else %} +

+ The authenticity of SSH host {{ hostname }} could not be established. The host advertises the following SSH public keys. Please verify any one of them.

-
-

- {% blocktrans trimmed %} - Run the following command on the SSH host machine. The output should - match one of the provided options. You can also use dsa, ecdsa, - ed25519 etc. instead of rsa, by choosing the corresponding file. - {% endblocktrans %} -

-

- sudo ssh-keygen -lf /etc/ssh/ssh_host_rsa_key -

-
-
- {{ form|bootstrap }} +
+

+ +

+
+

+ {% blocktrans trimmed %} + Run the following command on the SSH host machine. The output + should match one of the provided options. You can also use dsa, + ecdsa, ed25519 etc. instead of rsa, by choosing the corresponding + file. + {% endblocktrans %} +

+

+ sudo ssh-keygen -lf /etc/ssh/ssh_host_rsa_key +

+
+
- + {{ form|bootstrap }} + + + {% endif %}
{% endblock %}