[f22-branch 4/7] Add pwpolicy for the LUKS passphrase dialog.

bcl installerbot-noreply at redhat.com
Tue Mar 17 23:09:18 UTC 2015


From: "Brian C. Lane" <bcl at redhat.com>

Use the new kickstart pwpolicy settings for the LUKS passphrase dialog.

Set the policy using the 'luks' keyword, like so:

pwpolicy luks --strict --minlen=15
---
 pyanaconda/ui/gui/spokes/lib/passphrase.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/pyanaconda/ui/gui/spokes/lib/passphrase.py b/pyanaconda/ui/gui/spokes/lib/passphrase.py
index 8241ce1..0d45b47 100644
--- a/pyanaconda/ui/gui/spokes/lib/passphrase.py
+++ b/pyanaconda/ui/gui/spokes/lib/passphrase.py
@@ -60,6 +60,11 @@ def __init__(self, data):
         self._strength_bar.add_offset_value("medium", 3)
         self._strength_bar.add_offset_value("high", 4)
 
+        # Configure the password policy, if available. Otherwise use defaults.
+        self.policy = self.data.pwpolicy.get_policy("luks")
+        if not self.policy:
+            self.policy = self.data.pwpolicy.handler.PwPolicyData()
+
         # These will be set up later.
         self._pwq = None
         self._pwq_error = None
@@ -80,6 +85,7 @@ def refresh(self):
         # set up passphrase quality checker
         self._pwq = pwquality.PWQSettings()
         self._pwq.read_config()
+        self._pwq.minlen = self.policy.minlen
 
         # initialize with the previously set passphrase
         self.passphrase = self.data.autopart.passphrase
@@ -147,7 +153,7 @@ def set_status(self, inputcheck):
         # The save button should only be sensitive if the match check passes
         if self._passphrase_match_check.check_status == InputCheck.CHECK_OK and \
                 self._confirm_match_check.check_status == InputCheck.CHECK_OK and \
-                self._strength_check.check_status == InputCheck.CHECK_OK:
+                (not self.policy.strict or self._strength_check.check_status == InputCheck.CHECK_OK):
             self._save_button.set_sensitive(True)
         else:
             self._save_button.set_sensitive(False)


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/6382ccc0f60b96560dc922df36e17f38f2a4d5ee


More information about the anaconda-patches mailing list