示例#1
0
    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,
            })
示例#2
0
文件: admin.py 项目: austin987/tails
    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)
示例#3
0
 def save(self, language: str, is_default: bool):
     write_settings(self.settings_file, {
         'TAILS_LOCALE_NAME': language,
         'IS_DEFAULT': is_default,
     })
示例#4
0
 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)
示例#5
0
 def save(self, locale: str, is_default: bool):
     write_settings(self.settings_file, {
         'TAILS_FORMATS': locale,
         'IS_DEFAULT': is_default,
     })