[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: autostep and encrypted root password



Jeffrey Bastian wrote:
Jeffrey Bastian wrote:
So, a better solution would be to set a dummy password, e.g., xxxxxxxx, let it take the screenshot with the bullets in the fields, then replace it with the encrypted password from the kickstart file? Let me take a stab at that.

This patch does the above. What do you think about this approach? It fixed the problem in my limited testing.


Yesterday's patch was for RHEL 5.3 Beta. Attached is a patch for git master (anaconda-11.4.1.57-1-1-gc6cf36a). It's almost the same except that it skips the weak password (cracklib) check if the kickstart file contains a crypted password (since the password it would be checking -- "xxxxxxxx" -- is not the real password, and it is very weak!).

I have not tested this patch, but I did test the RHEL 5.3 Beta patch.

Jeff
diff --git a/iw/account_gui.py b/iw/account_gui.py
index 45f396b..6997223 100644
--- a/iw/account_gui.py
+++ b/iw/account_gui.py
@@ -36,6 +36,9 @@ class AccountWindow (InstallWindow):
         self.rootPassword = anaconda.id.rootPassword
         self.intf = anaconda.intf
 
+        self.isCrypted = False
+        self.cryptedPassword = ""
+
         (self.xml, self.align) = gui.getGladeWidget("account.glade",
                                                     "account_align")
         self.icon = self.xml.get_widget("icon")
@@ -58,8 +61,17 @@ class AccountWindow (InstallWindow):
         self.intf.icw.window.connect("key-release-event",
             lambda w, e: self.handleCapsLockRelease(w, e, self.capslock))
 
-        # we might have a root password already
-        if not self.rootPassword['isCrypted']:
+        # we might have a root password already from a kickstart file
+        # 1. if it's already encrypted, make a note of it and set the
+        #    text in the password fields to "xxxxxxxx" in case of
+        #    autostep with screenshots
+        # 2. if it's not encrypted, just use it
+        if self.rootPassword['isCrypted']:
+            self.isCrypted = True
+            self.cryptedPassword = self.rootPassword['password']
+            self.pw.set_text("xxxxxxxx")
+            self.confirm.set_text("xxxxxxxx")
+        else:
             self.pw.set_text(self.rootPassword['password'])
             self.confirm.set_text(self.rootPassword['password'])
 
@@ -125,16 +137,20 @@ class AccountWindow (InstallWindow):
                                     custom_icon="error")
             self.passwordError()
 
-        msg = gettext.ldgettext("cracklib", cracklib.FascistCheck(pw))
-        if msg is not None:
-            ret = self.intf.messageWindow(_("Weak Password"),
-                                          _("Weak password provided: %s"
-                                            "\n\n"
-                                            "Would you like to continue with "
-                                            "this password?") % (msg, ),
-                                          type = "yesno")
-            if ret == 0:
-                self.passwordError()
+        # if using a pre-crypted password from a kickstart file, then
+        # skip the weak password check
+        if not self.isCrypted:
+            msg = gettext.ldgettext("cracklib", cracklib.FascistCheck(pw))
+            if msg is not None:
+                ret = self.intf.messageWindow(_("Weak Password"),
+                                              _("Weak password provided: %s"
+                                                "\n\n"
+                                                "Would you like to continue "
+                                                "with this password?")
+                                                % (msg, ),
+                                              type = "yesno")
+                if ret == 0:
+                    self.passwordError()
 
         legal = string.digits + string.ascii_letters + string.punctuation + " "
         for letter in pw:
@@ -146,7 +162,11 @@ class AccountWindow (InstallWindow):
                                         custom_icon="error")
                 self.passwordError()
 
-        self.rootPassword["password"] = self.pw.get_text()
-        self.rootPassword["isCrypted"] = False
+        if self.isCrypted:
+            self.rootPassword["password"] = self.cryptedPassword
+            self.rootPassword["isCrypted"] = True
+        else:
+            self.rootPassword["password"] = self.pw.get_text()
+            self.rootPassword["isCrypted"] = False
 
         return None

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]