Beispiel #1
0
    def load(self) -> str:
        try:
            settings = read_settings(self.settings_file)
        except FileNotFoundError:
            raise SettingNotFoundError(
                "No persistent settings file found for %s (path: %s)" %
                (self.setting_name, self.settings_file))

        value_str = settings.get(self.setting_name)
        if value_str is None:
            raise SettingNotFoundError(
                "No setting %s found in settings file (path: %s)" %
                (self.setting_name, self.settings_file))
        return value_str
Beispiel #2
0
    def load(self):
        # We don't return the stored value, because the UI can't do
        # anything with it since it's hashed.
        try:
            settings = read_settings(self.settings_file)
        except FileNotFoundError:
            raise SettingNotFoundError(
                "No persistent admin settings file found (path: %s)" %
                self.settings_file)

        if settings.get('TAILS_USER_PASSWORD') is None:
            raise SettingNotFoundError(
                "No admin password setting found in settings file (path: %s)" %
                self.settings_file)
Beispiel #3
0
    def load(self):
        """Read and return the *hashed* password from the settings file"""
        try:
            settings = read_settings(self.settings_file)
        except FileNotFoundError:
            raise SettingNotFoundError(
                "No persistent admin settings file found (path: %s)" %
                self.settings_file)

        hashed_and_salted_pw = settings.get('TAILS_USER_PASSWORD')
        if hashed_and_salted_pw is None:
            raise SettingNotFoundError(
                "No admin password setting found in settings file (path: %s)" %
                self.settings_file)

        return hashed_and_salted_pw
Beispiel #4
0
    def load(self) -> (str, bool):
        try:
            settings = read_settings(self.settings_file)
        except FileNotFoundError:
            raise SettingNotFoundError(
                "No persistent language settings file found (path: %s)" %
                self.settings_file)

        language = settings.get('TAILS_LOCALE_NAME')
        if language is None:
            raise SettingNotFoundError(
                "No language setting found in settings file (path: %s)" %
                self.settings_file)

        is_default = settings.get('IS_DEFAULT') == 'true'
        logging.debug("Loaded language setting '%s' (is default: %s)",
                      language, is_default)
        return language, is_default
Beispiel #5
0
    def load(self) -> (str, bool):
        try:
            settings = read_settings(self.settings_file)
        except FileNotFoundError:
            raise SettingNotFoundError(
                "No persistent formats settings file found (path: %s)" %
                self.settings_file)

        formats = settings.get('TAILS_FORMATS')
        if formats is None:
            raise SettingNotFoundError(
                "No formats setting found in settings file (path: %s)" %
                self.settings_file)

        is_default = settings.get('IS_DEFAULT') == 'true'
        logging.debug("Loaded formats setting '%s' (is default: %s)", formats,
                      is_default)
        return formats, is_default
Beispiel #6
0
    def load(self) -> (str, bool):
        try:
            settings = read_settings(self.settings_file)
        except FileNotFoundError:
            raise SettingNotFoundError(
                "No persistent keyboard settings file found (path: %s)" %
                self.settings_file)

        keyboard_layout = settings.get('TAILS_XKBLAYOUT')
        if keyboard_layout is None:
            raise SettingNotFoundError(
                "No keyboard setting found in settings file (path: %s)" %
                self.settings_file)

        keyboard_variant = settings.get('TAILS_XKBVARIANT')
        if keyboard_variant:
            keyboard_layout += "+" + keyboard_variant

        is_default = settings.get('IS_DEFAULT') == 'true'
        logging.debug("Loaded keyboard setting '%s' (is default: %s)",
                      keyboard_layout, is_default)
        return keyboard_layout, is_default