Blame SOURCES/short_root_pw_1263254.patch

fd2bce
From ae19eb551eb6733ea7a4cf7a4e526371971f1663 Mon Sep 17 00:00:00 2001
fd2bce
From: Vratislav Podzimek <vpodzime@redhat.com>
fd2bce
Date: Wed, 16 Sep 2015 14:36:23 +0200
fd2bce
Subject: [PATCH] Do not remove the root password behind user's back (#1263254)
fd2bce
fd2bce
If the chosen profile requires a longer password than what was set in kickstart,
fd2bce
consider it a misconfiguration like any other such issue instead of silently
fd2bce
removing the password and going on. Removing password brings two problems:
fd2bce
fd2bce
1) in text mode it causes a system with no (empty) root password to be installed
fd2bce
fd2bce
2) in graphical mode it causes the installation with a complete kickstart to
fd2bce
hang waiting for a new root password
fd2bce
fd2bce
Signed-off-by: Vratislav Podzimek <vpodzime@redhat.com>
fd2bce
---
fd2bce
 org_fedora_oscap/rule_handling.py | 29 ++++++-----------------------
fd2bce
 1 file changed, 6 insertions(+), 23 deletions(-)
fd2bce
fd2bce
diff --git a/org_fedora_oscap/rule_handling.py b/org_fedora_oscap/rule_handling.py
fd2bce
index a969b16..6a67e8a 100644
fd2bce
--- a/org_fedora_oscap/rule_handling.py
fd2bce
+++ b/org_fedora_oscap/rule_handling.py
fd2bce
@@ -392,7 +392,6 @@ class PasswdRules(RuleHandler):
fd2bce
         """Constructor initializing attributes."""
fd2bce
 
fd2bce
         self._minlen = 0
fd2bce
-        self._removed_password = None
fd2bce
 
fd2bce
     def __str__(self):
fd2bce
         """Standard method useful for debugging and testing."""
fd2bce
@@ -415,7 +414,7 @@ class PasswdRules(RuleHandler):
fd2bce
             # no password restrictions, nothing to be done here
fd2bce
             return []
fd2bce
 
fd2bce
-        if not ksdata.rootpw.password and self._removed_password is None:
fd2bce
+        if not ksdata.rootpw.password:
fd2bce
             # root password was not set
fd2bce
 
fd2bce
             # password length enforcement is not suported in the Anaconda yet
fd2bce
@@ -427,30 +426,14 @@ class PasswdRules(RuleHandler):
fd2bce
             if ksdata.rootpw.isCrypted:
fd2bce
                 msg = _("cannot check root password length (password is crypted)")
fd2bce
                 return [RuleMessage(common.MESSAGE_TYPE_WARNING, msg)]
fd2bce
-            elif len(ksdata.rootpw.password) < self._minlen or \
fd2bce
-                    self._removed_password is not None:
fd2bce
-                # too short or already removed
fd2bce
-                msg = _("root password was too short, a longer one with at "
fd2bce
-                        "least %d characters will be required" % self._minlen)
fd2bce
-                if not report_only and self._removed_password is None:
fd2bce
-                    # remove the password and reset the seen flag no to confuse Anaconda
fd2bce
-                    self._removed_password = ksdata.rootpw.password
fd2bce
-                    ksdata.rootpw.password = ""
fd2bce
-                    ksdata.rootpw.seen = False
fd2bce
-                return [RuleMessage(common.MESSAGE_TYPE_WARNING, msg)]
fd2bce
+            elif len(ksdata.rootpw.password) < self._minlen:
fd2bce
+                # too short
fd2bce
+                msg = _("root password is too short, a longer one with at "
fd2bce
+                        "least %d characters is required" % self._minlen)
fd2bce
+                return [RuleMessage(common.MESSAGE_TYPE_FATAL, msg)]
fd2bce
             else:
fd2bce
                 return []
fd2bce
 
fd2bce
-    def revert_changes(self, ksdata, storage):
fd2bce
-        """:see: RuleHandler.revert_changes"""
fd2bce
-
fd2bce
-        # set the old password back
fd2bce
-        if self._removed_password is not None:
fd2bce
-            ksdata.rootpw.password = self._removed_password
fd2bce
-            ksdata.rootpw.seen = True
fd2bce
-
fd2bce
-            self._removed_password = None
fd2bce
-
fd2bce
 class PackageRules(RuleHandler):
fd2bce
     """Simple class holding data from the rules affecting installed packages."""
fd2bce
 
fd2bce
-- 
fd2bce
2.1.0
fd2bce