def save(self, value: str, is_default: bool): try: layout, variant = value.split('+') except ValueError: layout = value variant = '' write_settings( self.settings_file, { # The default value from /etc/default/keyboard 'TAILS_XKBMODEL': 'pc105', 'TAILS_XKBLAYOUT': layout, 'TAILS_XKBVARIANT': variant, 'IS_DEFAULT': is_default, })
def save(self, password: str): proc = subprocess.run( # mkpasswd generates a salt if none is provided (even though the # man page doesn't explicitly state this). ["mkpasswd", "--stdin", "--method=sha512crypt"], input=password.encode(), capture_output=True, check=True, ) hashed_and_salted_pw = proc.stdout.decode().strip() write_settings( self.settings_file, { 'TAILS_USER_PASSWORD': hashed_and_salted_pw, 'TAILS_PASSWORD_HASH_FUNCTION': 'SHA512', }) logging.debug('password written to %s', self.settings_file)
def save(self, language: str, is_default: bool): write_settings(self.settings_file, { 'TAILS_LOCALE_NAME': language, 'IS_DEFAULT': is_default, })
def save(self, value: Union[str, bool]): write_settings(self.settings_file, { self.setting_name: value, }) logging.debug('setting %s written to %s', self.setting_name, self.settings_file)
def save(self, locale: str, is_default: bool): write_settings(self.settings_file, { 'TAILS_FORMATS': locale, 'IS_DEFAULT': is_default, })