e3ffab
From fe282611598ebdd97e9ca64d4da43c8916b5eb4a Mon Sep 17 00:00:00 2001
e3ffab
From: David Kupka <dkupka@redhat.com>
e3ffab
Date: Sun, 11 Jan 2015 18:45:11 -0500
e3ffab
Subject: [PATCH] Abort backup restoration on not matching host.
e3ffab
e3ffab
When restoring backup on master other than it was created there is high risk
e3ffab
of unexpected and hard-to-debug behavior. Refuse such restore.
e3ffab
e3ffab
https://fedorahosted.org/freeipa/ticket/4823
e3ffab
e3ffab
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
e3ffab
---
e3ffab
 ipaserver/install/ipa_restore.py | 6 ++----
e3ffab
 1 file changed, 2 insertions(+), 4 deletions(-)
e3ffab
e3ffab
diff --git a/ipaserver/install/ipa_restore.py b/ipaserver/install/ipa_restore.py
e3ffab
index 097703938a7ba3820f4acae2148760146464fa08..3b4cf6a7c05245076abde7a9c13e53bc9636b69a 100644
e3ffab
--- a/ipaserver/install/ipa_restore.py
e3ffab
+++ b/ipaserver/install/ipa_restore.py
e3ffab
@@ -249,11 +249,9 @@ class Restore(admintool.AdminTool):
e3ffab
                 (options.instance or options.backend)):
e3ffab
                 raise admintool.ScriptError('Restore must be in data-only mode when restoring a specific instance or backend.')
e3ffab
             if self.backup_host != api.env.host:
e3ffab
-                self.log.warning('Host name %s does not match backup name %s' %
e3ffab
+                raise admintool.ScriptError(
e3ffab
+                    'Host name %s does not match backup name %s' %
e3ffab
                     (api.env.host, self.backup_host))
e3ffab
-                if (not options.unattended and
e3ffab
-                    not user_input("Continue to restore?", False)):
e3ffab
-                    raise admintool.ScriptError("Aborted")
e3ffab
             if self.backup_ipa_version != str(version.VERSION):
e3ffab
                 self.log.warning(
e3ffab
                     "Restoring data from a different release of IPA.\n"
e3ffab
-- 
e3ffab
2.1.0
e3ffab