def __init__(self, data, default_passphrase=""): super().__init__(data) self._passphrase_entry = self.builder.get_object("passphrase_entry") self._confirm_entry = self.builder.get_object("confirm_pw_entry") self._save_button = self.builder.get_object("passphrase_save_button") self._strength_bar = self.builder.get_object("strength_bar") self._strength_label = self.builder.get_object("strength_label") self._passphrase_warning_image = self.builder.get_object( "passphrase_warning_image") self._passphrase_warning_label = self.builder.get_object( "passphrase_warning_label") # Set the offset values for the strength bar colors self._strength_bar.add_offset_value("low", 2) self._strength_bar.add_offset_value("medium", 3) self._strength_bar.add_offset_value("high", 4) # Setup the password checker for passphrase checking self._checker = input_checking.PasswordChecker( initial_password_content=self._passphrase_entry.get_text(), initial_password_confirmation_content=self._confirm_entry.get_text( ), policy=input_checking.get_policy(self.data, "luks")) # configure the checker for passphrase checking self._checker.secret_type = constants.SecretType.PASSPHRASE # connect UI updates to check results self._checker.checks_done.connect(self._set_status) self.passphrase = default_passphrase self._passphrase_good_enough = False # check that the content of the passphrase field & the conformation field are the same self._confirm_check = input_checking.PasswordConfirmationCheck() # check passphrase validity, quality and strength self._validity_check = input_checking.PasswordValidityCheck() # connect UI updates to validity check results self._validity_check.result.password_score_changed.connect( self._set_password_strength) self._validity_check.result.status_text_changed.connect( self._set_password_status_text) # check if the passphrase contains non-ascii characters self._ascii_check = input_checking.PasswordASCIICheck() # check if the passphrase is empty self._empty_check = input_checking.PasswordEmptyCheck() # register the individual checks with the checker in proper order # 1) are both entered passphrases the same ? # 2) is the passphrase valid according to the current password checking policy ? # 3) is the passphrase free of non-ASCII characters ? self._checker.add_check(self._confirm_check) self._checker.add_check(self._validity_check) self._checker.add_check(self._ascii_check) self._checker.add_check(self._empty_check)
def __init__(self, title, policy_name, report_func=reporting_callback, process_func=crypt_password, secret_type=constants.SecretType.PASSWORD, message=None): super().__init__(title, report_func=report_func) self._no_separator = False self._policy = input_checking.get_policy(policy_name) self._secret_type = secret_type self._process_password = process_func self._dialog_message = message
def __init__(self, data): super().__init__(data) self._passphrase_entry = self.builder.get_object("passphrase_entry") self._confirm_entry = self.builder.get_object("confirm_pw_entry") self._save_button = self.builder.get_object("passphrase_save_button") self._strength_bar = self.builder.get_object("strength_bar") self._strength_label = self.builder.get_object("strength_label") self._passphrase_warning_image = self.builder.get_object("passphrase_warning_image") self._passphrase_warning_label = self.builder.get_object("passphrase_warning_label") # Set the offset values for the strength bar colors self._strength_bar.add_offset_value("low", 2) self._strength_bar.add_offset_value("medium", 3) self._strength_bar.add_offset_value("high", 4) # Setup the password checker for passphrase checking self._checker = input_checking.PasswordChecker(initial_password_content = self._passphrase_entry.get_text(), initial_password_confirmation_content = self._confirm_entry.get_text(), policy = input_checking.get_policy(self.data, "luks")) # configure the checker for passphrase checking self._checker.secret_type = constants.SecretType.PASSPHRASE # connect UI updates to check results self._checker.checks_done.connect(self._set_status) self.passphrase = "" self._passphrase_good_enough = False # check that the content of the passphrase field & the conformation field are the same self._confirm_check = input_checking.PasswordConfirmationCheck() # check passphrase validity, quality and strength self._validity_check = input_checking.PasswordValidityCheck() # connect UI updates to validity check results self._validity_check.result.password_score_changed.connect(self._set_password_strength) self._validity_check.result.status_text_changed.connect(self._set_password_status_text) # check if the passphrase contains non-ascii characters self._ascii_check = input_checking.PasswordASCIICheck() # check if the passphrase is empty self._empty_check = input_checking.PasswordEmptyCheck() # register the individual checks with the checker in proper order # 1) are both entered passphrases the same ? # 2) is the passphrase valid according to the current password checking policy ? # 3) is the passphrase free of non-ASCII characters ? self._checker.add_check(self._confirm_check) self._checker.add_check(self._validity_check) self._checker.add_check(self._ascii_check) self._checker.add_check(self._empty_check)
def run_passphrase_dialog(self): """Ask user for a default passphrase.""" if not self._is_passphrase_required(): return dialog = PasswordDialog( title=_("Passphrase"), message=_( "Please provide a default LUKS passphrase for all devices " "you want to encrypt. You will have to type it twice."), secret_type=SecretType.PASSPHRASE, policy=get_policy(self.data, "luks"), process_func=lambda x: x) passphrase = None while passphrase is None: passphrase = dialog.run() self._set_required_passphrase(passphrase)
def run_passphrase_dialog(self): """Ask user for a default passphrase.""" data_without_passphrase = self._get_data_without_passphrase() if not data_without_passphrase: return dialog = PasswordDialog( title=_("Passphrase"), message=_("Please provide a default LUKS passphrase for all devices " "you want to encrypt. You will have to type it twice."), secret_type=SecretType.PASSPHRASE, policy=get_policy(self.data, "luks"), process_func=lambda x: x ) passphrase = None while passphrase is None: passphrase = dialog.run() self._set_data_without_passphrase(data_without_passphrase, passphrase)
def initialize(self): NormalSpoke.initialize(self) self.initialize_start() # Create a new UserData object to store this spoke's state # as well as the state of the advanced user dialog. if self.data.user.userList: self._user = copy.copy(self.data.user.userList[0]) else: self._user = self.data.UserData() # gather references to relevant GUI objects # entry fields self._fullname_entry = self.builder.get_object("fullname_entry") self._username_entry = self.builder.get_object("username_entry") self._password_entry = self.builder.get_object("password_entry") self._password_confirmation_entry = self.builder.get_object( "password_confirmation_entry") # check boxes self._admin_checkbox = self.builder.get_object("admin_checkbox") self._password_required_checkbox = self.builder.get_object( "password_required_checkbox") # advanced user configration dialog button self._advanced_button = self.builder.get_object("advanced_button") # password checking status bar & label self._password_bar = self.builder.get_object("password_bar") self._password_label = self.builder.get_object("password_label") # Install the password checks: # - Has a password been specified? # - If a password has been specified and there is data in the confirm box, do they match? # - How strong is the password? # - Does the password contain non-ASCII characters? # Setup the password checker for password checking self._checker = input_checking.PasswordChecker( initial_password_content=self.password, initial_password_confirmation_content=self.password_confirmation, policy=input_checking.get_policy(self.data, "user")) # configure the checker for password checking self.checker.username = self.username self.checker.secret_type = constants.SecretType.PASSWORD # remove any placeholder texts if either password or confirmation field changes content from initial state self.checker.password.changed_from_initial_state.connect( self.remove_placeholder_texts) self.checker.password_confirmation.changed_from_initial_state.connect( self.remove_placeholder_texts) # connect UI updates to check results self.checker.checks_done.connect(self._checks_done) # username and full name checks self._username_check = input_checking.UsernameCheck() self._fullname_check = input_checking.FullnameCheck() # empty username is considered a success so that the user can leave # the spoke without filling it in self._username_check.success_if_username_empty = True # check that the password is not empty self._empty_check = input_checking.PasswordEmptyCheck() # check that the content of the password field & the conformation field are the same self._confirm_check = input_checking.PasswordConfirmationCheck() # check password validity, quality and strength self._validity_check = input_checking.PasswordValidityCheck() # connect UI updates to validity check results self._validity_check.result.password_score_changed.connect( self.set_password_score) self._validity_check.result.status_text_changed.connect( self.set_password_status) # check if the password contains non-ascii characters self._ascii_check = input_checking.PasswordASCIICheck() # register the individual checks with the checker in proper order # 0) is the username and fullname valid ? # 1) is the password non-empty ? # 2) are both entered passwords the same ? # 3) is the password valid according to the current password checking policy ? # 4) is the password free of non-ASCII characters ? self.checker.add_check(self._username_check) self.checker.add_check(self._fullname_check) self.checker.add_check(self._empty_check) self.checker.add_check(self._confirm_check) self.checker.add_check(self._validity_check) self.checker.add_check(self._ascii_check) self.guesser = {self.username_entry: True} # Configure levels for the password bar self.password_bar.add_offset_value("low", 2) self.password_bar.add_offset_value("medium", 3) self.password_bar.add_offset_value("high", 4) # indicate when the password was set by kickstart self.password_kickstarted = self.data.user.seen # Modify the GUI based on the kickstart and policy information # This needs to happen after the input checks have been created, since # the Gtk signal handlers use the input check variables. password_set_message = _("The password was set by kickstart.") if self.password_kickstarted: self.password_required = True self.password_entry.set_placeholder_text(password_set_message) self.password_confirmation_entry.set_placeholder_text( password_set_message) elif not self.checker.policy.emptyok: # Policy is that a non-empty password is required self.password_required = True if not self.checker.policy.emptyok: # User isn't allowed to change whether password is required or not self.password_required_checkbox.set_sensitive(False) self._advanced_user_dialog = AdvancedUserDialog(self._user, self.data) self._advanced_user_dialog.initialize() # set the visibility of the password entries set_password_visibility(self.password_entry, False) set_password_visibility(self.password_confirmation_entry, False) # report that we are done self.initialize_done()
def initialize(self): NormalSpoke.initialize(self) self.initialize_start() # get object references from the builders self._password_entry = self.builder.get_object("password_entry") self._password_confirmation_entry = self.builder.get_object("password_confirmation_entry") self._password_bar = self.builder.get_object("password_bar") self._password_label = self.builder.get_object("password_label") # set state based on kickstart # NOTE: this will stop working once the module supports multiple kickstart commands self.password_kickstarted = self._users_module.proxy.IsRootpwKickstarted # Install the password checks: # - Has a password been specified? # - If a password has been specified and there is data in the confirm box, do they match? # - How strong is the password? # - Does the password contain non-ASCII characters? # Setup the password checker for password checking self._checker = input_checking.PasswordChecker( initial_password_content = self.password, initial_password_confirmation_content = self.password_confirmation, policy = input_checking.get_policy(self.data, "root") ) # configure the checker for password checking self.checker.secret_type = constants.SecretType.PASSWORD # remove any placeholder texts if either password or confirmation field changes content from initial state self.checker.password.changed_from_initial_state.connect(self.remove_placeholder_texts) self.checker.password_confirmation.changed_from_initial_state.connect(self.remove_placeholder_texts) # connect UI updates to check results self.checker.checks_done.connect(self._checks_done) # check that the password is not empty self._empty_check = input_checking.PasswordEmptyCheck() # check that the content of the password field & the conformation field are the same self._confirm_check = input_checking.PasswordConfirmationCheck() # check password validity, quality and strength self._validity_check = input_checking.PasswordValidityCheck() # connect UI updates to validity check results self._validity_check.result.password_score_changed.connect(self.set_password_score) self._validity_check.result.status_text_changed.connect(self.set_password_status) # check if the password contains non-ascii characters self._ascii_check = input_checking.PasswordASCIICheck() # register the individual checks with the checker in proper order # 1) is the password non-empty ? # 2) are both entered passwords the same ? # 3) is the password valid according to the current password checking policy ? # 4) is the password free of non-ASCII characters ? self.checker.add_check(self._empty_check) self.checker.add_check(self._confirm_check) self.checker.add_check(self._validity_check) self.checker.add_check(self._ascii_check) # set placeholders if the password has been kickstarted as we likely don't know # nothing about it and can't really show it in the UI in any meaningful way password_set_message = _("The password was set by kickstart.") if self.password_kickstarted: self.password_entry.set_placeholder_text(password_set_message) self.password_confirmation_entry.set_placeholder_text(password_set_message) # Configure levels for the password bar self._password_bar.add_offset_value("low", 2) self._password_bar.add_offset_value("medium", 3) self._password_bar.add_offset_value("high", 4) # Send ready signal to main event loop hubQ.send_ready(self.__class__.__name__, False) # report that we are done self.initialize_done()
def initialize(self): NormalSpoke.initialize(self) self.initialize_start() # get object references from the builders self._password_entry = self.builder.get_object("password_entry") self._password_confirmation_entry = self.builder.get_object( "password_confirmation_entry") self._password_bar = self.builder.get_object("password_bar") self._password_label = self.builder.get_object("password_label") self._lock = self.builder.get_object("lock") # Install the password checks: # - Has a password been specified? # - If a password has been specified and there is data in the confirm box, do they match? # - How strong is the password? # - Does the password contain non-ASCII characters? # Setup the password checker for password checking self._checker = input_checking.PasswordChecker( initial_password_content=self.password, initial_password_confirmation_content=self.password_confirmation, policy=input_checking.get_policy(self.data, "root")) # configure the checker for password checking self.checker.secret_type = constants.SecretType.PASSWORD # remove any placeholder texts if either password or confirmation field changes content from initial state self.checker.password.changed_from_initial_state.connect( self.remove_placeholder_texts) self.checker.password_confirmation.changed_from_initial_state.connect( self.remove_placeholder_texts) # connect UI updates to check results self.checker.checks_done.connect(self._checks_done) # check that the password is not empty self._empty_check = input_checking.PasswordEmptyCheck() # check that the content of the password field & the conformation field are the same self._confirm_check = input_checking.PasswordConfirmationCheck() # check password validity, quality and strength self._validity_check = input_checking.PasswordValidityCheck() # connect UI updates to validity check results self._validity_check.result.password_score_changed.connect( self.set_password_score) self._validity_check.result.status_text_changed.connect( self.set_password_status) # check if the password contains non-ascii characters self._ascii_check = input_checking.PasswordASCIICheck() # register the individual checks with the checker in proper order # 1) is the password non-empty ? # 2) are both entered passwords the same ? # 3) is the password valid according to the current password checking policy ? # 4) is the password free of non-ASCII characters ? self.checker.add_check(self._empty_check) self.checker.add_check(self._confirm_check) self.checker.add_check(self._validity_check) self.checker.add_check(self._ascii_check) # the password entries should be sensitive on first entry to the spoke self.password_entry.set_sensitive(True) self.password_confirmation_entry.set_sensitive(True) # Set placeholders if the password has been set outside of the Anaconda # GUI we either don't really know anything about it if it's crypted # and still would not really want to expose it if its set in plaintext, # and thus can'treally show it in the UI in any meaningful way. if self._users_module.IsRootPasswordSet: password_set_message = _("Root password has been set.") self.password_entry.set_placeholder_text(password_set_message) self.password_confirmation_entry.set_placeholder_text( password_set_message) # Configure levels for the password bar self._password_bar.add_offset_value("low", 2) self._password_bar.add_offset_value("medium", 3) self._password_bar.add_offset_value("high", 4) # Send ready signal to main event loop hubQ.send_ready(self.__class__.__name__, False) # report that we are done self.initialize_done()
def initialize(self): NormalSpoke.initialize(self) self.initialize_start() # get object references from the builders self._password_entry = self.builder.get_object("password_entry") self._password_confirmation_entry = self.builder.get_object("password_confirmation_entry") self._password_bar = self.builder.get_object("password_bar") self._password_label = self.builder.get_object("password_label") # set state based on kickstart # NOTE: this will stop working once the module supports multiple kickstart commands self.password_kickstarted = self._users_module.proxy.IsRootpwKickstarted # Install the password checks: # - Has a password been specified? # - If a password has been specified and there is data in the confirm box, do they match? # - How strong is the password? # - Does the password contain non-ASCII characters? # Setup the password checker for password checking self._checker = input_checking.PasswordChecker( initial_password_content = self.password, initial_password_confirmation_content = self.password_confirmation, policy = input_checking.get_policy(self.data, "root") ) # configure the checker for password checking self.checker.secret_type = constants.SecretType.PASSWORD # remove any placeholder texts if either password or confirmation field changes content from initial state self.checker.password.changed_from_initial_state.connect(self.remove_placeholder_texts) self.checker.password_confirmation.changed_from_initial_state.connect(self.remove_placeholder_texts) # connect UI updates to check results self.checker.checks_done.connect(self._checks_done) # check that the password is not empty self._empty_check = input_checking.PasswordEmptyCheck() # check that the content of the password field & the conformation field are the same self._confirm_check = input_checking.PasswordConfirmationCheck() # regards both fields empty as success to let the user escape self._confirm_check.success_if_confirmation_empty = True # check password validity, quality and strength self._validity_check = input_checking.PasswordValidityCheck() # connect UI updates to validity check results self._validity_check.result.password_score_changed.connect(self.set_password_score) self._validity_check.result.status_text_changed.connect(self.set_password_status) # check if the password contains non-ascii characters self._ascii_check = input_checking.PasswordASCIICheck() # register the individual checks with the checker in proper order # 1) is the password non-empty ? # 2) are both entered passwords the same ? # 3) is the password valid according to the current password checking policy ? # 4) is the password free of non-ASCII characters ? self.checker.add_check(self._empty_check) self.checker.add_check(self._confirm_check) self.checker.add_check(self._validity_check) self.checker.add_check(self._ascii_check) # set placeholders if the password has been kickstarted as we likely don't know # nothing about it and can't really show it in the UI in any meaningful way password_set_message = _("The password was set by kickstart.") if self.password_kickstarted: self.password_entry.set_placeholder_text(password_set_message) self.password_confirmation_entry.set_placeholder_text(password_set_message) # Configure levels for the password bar self._password_bar.add_offset_value("low", 2) self._password_bar.add_offset_value("medium", 3) self._password_bar.add_offset_value("high", 4) # Send ready signal to main event loop hubQ.send_ready(self.__class__.__name__, False) # report that we are done self.initialize_done()
def initialize(self): NormalSpoke.initialize(self) self.initialize_start() # Create a new UserData object to store this spoke's state # as well as the state of the advanced user dialog. if self.data.user.userList: self._user = copy.copy(self.data.user.userList[0]) else: self._user = self.data.UserData() # gather references to relevant GUI objects # entry fields self._fullname_entry = self.builder.get_object("fullname_entry") self._username_entry = self.builder.get_object("username_entry") self._password_entry = self.builder.get_object("password_entry") self._password_confirmation_entry = self.builder.get_object("password_confirmation_entry") # check boxes self._admin_checkbox = self.builder.get_object("admin_checkbox") self._password_required_checkbox = self.builder.get_object("password_required_checkbox") # advanced user configration dialog button self._advanced_button = self.builder.get_object("advanced_button") # password checking status bar & label self._password_bar = self.builder.get_object("password_bar") self._password_label = self.builder.get_object("password_label") # Install the password checks: # - Has a password been specified? # - If a password has been specified and there is data in the confirm box, do they match? # - How strong is the password? # - Does the password contain non-ASCII characters? # Setup the password checker for password checking self._checker = input_checking.PasswordChecker( initial_password_content = self.password, initial_password_confirmation_content = self.password_confirmation, policy = input_checking.get_policy(self.data, "user") ) # configure the checker for password checking self.checker.username = self.username self.checker.secret_type = constants.SecretType.PASSWORD # remove any placeholder texts if either password or confirmation field changes content from initial state self.checker.password.changed_from_initial_state.connect(self.remove_placeholder_texts) self.checker.password_confirmation.changed_from_initial_state.connect(self.remove_placeholder_texts) # connect UI updates to check results self.checker.checks_done.connect(self._checks_done) # username and full name checks self._username_check = input_checking.UsernameCheck() self._fullname_check = input_checking.FullnameCheck() # empty username is considered a success so that the user can leave # the spoke without filling it in self._username_check.success_if_username_empty = True # check that the password is not empty self._empty_check = input_checking.PasswordEmptyCheck() # check that the content of the password field & the conformation field are the same self._confirm_check = input_checking.PasswordConfirmationCheck() # regards both fields empty as success to let the user escape self._confirm_check.success_if_confirmation_empty = True # check password validity, quality and strength self._validity_check = input_checking.PasswordValidityCheck() # connect UI updates to validity check results self._validity_check.result.password_score_changed.connect(self.set_password_score) self._validity_check.result.status_text_changed.connect(self.set_password_status) # check if the password contains non-ascii characters self._ascii_check = input_checking.PasswordASCIICheck() # register the individual checks with the checker in proper order # 0) is the username and fullname valid ? # 1) is the password non-empty ? # 2) are both entered passwords the same ? # 3) is the password valid according to the current password checking policy ? # 4) is the password free of non-ASCII characters ? self.checker.add_check(self._username_check) self.checker.add_check(self._fullname_check) self.checker.add_check(self._empty_check) self.checker.add_check(self._confirm_check) self.checker.add_check(self._validity_check) self.checker.add_check(self._ascii_check) self.guesser = { self.username_entry: True } # Configure levels for the password bar self.password_bar.add_offset_value("low", 2) self.password_bar.add_offset_value("medium", 3) self.password_bar.add_offset_value("high", 4) # indicate when the password was set by kickstart self.password_kickstarted = self.data.user.seen # Modify the GUI based on the kickstart and policy information # This needs to happen after the input checks have been created, since # the Gtk signal handlers use the input check variables. password_set_message = _("The password was set by kickstart.") if self.password_kickstarted: self.password_required = True self.password_entry.set_placeholder_text(password_set_message) self.password_confirmation_entry.set_placeholder_text(password_set_message) elif not self.checker.policy.emptyok: # Policy is that a non-empty password is required self.password_required = True if not self.checker.policy.emptyok: # User isn't allowed to change whether password is required or not self.password_required_checkbox.set_sensitive(False) self._advanced_user_dialog = AdvancedUserDialog(self._user, self.data) self._advanced_user_dialog.initialize() # set the visibility of the password entries set_password_visibility(self.password_entry, False) set_password_visibility(self.password_confirmation_entry, False) # report that we are done self.initialize_done()