From 326c838547213758b32be339903d9b59b95795f4 Mon Sep 17 00:00:00 2001
From: Bernard `Guyzmo` Pratz
Date: Thu, 14 Jan 2016 20:50:35 +0000
Subject: [PATCH] Added SSH Public Key shown on the web interface UI
Signed-off-by: Bernard `Guyzmo` Pratz
---
management/backup.py | 4 ++++
management/templates/system-backup.html | 15 ++++++++++++---
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/management/backup.py b/management/backup.py
index 32d77d1a..e8aca327 100755
--- a/management/backup.py
+++ b/management/backup.py
@@ -477,6 +477,10 @@ def get_backup_config(env, for_save=False, for_ui=False):
if config["target"] == "local":
# Expand to the full URL.
config["target"] = "file://" + config["file_target_directory"]
+ elif config["target"].startswith('rsync'):
+ ssh_pub_key = os.path.join('/root', '.ssh', 'id_rsa.pub')
+ if os.path.exists(ssh_pub_key):
+ config["ssh_pub_key"] = open(ssh_pub_key, 'r').read()
return config
diff --git a/management/templates/system-backup.html b/management/templates/system-backup.html
index 04c2c8e0..1511125c 100644
--- a/management/templates/system-backup.html
+++ b/management/templates/system-backup.html
@@ -37,9 +37,6 @@
they are safe to store anywhere.
Separately copy the encryption
password from to a safe and
secure location. You will need this file to decrypt backup files.
-
Separately copy the SSH public key from /root/.ssh/id_rsa.pub
- and add it to your backup account on your remote server, in the
- ~/.ssh/authorized_keys file.
@@ -61,6 +58,17 @@
+
+
+
+
+
+ Copy the Public SSH Key above, and paste it within the ~/.ssh/authorized_keys
+ of target user on the backup server specified above. That way you'll enable secure and
+ passwordless authentication from your mail-in-a-box server and your backup server.
+
+
+
@@ -208,6 +216,7 @@ function show_custom_backup() {
$("#min-age").val(r.min_age_in_days);
$(".backup-location").text(r.file_target_directory);
$(".backup-encpassword-file").text(r.enc_pw_file);
+ $("#ssh-pub-key").val(r.ssh_pub_key);
if (r.target == "file://" + r.file_target_directory) {
$("#backup-target-type").val("local");